State Machine support

does anyone know a link where you can learn the state machine ???
I have seen various links but they are all from the player side and for platform … I would like if it is possible for a top down and not with the player but with the enemies …

automatic movements, death attacks and so on …

as the game becomes more complex you find yourself faced with situations where while everything works perfectly then everything no longer works … I think that learning the AI especially with the spawn function is very important … if you create enemies and put them already on the map they have behaviors … but if you want to make them nicer … that spawn with the energy bar already changes everything … let alone if we assign other things to them … as line of sight 2 different attacks …

I would really like some help

thank you in advance