-
Notifications
You must be signed in to change notification settings - Fork 7
Events
burtlo edited this page Nov 25, 2012
·
5 revisions
A scene or model can respond to the following events:
- Keyboard button, gamepad button, or mouse button down events or on_down.
This is the first event that is generated when a user presses the button down.
- Keyboard button, gamepad button, or mouse button held events or on_hold, on_held.
This is the second event that is generated when a user holds a button down. This event will continue to trigger while the button is held down.
- Keyboard button, gamepad button, or mouse button up events or on_up.
This is the third event that is generated when a user releases a down/held button.
You can specify a course of action with the following hash do: :name_of_method
.
class ExampleScene
event :on_down, KbSpace do: :hero_jump
def hero_jump
hero.jump
end
end
When the Space Key has been pressed down, the method hero_jump will be executed.
You can specify a course of action with a block:
class ExampleScene
event :on_down, GpSpace do
hero.jump
end
end
When the Space Key has been pressed down, the block defined will be executed.