defender game... lots of enemies.... and innaccurate when trying to attack main character.
//code in creating mobs
var enemy:Enemy=new Enemy();
enemy.rotation=Math.random()*360;
eXspd.push(Math.cos((enemy.rotation-90)*Math.PI/180));
eYspd.push(Math.sin((enemy.rotation-90)*Math.PI/180));//calculate the xspd and yspd
enemy.x=500+eXspd[eXspd.length-1]*600;
enemy.y=300+eYspd[eYspd.length-1]*600;// set the mobs offscreen with respect to the mid of the stage where the main character is
eArray.push(addChild(enemy));
the problem was that when the mob tries to come and attack the main character its inaccurate and smtimes never even comes into contact with the main character.
//code to move
for(var i:uint=0;i<eArray.length;i++){
if(eArray[i]!=null){
eArray[i].x-=eXspd[i]
eArray[i].y-=eYspd[i]
}
}
erm can someone help out =(