Object after Destroy (feature request)

0 favourites
  • 4 posts
From the Asset Store
Welcome! I-Spy (Hidden objects) is an educational puzzle that is more than just seek-and-find activities.
  • Is there a way to evaluate existence of an object after Destroy action. If not could we have anything similar.

    What I am trying to accomplish, imagine you have n objects obj1…n, on first touch you destroy obj1, on second touch you check if there is no obj1, destroy obj2, on third touch you check for obj2 and destroy obj3...

    Right now you can’t do this, for example I tried this

    On Touched

    obj1 Is Visible -> obj1.Destroy

    obj2 Is Visible -> obj2.Destroy

    obj1 Not Is Visible

    obj3 Is Visible -> obj3.Destroy

    obj2 Not Is Visible

    And it won't work because destroyed object doesn't exist anymore so condition 'Is Visible' or 'Not Is Visible' is equally false and can't be used.

    So my question is, can it be done with current conditions, or can we have 'Is Exist' or similar conditon to evaluate.

  • You could use else.

    obj1 is visible -> obj1.destroy

    else

    obj2 is visible -> obj2.destroy

    else

    obj3 is visible -> obj3.destroy

    ...

  • for some more control you can also use compare two values system condition and use obj1.count=0

    https://www.scirra.com/manual/133/common-expressions

    Count

    The number of instances of the object type.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I just made an example problem to illustrate one possible usage. It is not unsolvable problem. In my case I solved similar problem with an array to keep track of objects, but I think it would be better if there is a way of checking existance of an object.

    I like the Count solution, didn’t think of it, would like the ‘Is Exist’ better, image representation in code and all that, but it should do.

    Thanks.

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