I just added an auto-moving background to my html5 canvas js car game. The two car sprites I have should be on top of the background, which is a road on my komodo edit (but starry night for this question). Unfortunately, the background is overlapping the two sprites. Anyone know how to put the background in the background of the canvas? Thanks in advance.
Asked
Active
Viewed 794 times
1 Answers
1
There's a simple fix!
Replace your 2 animation loops with one requestAnimationFrame
loop.
Then in that requestAnimationFrame loop:
- Draw the background.
- Draw the cars.

markE
- 102,905
- 11
- 164
- 176
-
Sorry for the trouble, but you specify a bit more, with code? I'm a beginner in coding and got most of this from a tutorial. – SasukeRinnegan Nov 27 '14 at 03:31