Skip to content

Instantly share code, notes, and snippets.

@shawn42
Created March 14, 2009 22:32
Show Gist options
  • Save shawn42/79209 to your computer and use it in GitHub Desktop.
Save shawn42/79209 to your computer and use it in GitHub Desktop.
i = @input_manager
i.reg KeyDownEvent, K_SPACE do
ship.warp vec2(rand(400)-100,rand(400)-100)
end
i.reg KeyDownEvent, K_LEFT do
ship.moving_left = true
end
i.reg KeyDownEvent, K_RIGHT do
ship.moving_right = true
end
i.reg KeyDownEvent, K_UP do
ship.moving_forward = true
end
i.reg KeyDownEvent, K_DOWN do
ship.moving_back = true
end
i.reg KeyUpEvent, K_LEFT do
ship.moving_left = false
end
i.reg KeyUpEvent, K_RIGHT do
ship.moving_right = false
end
i.reg KeyUpEvent, K_UP do
ship.moving_forward = false
end
i.reg KeyUpEvent, K_DOWN do
ship.moving_back = false
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment