Distance between randomly spawned objects

Something like that. An enemy spawns at the beginning of the game and the rest need to be spawned randomly, but the first one must not be closer than x pixels from the right edge of the canvas.
I actually did something like this, but it was like: an enemy comes, i jump, another one comes, i jump, it wasn’t very challenging, although it was playable.
The second option sounds good too, for ex: don’t spawn another enemy if the previous one hasn’t been on the screen for 1 second

1 Like