Reputation: 8905
I have a simple requirement. If the cursors.right
key is released (after pressing down for movement) I'd like to launch an event.
However I can't find a proper function for that. I found cursors.right.isUp
but this is a boolean and will spam any functionality that is activated by it.
I thought there was an event callback for a one time release like cursors.right.onRelease('up', callback)
or something like that?
Upvotes: 0
Views: 1071
Reputation: 759
Managing key (and mouse) events is something built in in the framework.
You could check the events related to keyboard here or here
Basically you have 3 different events related to keyup
On a specific key object.
keyObj.on('up', function(event) { /* ... */ });
On a specific key, in an other way.
scene.input.keyboard.on('keyup-RIGHT', function (event) { /* ... */ });
On even on any key
scene.input.keyboard.on('keyup', function (event) { /* ... */ });
Upvotes: 1