Created
March 14, 2009 22:33
-
-
Save shawn42/79211 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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