Check all enemies are dead?

Get help using Construct 2

Post » Sat Apr 14, 2012 10:18 am

I'm stuck!

I'm making an Asteroids clone and all is going well except I'm not sure on how to check all the asteroids are dead so I can restart the level. Does anyone know of a way to check this? Cheers.

EDIT* Just pointing out that there are around 6 different objects as Asteroids and several instances of those objects that can be 'alive' at any one time. If it was 1 or 2 things to check the state of I'd be OK, it's the fact there can be so many things to check that's throwing me.vandinz2012-04-14 10:24:22
B
19
S
5
G
4
Posts: 208
Reputation: 3,960

Post » Sat Apr 14, 2012 11:28 am

From my own experience the best way is to add a global variable that you add 1 to every time a big asteroid and smaller asteroids spawn and subtract one from it every time one is destroyed. When the variable is at zero you can set a new level to start.

N.b. I currently use two global variables for this one counting up to a set point and one counting down. to make sure there are no mistakes but i am dealing with a more complex tower defence game.. one variable should be plenty for you :)
B
25
S
7
G
5
Posts: 185
Reputation: 5,056

Post » Sat Apr 14, 2012 11:30 am

Great idea! I'll give that a try now. Cheers.
B
19
S
5
G
4
Posts: 208
Reputation: 3,960

Post » Sat Apr 14, 2012 2:27 pm

@vandinz
Please change your avatar, i'm pretty sure there's kids in this community.

There's count expression for each objects, check this example:

http://dl.dropbox.com/u/48963688/Capx%20only/count_check.capx
B
34
S
8
G
5
Posts: 174
Reputation: 5,791

Post » Sat Apr 14, 2012 2:43 pm

count might be a better way of doing it now i look at that capx. Might switch to using .count myself.
B
25
S
7
G
5
Posts: 185
Reputation: 5,056

Post » Sat Apr 14, 2012 8:18 pm

if theres multiple objects that make up your enemies then make an enemy family then make sure the families .count is 0
B
13
S
5
G
2
Posts: 306
Reputation: 3,262


Return to How do I....?

Who is online

Users browsing this forum: Artpunk, DemantDigitalArt, Magistross and 27 guests