+ 1
How do you stop an animation frame in JS?
I finished the game development course and am making a game, but I canāt stop the game because I donāt know how stop the animation frame.
5 Answers
+ 1
I added "onload" function so canvas won't be undefined
https://code.sololearn.com/WZNhtBMAkvFF/?ref=app
cancleAnimationFrame is used to stop game as well as you can add some variable like GAME_OVER = false
And run update, render method only when the GAME_OVER is false
And when bird died GAME_OVER will be true
0
Share your code i mean like embedding it here.
It will be easier to help
0
I just gets an error
0
Ok thanks