To allow our enemy to perform different attacks depending on the distance from the player, we require a Distance Check.
The code below finds the distance to the player then compares the distance check to feed into performing different attacks.
These attacks are set up in a similar way to our player character in that they play animations which have animation montages that activate and deactivate collisions on the enemy limbs.
And the Collision Controls
This is quite versatile in that the enemy can be controlled in any way depending on the distance from the player. It doesn't have to be an enemy it could be a helpful NPC who when close to the player will heal them, and when father away will throw helpful items to the player.
No comments:
Post a Comment