Class: SpaceInvaders::GameOverScreen
- Includes:
- Centerable
- Defined in:
- lib/space_invaders/screens/game_over_screen.rb
Instance Attribute Summary collapse
-
#control_index ⇒ Object
readonly
Returns the value of attribute control_index.
-
#game_over_message ⇒ Object
readonly
Returns the value of attribute game_over_message.
-
#press_play ⇒ Object
readonly
Returns the value of attribute press_play.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Attributes inherited from Base
Instance Method Summary collapse
- #draw ⇒ Object
-
#initialize(app) ⇒ GameOverScreen
constructor
A new instance of GameOverScreen.
Methods included from Centerable
#horizontal_center_draw, #vertical_center_draw
Methods inherited from Base
Constructor Details
#initialize(app) ⇒ GameOverScreen
Returns a new instance of GameOverScreen.
10 11 12 13 14 15 |
# File 'lib/space_invaders/screens/game_over_screen.rb', line 10 def initialize app super @game_over_message = Gosu::Image.from_text app, "G A M E O V E R", App::DEFAULT_FONT, 50 @press_play = Gosu::Image.from_text app, "PRESS SPACE TO PLAY AGAIN", App::DEFAULT_FONT, 30 @press_play_counter = 0 end |
Instance Attribute Details
#control_index ⇒ Object (readonly)
Returns the value of attribute control_index.
8 9 10 |
# File 'lib/space_invaders/screens/game_over_screen.rb', line 8 def control_index @control_index end |
#game_over_message ⇒ Object (readonly)
Returns the value of attribute game_over_message.
8 9 10 |
# File 'lib/space_invaders/screens/game_over_screen.rb', line 8 def @game_over_message end |
#press_play ⇒ Object (readonly)
Returns the value of attribute press_play.
8 9 10 |
# File 'lib/space_invaders/screens/game_over_screen.rb', line 8 def press_play @press_play end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
8 9 10 |
# File 'lib/space_invaders/screens/game_over_screen.rb', line 8 def result @result end |
Instance Method Details
#draw ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/space_invaders/screens/game_over_screen.rb', line 17 def draw set_result horizontal_center_draw , 100 horizontal_center_draw result, 200 horizontal_center_draw press_play, 300 if press_play_counter.between?(30,60) update_press_play_counter end |