tritris icon indicating copy to clipboard operation
tritris copied to clipboard

Controller / Gamepad support

Open Maingron opened this issue 3 years ago • 5 comments

It would be much more relaxing to play the game with a controller. Maybe it is possible to add support for controllers.

Maingron avatar May 10 '21 10:05 Maingron

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.

leognon avatar May 10 '21 15:05 leognon

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?

Maingron avatar May 10 '21 21:05 Maingron

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.

leognon avatar May 13 '21 16:05 leognon

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 :/

Maingron avatar Jun 27 '21 18:06 Maingron

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.

leognon avatar Jul 02 '21 01:07 leognon

Thanks to @SuperC03 controller support has been added!

leognon avatar Oct 23 '22 02:10 leognon