# Movement without slowing down

**URL:** https://forum.kirupa.com/t/movement-without-slowing-down/196213
**Category:** Uncategorized
**Created:** [August 6, 2006, 9:56pm UTC](https://forum.kirupa.com/t/movement-without-slowing-down/196213 "2006-08-06T21:56:58Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![habes](https://avatars.discourse-cdn.com/v4/letter/h/e5b9ba/32.png) [@habes](https://forum.kirupa.com/u/habes)
#### Post date: [August 6, 2006, 9:56pm UTC](https://forum.kirupa.com/t/movement-without-slowing-down/196213/1 "2006-08-06T21:56:58Z")

</div>

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):

```auto
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;
    }
}

```
