Destruction of all enemies

For questions about using Classic.

Post » Thu Apr 21, 2011 5:37 am

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?
B
2
G
2
Posts: 12
Reputation: 674

Post » Thu Apr 21, 2011 7:02 am

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.
Check out my VGM on my soundcloud page!
Video-Game Music: E.C.2151
B
7
S
2
G
2
Posts: 193
Reputation: 1,561

Post » Thu Apr 21, 2011 10:55 am

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.
B
2
S
2
G
3
Posts: 406
Reputation: 2,062

Post » Fri Apr 22, 2011 2:26 am

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.
B
2
G
2
Posts: 12
Reputation: 674

Post » Fri Apr 22, 2011 3:47 am

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.
B
134
S
65
G
16
Posts: 1,766
Reputation: 19,190

Post » Fri Apr 22, 2011 10:39 pm

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.
B
2
S
2
G
3
Posts: 406
Reputation: 2,062


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 5 guests