You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As we have only a fixed set of enemies, we need them to repeat after all have passed the player. We do this by defining a `maxDistance` that is the total radius of all enemies.
The enemies should repeat whenever `enemyProgress` exceeds this `maxDistance`. You see this in `radiusFor` where we calculate the radius for every enemy modulo `maxDistance`:
We subtract the `enemyProgress`, so that value will be negative (for most enemies). But because we take the modulo `maxDistance` of it, it will always be between 0 and `maxDistance` and will decrease for every enemy over time.
0 commit comments