distance wont work...........is this script wright????
what i whant is when any of the units get to a certain distance of the enemy it should trace(shoot).
can anyone help me...............
................................................................................
var unitA:Array=[unit,unit1,unit2];
var c;
var s;
var deltaX;
var deltaY;
var dist;
var range;
_root.onEnterFrame = function() {
var unit = unitA;
c = _root.unit;
s = _root.enemy;
deltaX = c._x-s._x; deltaY = c._y-s._y;
// rounded distance
dist = Math.sqrt((deltaX*deltaX)+(deltaY*deltaY));
}
function rangetoshoot(){
if(unit.dist >= 100);
trace(shoot);
}
.........................................................................................................