+ 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.

24th Jan 2022, 1:26 PM
Tyler Hawkins
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
30th Jan 2022, 8:37 AM
KRiShNa P
KRiShNa P - avatar
0
Share your code i mean like embedding it here. It will be easier to help
29th Jan 2022, 8:07 PM
ShadowCipher
ShadowCipher - avatar
30th Jan 2022, 5:29 AM
Tyler Hawkins
0
I just gets an error
30th Jan 2022, 5:29 AM
Tyler Hawkins
0
Ok thanks
30th Jan 2022, 4:35 PM
Tyler Hawkins