How do I destroy 1 particle effect not all of them?

0 favourites
  • 6 posts
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • I have a ship, you press Z to spawn missile and particles. Missile has physics behavior and particles have pin behavior.

    I pin particles to missile. they go flying into wall or off screen.

    when on collision with wall or off screen, I use events to destroy missile and particles.

    PROBLEM- when multiple missiles (and thus multiple particles) are on screen, particles get destroyed in all cases, the missiles get destroyed one by one as spawned

    It was my understanding that events calling destroy pick on the order of spawn to destroy.

    where am I going wrong? is there another way to group different objects, have them act as one, and destroy as one?

    This link should work

    1drv.ms/u/s!AllbEAlQnL0FhGJ1TN8hA5ttADVR

    Tagged:

  • The particles do not relate to any rocket. The rocket picks itself but when you say particle destroy it picks all particles as none are defined. A quick fix is to put the rocket + particle in a 'container'. Then you create the rocket only, it creates the particle with it and relates to that rocket. When you destroy the rocket, the particle is destroyed. You never need to refer to particle, you say create rocket and destroy rocket, particle is created and destroyed like they are one object : construct.net/en/make-games/manuals/construct-3/project-primitives/objects/containers

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I get it now,

    event of (any) rocket outside of layout, - destroy rocket. (that is outside the layout)

    - destroy particles (no specified particles, just destroy (all))

    so what I was trying to do

    event of (any) rocket outside of layout, - destroy rocket. (that is outside the layout)

    event of (any) particle outside of layout, - destroy particles (that is outside the layout)

    better option

    event of rocket container outside of layout, - destroy rocket container (that is outside the layout)

    Cool, Thanks!

  • tinbashingstudios - containers are a great way to do this.

    just for future reference here are some other options to remember:

    when you have a rocket selected, you could use "Pick Nearest" to get the instance of particles closest to that rocket.

    another option would be to use "Pick by Evaluate" and pick the particles where the PinnedUID equals the Rockets UID to make sure you get the right one.

    if you weren't using Pin, you could also add an instance variable to particles and store the rocket's UID in that.

  • (if undefined) I noticed the default create object instance location on a object is: on a object that is farthest object to the right.

    On collision I create explosive image where the rocket is but, if 2 rockets go flying and the farthest on left collides FIRST then farthest on the right will have the image spawned on it.

    this might be caused by it being in a function though/undefined

    I was hoping the (on collision, - call function to explode/destroy) would grab that information from the original action to select where to do action buut nope. I noticed the call function needs defining, so if i put the spawn object action OR destroy action it just does whatever

    Time to learn more about implementing pick the uid/nearest!

  • System create object doesnt pick any instances so it'll pick the one that was created first, has the lowest UID, so in your game it'll be the one on the right. Spawn should work well though because you are picking the rocket. If you say rocket on destroyed > rocket spawn explosion it will pick that rocket.

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