Skip to content
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

ontouchstart Event Handlers in the game #1

Open
BetterCallSaud opened this issue May 29, 2021 · 2 comments
Open

ontouchstart Event Handlers in the game #1

BetterCallSaud opened this issue May 29, 2021 · 2 comments
Labels
good first issue Good for newcomers

Comments

@BetterCallSaud
Copy link
Owner

Event listeners for Touch events for mobile devices are not working in my code.

@BetterCallSaud BetterCallSaud added the good first issue Good for newcomers label May 29, 2021
@AyushRaj8271
Copy link

Hey @SuperbSaud .Can you be bit more elaborate with the issue?

@BetterCallSaud
Copy link
Owner Author

Hey @SuperbSaud .Can you be bit more elaborate with the issue?


If you check out my code in the starship.js file, I have added 3 images of the arrow buttons from the 'assets' folder. I am able to display them on the Game canvas, but when I try to add touch event listeners for them, they do not work. I have written three functions: up( ), left( ) and right( ) for moving our starship to the left, right or to perform retropropulsion, i.e. acting the rocket engine against gravity to slow down the craft and land. For my event listeners, I called these three functions inside them. But when I tried to test it on my mobile phone, the event listeners did not work.

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

No branches or pull requests

2 participants