Need Collision Detection Help.
Hey guys!
I have a fireball projectile, and want it to explode when it hits a wall/enemy/etc. I have it working so that the fireball is instantly destroyed when it touches one of such actors, but how do I make it animate an explosion before getting destroyed?
My current code inside the fireball actor looks like:
ANIMATE:
Series of 3 images that loops.
MOVE:
Direction: 0
Relative to: Actor
Move Type: Additive
Speed: 300
RULE EXPLODE:
When actor receives event -> overlaps or collides -> with actor with tag -> interactive objects
Animate: (Has a series of 5 pictures, unchecked loop and restore actor image.)
Timer: After 1 second,
Destroy this actor.
COLLIDE:
Bounce when colliding with: actor with tag -> interactive objects.
Any suggestions on what to do?
I have a fireball projectile, and want it to explode when it hits a wall/enemy/etc. I have it working so that the fireball is instantly destroyed when it touches one of such actors, but how do I make it animate an explosion before getting destroyed?
My current code inside the fireball actor looks like:
ANIMATE:
Series of 3 images that loops.
MOVE:
Direction: 0
Relative to: Actor
Move Type: Additive
Speed: 300
RULE EXPLODE:
When actor receives event -> overlaps or collides -> with actor with tag -> interactive objects
Animate: (Has a series of 5 pictures, unchecked loop and restore actor image.)
Timer: After 1 second,
Destroy this actor.
COLLIDE:
Bounce when colliding with: actor with tag -> interactive objects.
Any suggestions on what to do?
Comments
On your explosion actor (first frame) put an animate behaviour and drag all three frames (in order !) into the animate panel.
Then below this place a timer and set this to how long you want the final frame to linger (or if looped, how long you want the loop to run for) . . . then nested within this have a destroy command.
. . . . . . . . . .
Ok, go back to your fireball . . tell it that when it hits (collides or overlaps) with it's target then destroy this actor and spawn the explosion actor (which will animate and then disappear).
Hope that makes sense.