playMaker

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

createasaurus

  • Full Member
  • ***
  • Posts: 146
Help with projectile setup [solved]
« on: November 24, 2014, 02: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, 03:52:33 PM by createasaurus »

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Help with projectile setup
« Reply #1 on: November 24, 2014, 03: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.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

createasaurus

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