The player is controlled by a state machine, when the state changes it handles different logic based on the state, going from not moving to moving puts you from idle into run and plays a different animation.
The enemies and the shadow also have state machines. They have a idle, wander, chase, attack etc. there movement and attack is handled through their state machines.
Implementation of it could be a lot better. But I will save that for next project.
And thank you for playing and commenting :)