Class: SpaceInvaders::WelcomeScreen
- Includes:
- Centerable
- Defined in:
- lib/space_invaders/screens/welcome_screen.rb
Instance Attribute Summary collapse
-
#control_index ⇒ Object
readonly
Returns the value of attribute control_index.
-
#press_play ⇒ Object
readonly
Returns the value of attribute press_play.
-
#welcome_message ⇒ Object
readonly
Returns the value of attribute welcome_message.
Attributes inherited from Base
Instance Method Summary collapse
- #draw ⇒ Object
-
#initialize(app) ⇒ WelcomeScreen
constructor
A new instance of WelcomeScreen.
Methods included from Centerable
#horizontal_center_draw, #vertical_center_draw
Methods inherited from Base
Constructor Details
#initialize(app) ⇒ WelcomeScreen
Returns a new instance of WelcomeScreen.
10 11 12 13 14 15 16 |
# File 'lib/space_invaders/screens/welcome_screen.rb', line 10 def initialize app super = Gosu::Image.from_text app, "SpaceInvaders.rb", App::DEFAULT_FONT, 50 @control_index = Gosu::Image.from_text app, control_index_string, App::DEFAULT_FONT, 20 @press_play = Gosu::Image.from_text app, "PRESS SPACE TO PLAY", 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/welcome_screen.rb', line 8 def control_index @control_index end |
#press_play ⇒ Object (readonly)
Returns the value of attribute press_play.
8 9 10 |
# File 'lib/space_invaders/screens/welcome_screen.rb', line 8 def press_play @press_play end |
#welcome_message ⇒ Object (readonly)
Returns the value of attribute welcome_message.
8 9 10 |
# File 'lib/space_invaders/screens/welcome_screen.rb', line 8 def end |
Instance Method Details
#draw ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/space_invaders/screens/welcome_screen.rb', line 18 def draw horizontal_center_draw , 100 horizontal_center_draw control_index, 200 horizontal_center_draw press_play, 350 if press_play_counter.between?(30,60) update_press_play_counter end |