Checking whether a specific key was pressed in enchantJS
Posted
by
MxyL
on Game Development
See other posts from Game Development
or by MxyL
Published on 2014-08-21T23:10:36Z
Indexed on
2014/08/22
4:28 UTC
Read the original article
Hit count: 278
I am using enchantJS and would like to use the letters and numbers as well as numpad on a keyboard to do different things (eg: hotkeys).
From this page http://users.csc.calpoly.edu/~foaad/enchant/guide/playerInput.html
By default, enchant.js provides input listeners for six buttons: UP, DOWN, LEFT, RIGHT, A, and B. By default, the directions are bound to the arrow keys. Any of the six buttons may also be bound to any key with an ASCII value. We’ll address that later.
So enchant provides the ability to bind keys to different input such as up, down, left, right...but how can I simply check whether the D
or X
key was pressed, and if so, perform certain actions based on that event?
© Game Development or respective owner