playMaker

Author Topic: Help with projectile setup [solved]  (Read 987 times)

createasaurus

  • Full Member
  • ***
  • Posts: 145
    • View Profile
Help with projectile setup [solved]
« on: November 24, 2014, 12:56:16 PM »
I'd like my player to launch a slow moving projectile, when the projectile hits a block, the block (and projectile) disappear.

This is what I have so far:  The player presses a button.  A projectile (prefab) appears at a spawn point near the player character.  The projectile has velocity so it moves forward.  All good so far.  Now here is where I need help.  I tag the projectile as "projectile" and block as "block" - does that seem correct?  Then what exact actions do I use to detect this collision and trigger a destroy events for both projectile and block?

Thank you so much,
Chris (createasaurus)
« Last Edit: November 24, 2014, 01:52:33 PM by createasaurus »

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2488
  • Yup.
    • View Profile
    • Cleverous
Re: Help with projectile setup
« Reply #1 on: November 24, 2014, 01:11:25 PM »
On the projectile, while in motion remain in a state with the Collision Event action. Filter on the collide tag you want, choose the event to send when the collision occurs.

The Store Collider variable there would be used to store the object that the projectile hits. After the collision, the Collision Event action on the bullet will send its specified event. In the next state you use something like Send Event and target the variable you assigned in the Store Collider slot. On the object that it hit you'll have that event go to a state where it responds to the collision (damage, death, etc.).

After sending that event from the Projectile, it would destroy itself in the next state. Check out the Top Down shooter series on the YouTube page. It covers this entirely along with a health template idea.

createasaurus

  • Full Member
  • ***
  • Posts: 145
    • View Profile
Re: Help with projectile setup
« Reply #2 on: November 24, 2014, 01:52:16 PM »
Thank you Lane!  I implemented your advice and it is working.
Best,
Chris (createasaurus)
« Last Edit: November 25, 2014, 04:33:26 AM by createasaurus »