tritris
tritris copied to clipboard
Controller / Gamepad support
It would be much more relaxing to play the game with a controller. Maybe it is possible to add support for controllers.
I believe controller support will be possible using the gamepad API. I can look into this, but I don't have a controller to connect to my computer so it may be difficult to test.
I don't really have experience with the gamepad API yet, but I should be able to help with that. I'll finish a current project first, because I have so many open project's and then I'll give it a try. Might still take a while though. Would you accept pull requests regarding this?
I have created a separate function for handling input (https://github.com/Goel25/tritris/blob/main/utility.js#L30). This should make it easier to add controller support. You'll just have to connect the controller, then in that function, if a controller is connected, return a boolean value of whether the button on the controller corresponding to keyCode
is pressed.
I'm sorry I didn't have time for this yet. Am currently drowning in a massive backlog with urgent stuff crashing in. I've rescheduled my go-to date to the end of July but it will probably be delayed even further :/
No worries! Multiplayer will be released in a few weeks and, if you've done it by then, I can transfer the gamepad support to there as well.
Thanks to @SuperC03 controller support has been added!