makenai / robotnik

Drag and drop robotics educational library starring Johnny Five and Blockly (crowd goes wild)
52 stars 13 forks source link

Gamepad and keyboard support #15

Open makenai opened 9 years ago

makenai commented 9 years ago

The virtual joystick is cool, but gamepad / keyboard support would be better for battles. Note there is a gamepad API spec. The virtual joystick and buttons should give visual feedback that the buttons are being pressed, since connectivity with a single piece of hardware is fun enough to debug.

https://developer.mozilla.org/en-US/docs/Web/Guide/API/Gamepad

monteslu commented 9 years ago

+1

I did something similar for Nodeblu: https://chrome.google.com/webstore/detail/nodeblu/aanmmiaepnlibdlobmbhmfemjioahilm?hl=en-US

Gamepad API is slightly different than other browser inputs in that its not automatically evented. You need to setup a loop that checks state and possibly emit your own events.