Hello, everyone

I know that AI is one of the bases of any acceptable game, and because I am just a beginner, I want to know a simple, basic way to make AI as the following:

When the player entity becomes at a certain distance from the enemy entity, the enemy moves towards the player entity and faces him playing a certain animation scene, then when he becomes so close, a punching animation scene is played

Thanks for reading