Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: createasaurus 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)
-
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.
-
Thank you Lane! I implemented your advice and it is working.
Best,
Chris (createasaurus)