# Flee After Attack Animation

**URL:** <https://forums.unrealengine.com/t/flee-after-attack-animation/555526>\
**Category:** Character & Animation\
**Tags:** unreal-engine\
**Created:** [May 12, 2022, 1:37pm UTC](https://forums.unrealengine.com/t/flee-after-attack-animation/555526 "2022-05-12T13:37:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![trantec](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@trantec](https://forums.unrealengine.com/u/trantec)\
**Post date:** [May 12, 2022, 1:37pm UTC](https://forums.unrealengine.com/t/flee-after-attack-animation/555526/1 "2022-05-12T13:37:15Z")

</div>

I am implementing an animal that can attacked the player. After it attacked it has to jump away from the target to get out of harm’s way.

I am using a Behavior Tree and have a hard time implementing it in a BTTask. In detail the following has to happen:

1. Play attack animation while moving closer to the player (animation: jump attack)
2. Wait for the attack animation to finish and the movement to player is done
3. Play flee animation while moving away from player again (animation: jump backwards)

The Moving to player and moving away works fine. But I cannot get the right animation played when it moves to the player (jump attack) and when it moves away (jump backwards).

One idea I tried is to have two new states for it in the animation graph, but how can I make sure that the animation state switches when the attack animation is finished AND the motion towards the player in the behavior tree is done?

In theory I could implement an BTDecorator that checks variables where I somehow aggregate this two states. Is there an easy way to accomplish this?
