Class: Processor
- Inherits:
-
Object
- Object
- Processor
- Defined in:
- lib/processor.rb
Overview
transitions and keeping track of windows
Constant Summary collapse
- Screen =
[1024, 768, false]
- TileSize =
48
- Caption =
"Blast Mavens: Multiplayer Beta v0.1.4"
Class Attribute Summary collapse
-
.players ⇒ Object
Returns the value of attribute players.
-
.window ⇒ Object
readonly
Returns the value of attribute window.
Class Method Summary collapse
- .all_bombs ⇒ Object
- .allow_multiplayer? ⇒ Boolean
- .center_for(x, y) ⇒ Object
- .center_map ⇒ Object
- .close ⇒ Object
- .game_over(death_toll) ⇒ Object
- .has_at_least_one_player? ⇒ Boolean
- .new ⇒ Object
- .solid_at?(x, y) ⇒ Boolean
- .start_game ⇒ Object
Class Attribute Details
.players ⇒ Object
Returns the value of attribute players.
19 20 21 |
# File 'lib/processor.rb', line 19 def players @players end |
.window ⇒ Object (readonly)
Returns the value of attribute window.
18 19 20 |
# File 'lib/processor.rb', line 18 def window @window end |
Class Method Details
.all_bombs ⇒ Object
47 48 49 |
# File 'lib/processor.rb', line 47 def all_bombs players.map {|p| p.bombs}.flatten end |
.allow_multiplayer? ⇒ Boolean
31 32 33 |
# File 'lib/processor.rb', line 31 def allow_multiplayer? true end |
.center_for(x, y) ⇒ Object
43 44 45 |
# File 'lib/processor.rb', line 43 def center_for(x, y) [center_for_coord(x), center_for_coord(y)] end |
.center_map ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/processor.rb', line 35 def center_map @center_map ||={}.tap do |center_coords| (0...768).each_slice(48) do |coords_range| center_coords[coords_range[24]] = coords_range end end end |
.close ⇒ Object
60 61 62 |
# File 'lib/processor.rb', line 60 def close @window.close end |
.game_over(death_toll) ⇒ Object
56 57 58 |
# File 'lib/processor.rb', line 56 def game_over(death_toll) @window.set_delegate("GameOver", death_toll) end |
.has_at_least_one_player? ⇒ Boolean
27 28 29 |
# File 'lib/processor.rb', line 27 def has_at_least_one_player? !players.empty? end |
.new ⇒ Object
21 22 23 24 25 |
# File 'lib/processor.rb', line 21 def new @players = [] @window = Window.new("Menu") @window.show end |
.solid_at?(x, y) ⇒ Boolean
64 65 66 |
# File 'lib/processor.rb', line 64 def solid_at?(x,y) @window.map ? @window.map.solid_at?(x,y) : false end |