Is this how you check if none are visible?

0 favourites
  • 8 posts
  • Just wondering if this is the correct way to check if there are no visible objects. It works, but I'm just wondering if there is a better way or not.

    How would I make it so it only checks once? Can I add a trigger once while true somewhere? because from what I gather it would do this every tick.


  • A cleaner way to do the above would be to place the 'stop sound' action under an inverted 'Is Visible' event. Read about inverted events here:

    There may be a better way to handle this, but it would depend on the specifics of the game's design.

  • TiAm , But that would stop it if any of them are invisible, not if all of them are invisible.

  • how about

  • edit: whoops, codah beat me to it! <img src="{SMILIES_PATH}/icon_cool.gif" alt="8-)" title="Cool"> But...I have a capx! So there! <img src="{SMILIES_PATH}/icon_mrgreen.gif" alt=":mrgreen:" title="Mr. Green">

    Ah, I was assuming that you were triggering sounds per-object (don't know why I thought that). In that case my suggestion would indeed fail.

    If you want to avoid the 'else', you could do this:

    Is NOT visible

    Obj.Count = Obj.PickedCount

    capx: ... .capx?dl=0

  • Thanks for showing an alternative way. I'm thinking the Else would be quicker since it doesn't require calculating if count = pickedcount, right?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Technically it would be a bit more efficient. In real use, comparing two numerical values every tick is a trivial process, even on a mobile.

    The else logic strikes me as being possibly confusing, but that may just be me. Use whichever approach you find easier to understand.

    The thing that can kill here is the 'is visible' command. If you plan on having a lot of these objects present in the layout (>100), you should make sure that this logic only runs when triggered, instead of running as a 'dumb test' every tick.

    If there will only be a handful of these objects in the game at any one time, I wouldn't worry about it.

  • I had a capx just didn't bother uploading it

    Here's an option that's not every tick. with capx

    As far as being quicker.. that's probably a mico optimization. If you can measure any difference in your app.. go for it.

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