Destruction of all enemies

This forum is currently in read-only mode.
  • I am making a game and i want the game to open up a new layout when all the enemies in it are destroyed. How can i achieve this?

  • Here's what you do

    Whenever you destroy an enemy, make a certain private variable, i dunno, LevelGet, increase by 1.

    When LevelGet is at a certain number (all the enemies), you use the event Go To Layout.

  • A better way would be to use the .count function of objects.

    If all the enemies are the same type then check for enemy.count to equal zero each time you kill an enemy.

    If you have many different types of enemy, make sure they're all in the same family, and check the count of that family instead, like Blue.count = 0.

    Krush.

  • Thanks for both the replies. KrushBrother, can you please be a little more detailed. I dont know how to do the thing you are telling me to do.

  • New event -> system object -> compare. Then for value 1, go to the enemies and choose "get number of objects" or just type in "enemy.Count". Then finish.

    Then for the event's actions, just change layout.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Yeah, sorry.

    Sometimes it's easy to forget that some people have just started using Construct, and may not be familiar with it yet.

    If all your enemies are the same type (multiple copies of the same enemy), then do what Alspal has written.

    If you have more than one type of monster, add each type to the same family (say "Blue") in the editor (see wiki if you're not sure how to do this) and then instead of using enemy.count in the condition, use Blue.count.

    Krush.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)