Particle & Destroy Behaviour workaround?

JCFordJCFord Member Posts: 785
edited November -1 in Working with GS (Mac)
I have an actor that when in contact with another actor I want it to create particles (explode effect) and then destroy itself - simple right?

The particle part works great on there own when it contact with the player, but as soon as I introduce the destroy behaviour it stops the particles from working?

RULE
Actor receives event - overlaps or collides with player then

Behaviour - Particles
Behaviour - Destroy

I have tried wrapping the destroy in a timer with a slight delay but it just stops the particles from working and I really need the actor to destroy and for there to be only particles.

Thanks for any advice.

Whats the way around this?

Comments

  • firemaplegamesfiremaplegames Member Posts: 3,211
    If you use a Particles Behavior, when you the destroy the actor, you destroy the particles as well.

    If you want particles that stick around after the actor is destroyed, or a smoke trail that fades out after the actor is destroyed, and doesn't just blink off, you'll need to do it this way:

    You need to create a separate actor that just contains the particles you want, name it myParticles or something like that.

    You'll need to create two global game attributes called PlayerX and PlayerY ( or whatever actor needs the particles)

    In the actor that needs the particles, add a spawn actor behavior, and spawn myParticles.
    Here is also where you'll constrain game.PlayerX and game.PlayerY to self.PositionX and self.PositionY

    In the myParticles actor, contrain self.Position.X and self.Position.Y to the global PlayerX and PlayerY
  • JCFordJCFord Member Posts: 785
    Hi firemaplegames
    thanks for the advice.

    Rather than generate a new actor for the particles which i would have to destroy at some point. I was thinking along the lines of using the change Atribute to make the actor invisible so it would just leave the particles, but then I need someway to disable the actor so it cannot interact with the player and produce more particles while invisible, and then after X seconds destroy it.....hmmmm
  • rebumprebump Member Posts: 1,058
    Maybe spawn an invisible location constrained actor that generates the particles and then move the collidable actor off-screen (since it must remain for the constrained location)?

    Oops. I just read what FireMapleGames just said...basically what I said in more detail. Oh well. :-)
  • MarkOnTheIronMarkOnTheIron Member Posts: 1,447
    What firemaplegames said worked for me in my Plinko! game.

    Just remember to add a timer rule on the spawn particle actor that destroy it after the explosion.
    (by the way I didn't constrain the positions)
  • rebumprebump Member Posts: 1,058
    Yeah, no need to constrain as you can fire it off the invisible actor, leaving it there, and destroy the visible one. Good catch.
  • wroachbarrettewroachbarrette Member Posts: 101
    i was having the same issue you should just destroy the actor then at the same time spawn the particles it would be easier than having to create new attributes for every actor you have spawn
Sign In or Register to comment.