Class: EscapeState

Inherits:
GameState show all
Includes:
Singleton
Defined in:
lib/lib/game_states/escape_state.rb

Overview

Game state of closing the game window

Instance Method Summary collapse

Methods inherited from GameState

#after_start, #before_end, switch!

Instance Method Details

#drawObject



29
30
31
32
33
# File 'lib/lib/game_states/escape_state.rb', line 29

def draw
   confirmation = Gosu::Image.from_text(
     "Are you sure you want to quit? Y/N", 20)
   confirmation.draw((3*TILESIZE) + XTEXT, (4*TILESIZE) + YTEXT, ZTEXT)
end

#update(button) ⇒ Object

Process given button to cursor



20
21
22
23
24
25
26
27
# File 'lib/lib/game_states/escape_state.rb', line 20

def update(button)
  case(button)
  when Gosu::KbY then
    $window.close
  when Gosu::KbN, Gosu::KbEscape then
    GameState.switch!(PlayState.instance) # TODO return to state that called you
  end
end