All 'Enemy' Objects Destroyed, then display "Level Complete"

For questions about using Classic.

Post » Sun Feb 06, 2011 2:22 pm

Unless I'm reading this wrong, you want a condition that triggers when all objects of a certain type are destroyed, yes?

If so, it's quite simple (but easily missed if you're new to Construct).

Use the System>Compare to check the number of objects, like so:

+ System: Enemy1.Count Equal to 0

and then you can make your "End of Level" sprite appear.

If you're still not sure how to get to that, double-click the Event sheet, double-click the System object, and scroll down to Compare.
Then, highlight value 1 (should be already) and double-click your enemy1 sprite in the bottom pane, and then under Misc, you should see "get number of objects".
Double-click that and then click Finish.

Krush.
B
2
S
2
G
3
Posts: 406
Reputation: 2,062

Post » Sun Feb 06, 2011 2:43 pm

... Like I said... I'm pretty new too. >.>;
B
20
S
9
G
6
Posts: 607
Reputation: 6,112

Post » Sun Feb 06, 2011 2:52 pm

Just did what you said and it works perfectly!! Thanks!!

Hah well, thanks also for your help Mr Uncharted guy :)
B
2
G
1
Posts: 27
Reputation: 504

Post » Sun Feb 06, 2011 3:17 pm

There's a bug where if you use a family name for that, like enemy.count, it doesn't count them correctly. To get around that, you use system compare: countmatching("enemy") instead. That will tell you how many objects of that type are in the current selected object list, not how many of them are in the layout, so to find out how many objects are in a layout with it, it needs to be used before any other condition picks any family objects.
Moderator
B
88
S
32
G
33
Posts: 3,005
Reputation: 27,432

Post » Sun Feb 06, 2011 3:29 pm

Alright, I will use that if I find I have that bug in my game, thanks :)
B
2
G
1
Posts: 27
Reputation: 504

Previous

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests