Need Collision Detection Help.

jwoo13jwoo13 Member Posts: 8
edited December 2011 in Working with GS (Mac)
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?

Comments

  • CloudsClouds Member Posts: 1,599
    When the actor hits it's target (collides) . . destroy that actor and spawn a new actor (your explosion)

  • jwoo13jwoo13 Member Posts: 8
    :o Lemme try that
  • jwoo13jwoo13 Member Posts: 8
    yay it worked, thanks!
  • CloudsClouds Member Posts: 1,599
    edited December 2011
    So . . . . (better explanation)

    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.
  • jwoo13jwoo13 Member Posts: 8
    I got it down, thanks :)
Sign In or Register to comment.