How do I make a 2D enemy deal damage to my characters health (character max health of 3) when they collide Meshes
How do I make a 2D enemy deal damage to my characters health (character max health of 3) when they collide Meshes, it's a 2D platform for an endless runner character has a health bar with a maximum of three health and the enemy needs to do 1.0 damage.
asked Jan 18 '16 at 02:34 PM in Blueprint Scripting
You should be able to just use the "OnComponentHit" event for the Root Component in your Character blueprint. To add this, you'll need to select the Root Component and then right-click in the Event Graph. Type "hit" and "Add On Component Hit" should appear. This event will be called any time the root component collides with something blocking. The Other Actor pin will refer to the other actor.
To ensure that the other actor is an enemy, you can use the Other Actor pin to create a "Cast To" node for your enemy's blueprint class. From that, you can trigger the animation on your character, deduct the 1 health, and destroy the other actor.
Hope this helps!
answered Jan 21 '16 at 01:45 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here