Click here to Skip to main content
15,899,937 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
So my animations are working. Mouse and keyboard controls are working, but my images keep flickering. The problem is I've used

JavaScript
setInterval();


which (I think) is causing my images to flicker. I'm trying to use

JavaScript
requestAnimationFrame(); 


to solve this, but all my elements just disappear when I replace setInterval with requestAnimationFrame. Does anyone know how I could solve this problem? Sorry if the flickering gives you a headache. Thanks in advance.

Link to code: Fong
Link to game: Fong

PS: the Game Over alert at the end is also a problem, it keeps showing up so you would have to 'prevent additional dialogues.' Working on this now, if you have any suggestions please let me know.

What I have tried:

I'm trying to use

JavaScript
requestAnimationFrame(); 


to solve this, but all my elements just disappear when I replace setInterval with requestAnimationFrame.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900