Skip to content

Gamepad #88

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

Gamepad #88

wants to merge 4 commits into from

Conversation

Rb64
Copy link
Contributor

@Rb64 Rb64 commented Feb 10, 2022

Added Gamepad support.

@patorjk
Copy link
Owner

patorjk commented Feb 20, 2022

This is a cool idea. I hadn't worked with the gamepad API before so I had to read up on it some. I made some changes to make the game work in Chrome. It's still not ready yet but it's closer. It still needs arrow button support and possibly some tightening up of the controls.

The main problem you were running into was you were putting the gamepad code in the Snake when it needed to be in the Board (which has an instance of the snake). It's been forever since I've looked at this code so I was a bit confused too. I may need to go in and clean things up a bit as some of the variables were a bit confusing (ie: isFirstMove - I think that relates to queued moves, which have long been removed so that may not be needed anymore).

@Rb64
Copy link
Contributor Author

Rb64 commented Feb 27, 2022

Thanks! I took a quick glance at what you changed, and it seems to make a lot more sense now. I will hopefully find some time to finish this soon. Yes, it’s my first time working with the gamepad API to, but it seems quite interesting it’s just a pain that there is no capability for handling gamepad button press or joystick events. The whole project is great work by the way!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants