Home > other >  Do a JS version plants vs zombies, about function, respectively
Do a JS version plants vs zombies, about function, respectively

Time:09-22

About plants bullets fired, I divided into two functions, one for the creation of new dynamic figure (bullets), a used to move its position, and settimeout itself in this function, the cause, so each new launch a bullet, faster than before, after and before the bullet in the second bullet fired immediately stopped the function call, stopped, how to solve this problem?

CodePudding user response:

You can try to unified handling all the bullets in the settimeout