Key Ideas
1Patrol. Walk between two points, reversing direction on arrival — the simplest "alive" enemy behavior.
2Chasing. Move toward player.pos each frame when distance < detection radius, using a normalized direction vector.
3Finite State Machine. The enemy is always in exactly one state (patrol/chase/attack); transitions follow clear distance/health rules.
4Pathfinding Concepts. Full A* searches a grid for shortest routes; simpler waypoint graphs solve most 2D needs cheaply.
5Boss Phases. Health thresholds (e.g. below 50%) trigger a more aggressive phase with faster attack timers.