Class: LunarLander::Leveldone
- Inherits:
-
Chingu::GameState
- Object
- Chingu::GameState
- LunarLander::Leveldone
- Defined in:
- lib/lunar_lander/game_states/leveldone.rb
Instance Method Summary collapse
- #draw ⇒ Object
-
#initialize(options = {}) ⇒ Leveldone
constructor
A new instance of Leveldone.
- #new_game ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Leveldone
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/lunar_lander/game_states/leveldone.rb', line 5 def initialize( = {}) super @white = Gosu::Color.new(255,255,255,255) @color = Gosu::Color.new(200,0,0,0) @font = Gosu::Font[35] @text = ["Parabéns! Pouso perfeito!","Pressione 'n' para tentar novamente."] self.input = { :n => :new_game } end |
Instance Method Details
#draw ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/lunar_lander/game_states/leveldone.rb', line 20 def draw previous_game_state.draw # Draw prev game state onto screen (in this case our level) $window.draw_quad( 0,0,@color, $window.width,0,@color, $window.width,$window.height,@color, 0,$window.height,@color, Chingu::DEBUG_ZORDER) @text.each_with_index do |text, index| @font.draw(text, ($window.width/2 - @font.text_width(text)/2), $window.height/2 - (@font.height - (index * @font.height)), Chingu::DEBUG_ZORDER + 1) end end |
#new_game ⇒ Object
16 17 18 |
# File 'lib/lunar_lander/game_states/leveldone.rb', line 16 def new_game switch_game_state LunarLander::Play end |