Ask coding questions

← Back to all posts
Help im not sure what the problem is.
MatthewX (152)

When you ccomplete a level then click on another level, All of a sudden the player speed becomes so fast. I tried stopping the loops once you finish a level, but it didnt work. Help pls!

Comments
hotnewtop
SixBeeps (4767)

Where are you doing the game loop at? I can't find a setInterval anywhere.

MatthewX (152)

@SixBeeps i dont rlly have a loop

SixBeeps (4767)

@MatthewX Then how in the heck are you moving the player every frame the key is pressed?

MatthewX (152)

@SixBeeps using window.requestanimationframe i think

DynamicSquid (4602)

Have you tried resetting the speed everytime there's a new level?

MatthewX (152)

@DynamicSquid i dont set the speed anywhere. should i add it in?