+ 3
How to fix this snake game's, after restart issue of abrupt snake movement?
Snake moves faster with every restart and i have no idea what is causing that or how to prevent that. Watch the video or test the app for better understanding of the problem. Video:https://drive.google.com/file/d/1Rtjw2tNWPl4l4qhD7K2jU1vsP_m7ZjFb/view?usp=drivesdk https://code.sololearn.com/WBOm4adsUrE1/?ref=app
3 Respostas
+ 2
The error is in:
function endOverlay()
You add an event listener to the overlay everytime the game ends, this event listener calls start, after a couple deaths you have several event listeners each calling start() on click, causing the game to update multiple times faster than it should.
solution add a check so that event listener is only added to the overlay once
+ 3
I'm still not good enough to help you, I hope you find an answer, if no one helps here consider asking in other places too, the game seems pretty cool tho, I hope by the end of this year I be able to make similar games too.
+ 1
If consistent,i guess you can make such after a month or two. Goodluck!