Class: DemoState
- Defined in:
- lib/game_states/demo_state.rb
Instance Attribute Summary collapse
-
#tank ⇒ Object
Returns the value of attribute tank.
Attributes inherited from PlayState
#object_pool, #update_interval
Instance Method Summary collapse
Methods inherited from PlayState
Methods inherited from GameState
#leave, #needs_redraw?, switch
Constructor Details
This class inherits a constructor from PlayState
Instance Attribute Details
#tank ⇒ Object
Returns the value of attribute tank.
2 3 4 |
# File 'lib/game_states/demo_state.rb', line 2 def tank @tank end |
Instance Method Details
#button_down(id) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/game_states/demo_state.rb', line 19 def (id) super if id == Gosu::KbSpace target_tank = @tanks.reject do |t| t == @camera.target end.sample switch_to_tank(target_tank) end end |
#draw ⇒ Object
14 15 16 17 |
# File 'lib/game_states/demo_state.rb', line 14 def draw super @score_display.draw_top_right end |
#enter ⇒ Object
4 5 6 |
# File 'lib/game_states/demo_state.rb', line 4 def enter # Prevent reactivating HUD end |
#update ⇒ Object
8 9 10 11 12 |
# File 'lib/game_states/demo_state.rb', line 8 def update super @score_display = ScoreDisplay.new( object_pool, 20) end |