I have a game where I need an enemy to spawn after every 1350 milliseconds in a path. And the enemies only start coming after I click on the start button.
Time interval code:
sendEnemy = 0
def enemy_object_creation(sprite_list, health):
global sendEnemy
if pygame.time.get_ticks() >= sendEnemy:
foe = Enemy(sprite_list, health)
enemies.add(foe)
sendEnemy += 1350
Now here, when I click on the start button after around 5 secs, a bulk of of enemies come flooding at the beginning and then afterwards they again start coming smoothly. The more time I take to click on the start button, the more enemies spawn together at start. I'm not sure what to do about it.
Help will be appreciated.