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

For questions about using Classic.

Post » Sun Feb 06, 2011 12:02 pm

Hello!

I'm having another problem that I'm trying to fix, what I need is, when [color=#FF0000:2bax2lhc]all of the 'Enemy1' objects are destroyed on current layout[/color:2bax2lhc], [color=#0000BF:2bax2lhc]set "Level Complete" Sprite opacity to 100[/color:2bax2lhc]. How would I make that [color=#FF0000:2bax2lhc]condition[/color:2bax2lhc]? I already know how to make the Level Complete [color=#0000BF:2bax2lhc]Action[/color:2bax2lhc] though.

Thanks for reading, hope to hear some replies pretty soon :)
B
2
G
1
Posts: 27
Reputation: 504

Post » Sun Feb 06, 2011 12:07 pm

You could have a global variable act as a counter for all of the Enemy1 objects. If there's a set number of them, set the counter for that total number -- if there isn't a set number, add 1 to the counter each time they spawn.

Likewise, subtract 1 when they're destroyed. If that works out right, the counter should hit 0 when the final object is destroyed, which is when you can continue with the level complete action.

That should get the job done, let me know if it doesn't. :D
B
20
S
9
G
6
Posts: 607
Reputation: 6,112

Post » Sun Feb 06, 2011 12:10 pm

I have actually already tried that, but it didn't work! I thought that would work! There isn't really any reason why it wouldn't work :/
B
2
G
1
Posts: 27
Reputation: 504

Post » Sun Feb 06, 2011 12:19 pm

Ohh, really? Well... the problem could lie elsewhere, then, because you're right in saying there's no reason it wouldn't work. :P

It'd be a lot easier to help you if you posted the .cap file so we can see what's going on. I see you're new here, so you should make an account at dropbox.com where you can upload your files for easy access. You can use this link if you want:

http://db.tt/ptX6QWs

I'm pretty new myself, and it was confusing for a day or two before someone actually explained to me how to share .cap files. All you have to do is download and install the... uh, dropbox thingy, and it'll create a folder for you where you can put a file you want to share. Then, you can go to the website and copy the public URL for the file and post it here, so we'll be able to download it and help you out. Hopefully this'll spare you the same confusion I had!
B
20
S
9
G
6
Posts: 607
Reputation: 6,112

Post » Sun Feb 06, 2011 1:35 pm

Yeah thanks! I've actually already uploaded it to MediaFire, heres the link:
http://www.mediafire.com/?0pm804urt9jk2

Thanks for the replies awesome Uncharted 2 fan xD
B
2
G
1
Posts: 27
Reputation: 504

Post » Sun Feb 06, 2011 1:50 pm

You're quite welcome, awesome... Greek mythology fan? :P

I'll take a look at the cap and see if I can get it working, hopefully won't take TOO long...
B
20
S
9
G
6
Posts: 607
Reputation: 6,112

Post » Sun Feb 06, 2011 1:56 pm

Haha yeah actually, I also got the name from Resistance 2 on PS3 and Greek Mythology :P
Thanks!!
B
2
G
1
Posts: 27
Reputation: 504

Post » Sun Feb 06, 2011 2:14 pm

I never played Resistance 2, actually... I beat the first and just, well, never got around to the second. Now that there's a third one I better get to it! :shock:

Alrighty, after messing around with a bunch of things, I think I found the problem. (Emphasis on the word THINK, because like I said, I'm new here too, and I certainly don't know my way around Construct as well as some of the other guys. :roll: )

But, I THINK the problem is that the game is treating both enemies as a single object. You should find some way to use families or containers to group the gun and the tank together, too -- on the second layout, see how when you blow up one tank, the other tank's gun vanishes? It isn't distinguishing between them properly, which might be leading to this problem. I haven't worked with that stuff yet, so I can't really help any more than that... hope it's enough to get you going. If it isn't, sorry! :cry:
B
20
S
9
G
6
Posts: 607
Reputation: 6,112

Post » Sun Feb 06, 2011 2:18 pm

Heh thanks for the help, I'll try again later!
B
2
G
1
Posts: 27
Reputation: 504

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

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 5 guests