Skip to content

Instantly share code, notes, and snippets.

@shawn42
Created March 14, 2009 22:33
Show Gist options
  • Save shawn42/79211 to your computer and use it in GitHub Desktop.
Save shawn42/79211 to your computer and use it in GitHub Desktop.
@input_manager.when :event_received do |event|
case event
when KeyDownEvent
case event.key
when K_SPACE
ship.warp vec2(300,300)
when K_LEFT
ship.moving_left = true
when K_RIGHT
ship.moving_right = true
when K_UP
ship.moving_forward = true
when K_DOWN
ship.moving_back = true
end
when KeyUpEvent
case event.key
when K_LEFT
ship.moving_left = false
when K_RIGHT
ship.moving_right = false
when K_UP
ship.moving_forward = false
when K_DOWN
ship.moving_back = false
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment