the hitTest down at the bottom of this code doesnt seem to work, I want to make it so that when the dot hits the player, the dot doesnt go any further… Ive tried a number of things other than this and they dont work either. any help would be greatly appreciated. thanks…
onClipEvent (load){
var xspeed, yspeed;
xspeed = math.random()*5;
yspeed = math.random()*5;
_x=0;
_y=0;
y = this._y;
x = this._x;
playerx= player._x;
playery= player._y;
}
onClipEvent (enterFrame){
this._x+= xspeed;
this._y+= yspeed;
if (this._x > 550 or this._x < 0 ){
xspeed *= -1;
}
if (this._y > 400 or this._y < 0 ){
yspeed *= -1;
}
if (this._y > 400 and this._x > 550 or this._y>400 and this._x<0){
yspeed *= -1;
xspeed *= -1;
}
// if dude is walking toward upper right
if (this._x <= +250 and this._y >= +200){
this._rotation = 45;
}
else if (this._x >= +250 and this._y <+200){
this._rotation = 225;
}
else if (this._x <= +250 and this._y <+200){
this._rotation = 135;
}
// this part doesnt seem to work…
if (this.hitTest(_root.player)){
this._x+= 0;
this._y+= 0;
}
}