hi everyone,
firstly there are no fullstops since kirupa keep thinking i’m sending links i have a program where multiple stars appear on the screen i have an ai controlled player who tries to collects these stars i wrote:
public function getDirection(obj2:DisplayObject, obj2:DisplayObject){
return Mathatan2(obj1 y - obj2 y, obj1 x - obj2 x);
}
public function playGame(){
var star:MovieClip;
var star_array = quick starArray; //an array from another class which contains all the stars
for(var i:int = star_array length - 1;i >= 0;i--){
star = star_array*;
var dir:Number = getDirection(icon_movie, star);
if(icon_movie hitTestObject(star)){
star_array splice(i,0);
star = star_array[i + 1];
getDirection(icon_movie, starOne);
playGame(); // trying to repeat the process again
}
}
}
var xstepOne:Number = Math cos(dir)*4;
var ystepOne:Number = Math sin(dir)*4;
icon_movie x -= xstepOne;
icon_movie y -= ystepOne;
This works for the first star but then errors appear about the playGame() function Any help would be great