Hello there,

Im creating a fighting game (like street fighter) the problem Im having now is that I need to figure out how to create an AI for the enemy - right now all i have is this :

newx = _root.philo._x;
distx = int(getProperty(this, _x)-newx);
z = (distx*distx)+(disty*disty);
hyp = Math.sqrt(z);
speed = 50;
distance = int(hyp/speed);
movex = distx/distance;
movey = disty/distance;
if (distance<=0) {
gotoAndPlay("go");
} else {
setProperty(this, _x, getProperty(this, _x)-movex);
setProperty(this, _y, getProperty(this, _y)-movey);
distance = distance-1;
}


What this does is make the enemy walk towards "philo" -

then during the frames I have him punching. So basically what I need to know is any ideas you might have to make him harder to kill.

Right now if you go to him and keep pressing one of the hit keys - he dies right away with out fighting back - this is a real ABSTRACT question - I just want to see what people have to say.

Thanks,
Alex