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

This forum is currently in read-only mode.
From the Asset Store
Be discreet and rescue your friends from behind enemy lines.
  • Hello!

    I'm having another problem that I'm trying to fix, what I need is, when all of the 'Enemy1' objects are destroyed on current layout, set "Level Complete" Sprite opacity to 100. How would I make that condition? I already know how to make the Level Complete Action though.

    Thanks for reading, hope to hear some replies pretty soon

  • 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.

  • 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 :/

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

    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!

  • 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

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

    I'll take a look at the cap and see if I can get it working, hopefully won't take TOO long...

  • Haha yeah actually, I also got the name from Resistance 2 on PS3 and Greek Mythology

    Thanks!!

  • 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!

    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. )

    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!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Heh thanks for the help, I'll try again later!

  • 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.

  • ... Like I said... I'm pretty new too. >.>;

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

    Hah well, thanks also for your help Mr Uncharted guy

  • 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.

  • Alright, I will use that if I find I have that bug in my game, thanks

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