class SpaceInvaders::ButtonController

Public Instance Methods

button_down(id) click to toggle source
# File lib/space_invaders/statics/button_controller.rb, line 6
def button_down id
  case id
  when Gosu::KbEscape
    escape
  when Gosu::KbSpace
    space
  end
end

Private Instance Methods

escape() click to toggle source
# File lib/space_invaders/statics/button_controller.rb, line 17
def escape
  app.close
end
space() click to toggle source
# File lib/space_invaders/statics/button_controller.rb, line 21
def space
  if game_status.hasnt_started?
    game_status.start!
  elsif game_status.being_played?
    app.ship.fire!
  elsif game_status.finished?
    app.initialize_dynamics_and_trackers
    game_status.start!
  end
end