- Home /
How can i check if my Player was in the attack animation of my Enemy(2D)
Hey, i got a 2D Player and Enemy. If the Enemy is in a close Distance to the Player he attacks. But its possible to dodge the attack (with jumping or running away). Now i need to find the exact moment of the enemy attack animation, when the Axe goes down in my code, so i can check if the player is still close then. Or even better would be if i can put some kind of dmg box to the Enemy, which always spawns during the attack animation, so i can check if the player is inside the "DMG zone" or not. If anyone has ideas how i can do that i would be very happy. Or tell me if u need to see some parts of the game.
Answer by s_awali · Sep 02, 2019 at 08:56 AM
You can add function callback to any keyframe of an animation. This way you'll be able to track when the Axe is going down. Here is the doc: https://docs.unity3d.com/540/Documentation/Manual/animeditor-AnimationEvents.html
Your answer
Follow this Question
Related Questions
zombie attack script 1 Answer
Animation not at correct position W/Video 0 Answers
How To Mirror Animation 1 Answer
Play and Stop Animation 1 Answer
Script Platform to cause death 0 Answers