object association

This forum is currently in read-only mode.
From the Asset Store
Welcome! I-Spy (Hidden objects) is an educational puzzle that is more than just seek-and-find activities.
  • hi! i've discovered construct some months ago and been using it and loving it since then. up until know i had no doubts but now that i'm starting a serious project i came into a problem : ex.: there's a bullet and its trace made of particles.. when a bullet hits [solid] it is destructed ... ok but how do i destroy its trace at the same time? is there some way to associate both of them at creation? (i know there's the containers but....) dont know if i made myself clear enough but thats my problem

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If there's only one of each object, then containers are the way to go. Otherwise, you can store the UID of one of the objects in another's private variable, and when destroying it, also destroy the other object with that UID in its private variable.

  • yeah it' the second case.. i will try storing and comparing the UID's then.... thnx !

  • oops.. how do i get the object's UID ?

  • Using a container will run into another problem when doing a trace, or trail. You probably wont notice on smaller trace's but if its longer the trail will disappear faster than it should, because the particle is destroyed.

  • If you want the trail particles to live longer than its "master", you could set a private variable in each of them with the UID of the "master", then when a "master" object dies you would look up their children comparing their private variable with the UID of the dying "master" object and set off a timer behavior to kill it later.

    Doing so would kill the whole trail at the same time but a little while after the "master" dies.

    Of course, you could also have the timer event set off timers for other children, in which case you can arrange some pretty complex dying orders just storing the proper UID in the proper particle.

  • thank you guys i made it by associating and comparing UID's ! it works

  • If you want the trail particles to live longer than its "master", you could set a private variable in each of them with the UID of the "master", then when a "master" object dies you would look up their children comparing their private variable with the UID of the dying "master" object and set off a timer behavior to kill it later.

    Doing so would kill the whole trail at the same time but a little while after the "master" dies.

    Of course, you could also have the timer event set off timers for other children, in which case you can arrange some pretty complex dying orders just storing the proper UID in the proper particle.

    interesting , it is more realistic that way ... the way i did the particles dont disappear right away... i'll do that thnx

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