How do I Avoid Counting Destroyed Instances?

  • If possible, I would like to confirm that something I am observing is intentional, unintentional, or an error in my events.

    Ok, so my layout has 4 instances of an object.

    I have a function named "deleteobject".

    • in a subevent's condition I pick one of these four instances (arbitrarily) by UID.
    • then use the normal "destroy" action in that same event for that object.
    • immediately following that action, in the same event, I set a global variable to object.count

    I call the function and destroy the object, then set the global variable to object.count, so object.count should return a value of 3 not 4 correct?

  • How are you checking the value of object.count? If you are using a visual notification, are you updating it?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There probably hasn't been time for the object to get destroyed. For a test, try a short System:Wait or put the variable update in a Function or different event.

  • The destroy action hasn't been completed if the event hasn't..

    Not untill the next top-event will there be less objects to count..

  • Ah, it does work as you say. Thanks for confirming the intended behavior. Knowing this, I can rework my event structure appropriately.

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