class GameState

Managing of active game states

Public Class Methods

switch!(next_state) click to toggle source

Switch active state to next one

# File lib/lib/game_states/game_state.rb, line 4
def self.switch!(next_state)
  #puts 'DEBUG: switching to state ' + next_state.to_s

  unless $window.state.nil?
    $window.state.before_end
  end
  $window.state = next_state
  $window.state.after_start
end

Public Instance Methods

after_start() click to toggle source

What to do just after state gets activated

# File lib/lib/game_states/game_state.rb, line 15
def after_start
end
before_end() click to toggle source

What to do just before state gets deactivated

# File lib/lib/game_states/game_state.rb, line 19
def before_end
end
draw() click to toggle source
# File lib/lib/game_states/game_state.rb, line 25
def draw
end
update(button) click to toggle source
# File lib/lib/game_states/game_state.rb, line 22
def update(button)
end