Lots and lots of conditionals, random numbers when there's more than one option. I think enemy AI is simple to understand, just hard to do well.
Stuff like
Code:
if(playhorizontaldistance < grabrange){
attempttothrowplayer();
}else{
if(getrandomnumber()%2){
isplayeronright(){
moveenemyright();
}else{
moveenemyleft();
}
}else{
shootplayer();
}
}
This would try to throw a player if the player is close enough to be thrown. If the player is not close enough to be throw, it would randomly either shoot at the player, or move the enemy toward the player. If you want smarter AI, you need more conditionals.
For instance, I might have a state for shooting, because it'd be weird if the player moves toward the player half the time, and shoot them half the time.
Like... move a pixel, shoot one bullet, move a pixel shoot one bullet. So I'd have it choose to enter a shooting stance for a few frames so it doesn't look as choppy.
It's just a lot of conditionals until it appears smart.