Quantcast
Channel: 2D Latest Topics
Viewing all articles
Browse latest Browse all 623

rendering glitches, "doubled" assets on character movement

$
0
0

i am trying to figure out why assets sometimes “double” when character moves quickly. i think it’s probably a problem in gameLoop() or draw() but i can’t figure out where.

i want the player to move whenever the user presses a key, but the monster movement is on a timer (1x per second, or less depending on difficulty level). the requestAnimationFrame(renderViewport) call is inside draw(). draw() is called whenever character moves, but gameloop() only runs 1x/second (or per .5 second, etc) for monster movement, and there is a draw() call in there too. is there a better way to do this?

front end: anti-fascist-heroine-addiction.surge.sh

code: https://github.com/rifkegribenes/anti-fascist-heroine-addiction


Viewing all articles
Browse latest Browse all 623

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>