Ai system for m'y game

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Squikgamer

I want to create a simple ai system for an enemy but i dont now how to do or

The enemy has to have

Idle state
Walk state
Follow player state
Run state if thé player IS far
Attack state
Hit state
Die state
Thé enemy should idle for dôme Time then walk a Litle then idle then if he
Détectes thé player in area j’ai chasse then when he gèt close to him je will attack him
With a Sword
Thanks for any answer

:bust_in_silhouette: Reply From: DaddyMonster

You need a state machine. Here’s a nice tutorial for you: