EDIT: figured out this problem, please see next post
hi everyone. ive been working on my game that i posted here a few days ago. i got the problems i posted fixed but now im having problems with the movement. if you add a marine by clicking the red button, click on it and then click somewhere on the screen it will move to that point. the problem is that since the distance is being divided by the speed, as the distance gets smaller the speed gets slower.
heres the code (its embeded in another mc):
onClipEvent (load) {
_parent._x = 70;
_parent._y = 135;
speed = 500;
select = false;
}
on (release) {
_root.selectedUnits = true;
select = true;
}
onClipEvent (mouseDown) {
if ((select == true) and (_root.selectedUnits == true) and (Key.isDown(Key.CONTROL))) {
endX = _root._xmouse;
endY = _root._ymouse;
}
}
onClipEvent (enterFrame) {
_parent._x += (endX-_parent._x)/speed;
_parent._y += (endY-_parent._y)/speed;
if (select == true) {
this.selectRing._visible = true;
}
if (select == !true) {
this.selectRing._visible = false;
}
if (_root.selectedUnits == false) {
select = false;
}
}