user14341820
user14341820

Reputation:

How do I kill all of the enemy sprites on the screen?

I am trying to make a second level to my game, so when you get > 100 points it will delete all of the enemy sprites on the screen and then start the next level. I don't know how to delete them all. I do have an enemy sprite group called enemies, but I dont know how to use it in relation to .kill().

Upvotes: 3

Views: 279

Answers (2)

yakubszatkowski
yakubszatkowski

Reputation: 33

If the enemy groups also contains other groups of sprites you can also:

enemy_sprites_group = None

Upvotes: 0

Aayush Panda
Aayush Panda

Reputation: 554

Iterate through all sprites in the group and call .kill() on each one such as:

for sprite in group:
    sprite.kill()

Upvotes: 2

Related Questions