Well, you've left the question awfully general. What kind of AI do you need? What's the game like? How complex do behaviors have to be?
Generally speaking, moving towards a player is accomplished by a simple "if playerx > enemyx then enemyx + 1 -> enemyx", with matching conditions for the opposite direction and for the Y vars. Naturally, before actually updating the position, you'd have to check whether it's possible for the enemy to go there, but without info on your code I can't really go into that.
Attacks can be triggered via the distance formula, SQRT( (playerx - enemyx) ^2 + (playery - enemyy) ^ 2 ): compare that to a fixed number and have an attack routine fire at that point.
Sorry if this was waaaay more basic than you were looking for. Good luck!