# How to make an object move to specific place?

**URL:** <https://forum.kirupa.com/t/how-to-make-an-object-move-to-specific-place/111696>\
**Category:** Uncategorized\
**Created:** [May 29, 2004, 9:11pm UTC](https://forum.kirupa.com/t/how-to-make-an-object-move-to-specific-place/111696 "2004-05-29T21:11:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![patricktheking](https://avatars.discourse-cdn.com/v4/letter/p/a3d4f5/32.png) [@patricktheking](https://forum.kirupa.com/u/patricktheking)\
**Post date:** [May 29, 2004, 9:11pm UTC](https://forum.kirupa.com/t/how-to-make-an-object-move-to-specific-place/111696/1 "2004-05-29T21:11:00Z")

</div>

K … I have a game and when my guy walks over a certain mc i want a certain object thats already on the screen to move 2 a specific point, like 56,13 or something… Ive read the turtorials for how 2 do it but nothing for that…

onClipEvent (enterFrame) {  
if(\_root.car.hitTest(\_root.finishline)){  
?  
} else {  
play();  
}  
}

i need some command to put there to make a specific MC move to a certain spot… any help…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 29, 2004, 9:39pm UTC](https://forum.kirupa.com/t/how-to-make-an-object-move-to-specific-place/111696/2 "2004-05-29T21:39:12Z")

</div>

Voetsjoeba’s code will work perfect for you:

in a frame put this:

```auto

MovieClip.prototype.easeXY = function(x, y) {
this.onEnterFrame = function() {
this._x = x-(x-this._x)/1.1;
this._y = y-(y-this._y)/1.1;
 
 
if (this._x>x-1 && this._x<X+1 this._y &&>y-1 && this._y<Y+1) p {<> this._x = x;
this._y = y;
delete this.onEnterFrame;
}
};
};

```

and then in yout hitTest use this:

```auto

onClipEvent (enterFrame) {
if(_root.car.hitTest(_root.finishline)){
_root.whateverMCYouWantToMove.easeXY(56, 13)
} else {
play();
}
} 

```

> [@patricktheking](#):
>
> K … I have a game and when my guy walks over a certain mc i want a certain object thats already on the screen to move 2 a specific point, like 56,13 or something… Ive read the turtorials for how 2 do it but nothing for that…
> 
> onClipEvent (enterFrame) {  
> if(\_root.car.hitTest(\_root.finishline)){  
> ?  
> } else {  
> play();  
> }  
> }
> 
> i need some command to put there to make a specific MC move to a certain spot… any help…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 29, 2004, 10:16pm UTC](https://forum.kirupa.com/t/how-to-make-an-object-move-to-specific-place/111696/3 "2004-05-29T22:16:08Z")

</div>

Dude theres a mistake somewhere there… somewhere… as  
there is an error…  
heres the error it gives me

Scene=Scene 1, Layer=Layer 6, Frame=6: Line 7: ‘)’ expected  
if (this.\_x\>x-1 && this.\_xy-1 && this.\_y this.\_x = x;  
Scene=Scene 1, Layer=Layer 6, Frame=6: Line 12: Unexpected ‘}’ encountered  
};

this is wat i added to the frame just to show u…

MovieClip.prototype.easeXY = function(x, y) {  
this.onEnterFrame = function() {  
this.\_x = x-(x-this.\_x)/1.1;  
this.\_y = y-(y-this.\_y)/1.1;

if (this.\_x\>x-1 && this.\_xy-1 && this.\_y this.\_x = x;  
this.\_y = y;  
delete this.onEnterFrame;  
}  
};  
};

wats wrong

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 29, 2004, 10:57pm UTC](https://forum.kirupa.com/t/how-to-make-an-object-move-to-specific-place/111696/4 "2004-05-29T22:57:39Z")

</div>

The if statement is totally messed up :

```auto

MovieClip.prototype.easeXY = function(x, y) {
    this.onEnterFrame = function() {
        this._x = x-(x-this._x)/1.1;
        this._y = y-(y-this._y)/1.1;
        if (Math.abs (this._x - x) < 1 && Math.abs (this._y - y) < 1) {
            this._x = x;
            this._y = y;
            delete this.onEnterFrame;
        }
    };
};

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 29, 2004, 11:02pm UTC](https://forum.kirupa.com/t/how-to-make-an-object-move-to-specific-place/111696/5 "2004-05-29T23:02:55Z")

</div>

wow…yeah something got lost when I copied and pasted:

```auto
 
MovieClip.prototype.easeXY = function(x, y) {
 this.onEnterFrame = function() {
  this._x = x-(x-this._x)/1.1;
  this._y = y-(y-this._y)/1.1;
  if (this._x>x-1 && this._x<x+1 && this._y>y-1 && this._y<y+1) {
   this._x = x;
   this._y = y;
   delete this.onEnterFrame;
  }
 };
};

 

```

\*\*edit…everytime I copy and paste this…it cuts part of it out…any ideas why? this code is still wrong, but I can’t paste it in to make it stay right, I paste it and then when I post it…it cuts some out…the attached txt file is right, but I can’t post it here?

Weird,  
Adam

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 29, 2004, 11:34pm UTC](https://forum.kirupa.com/t/how-to-make-an-object-move-to-specific-place/111696/6 "2004-05-29T23:34:56Z")

</div>

thanks
