Class: SpaceInvaders::NextLevelScreen
- Includes:
- Centerable
- Defined in:
- lib/space_invaders/screens/next_level_screen.rb
Instance Attribute Summary collapse
-
#next_level_message ⇒ Object
readonly
Returns the value of attribute next_level_message.
Attributes inherited from Base
Instance Method Summary collapse
- #draw ⇒ Object
-
#initialize(app) ⇒ NextLevelScreen
constructor
A new instance of NextLevelScreen.
- #timer_start! ⇒ Object
- #timer_stop! ⇒ Object
Methods included from Centerable
#horizontal_center_draw, #vertical_center_draw
Methods inherited from Base
Constructor Details
#initialize(app) ⇒ NextLevelScreen
Returns a new instance of NextLevelScreen.
10 11 12 13 |
# File 'lib/space_invaders/screens/next_level_screen.rb', line 10 def initialize app super @next_level_message = Gosu::Image.from_text app, "NEXT LEVEL", App::DEFAULT_FONT, 50 end |
Instance Attribute Details
#next_level_message ⇒ Object (readonly)
Returns the value of attribute next_level_message.
8 9 10 |
# File 'lib/space_invaders/screens/next_level_screen.rb', line 8 def @next_level_message end |
Instance Method Details
#draw ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/space_invaders/screens/next_level_screen.rb', line 15 def draw if time_passed? timer_stop! game_status.continue! else horizontal_center_draw , 300 end end |
#timer_start! ⇒ Object
24 25 26 |
# File 'lib/space_invaders/screens/next_level_screen.rb', line 24 def timer_start! @timeout = Time.now end |
#timer_stop! ⇒ Object
28 29 30 31 |
# File 'lib/space_invaders/screens/next_level_screen.rb', line 28 def timer_stop! app.invaders_container.reinitialize! @timeout = nil end |