Open makenai opened 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.
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