More adventures in AI.

I've created a simple melee enemy that wants to get in your face and then promptly smack it with whatever he may be holding. The first thing that happens is the enemy must notice the player and become "active". Until this happen he stands idly by, waiting for external input before doing anything. In this case, runnin' and smackin'.

Enemies that are not currently active, such as the guy above, will not become active unless certain conditions are met.
Exist within the viewable area.
Be facing the player.
Be on the same x axis as the player (have line of sight to him)
OR
Exist within the viewable area.
Be near another enemy that is alerted to the player. (even if hes not facing the player)
Be within a certain distance of the player doing things like shooting, or blowing shit up.
Using these conditions you get a couple of cool things. The most important of which is that enemies are not being aggro'd from off screen without the player knowing it is happening. Another cool thing is this prevents enemies from standing around like morons while you blow the shit out of their buddies.
This is the first "AI" that I have ever tried to program and it is a little sloppy. It was much harder than I thought it would be... especially jumping and tracking the player. Basically what happens is once the enemy is "active" he then always knows where the player is. You can't lose him. However he is always checking the area between himself and the player. That is the black line you see. When something comes between the two, such as a block, the line of sight is broken and he has to figure out how to get around that object. He looks in front of him to see what the fuck is in his way, then above it to see if its empty and he can jump into it. THEN HE DOES.
The code is a mess and needs to be a little more modular but really I should be able to use this as a baseline for all enemy behaviors.