# Easing movement, arrow controls

**URL:** <https://forum.kirupa.com/t/easing-movement-arrow-controls/94225>\
**Category:** Uncategorized\
**Created:** [November 10, 2003, 1:56pm UTC](https://forum.kirupa.com/t/easing-movement-arrow-controls/94225 "2003-11-10T13:56:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![macneilslt](https://avatars.discourse-cdn.com/v4/letter/m/aeb1de/32.png) [@macneilslt](https://forum.kirupa.com/u/macneilslt)\
**Post date:** [November 10, 2003, 1:56pm UTC](https://forum.kirupa.com/t/easing-movement-arrow-controls/94225/1 "2003-11-10T13:56:22Z")

</div>

i have a ball i want to move around so i used the following AS to move it:

[AS]

onClipEvent(load) {  
setProperty(this, \_x, 375);  
setProperty(this, \_y, 375);  
moveSpeed = 10;

}

onClipEvent(enterFrame) {

```
if(Key.isDown(key.RIGHT) and this._x &lt; 375) {
	this._x += moveSpeed;
	
	
}
if(key.isDown(key.LEFT) and this._x &gt; 25) {
	this._x -= moveSpeed;
	
}
if(key.isDown(key.UP) and this._y &gt; 25) {
	this._y -= moveSpeed;
}
if(key.isDown(key.DOWN) and this._y &lt; 375) {
	this._y += moveSpeed;
}

```

}

[/AS]

i wanted to add an easing motion, as if it was in water, or something like that so i read a tutorial on easing on this sight and tried…

[AS]

onClipEvent(load) {  
setProperty(this, \_x, 375);  
setProperty(this, \_y, 375);  
moveSpeed = 10;

}

onClipEvent(enterFrame) {

```
if(Key.isDown(key.RIGHT) and this._x &lt; 375) {
	this._x += moveSpeed;
	_x += (endX-_x)/Movespeed;
	
}
if(key.isDown(key.LEFT) and this._x &gt; 25) {
	this._x -= moveSpeed;
	
}
if(key.isDown(key.UP) and this._y &gt; 25) {
	this._y -= moveSpeed;
}
if(key.isDown(key.DOWN) and this._y &lt; 375) {
	this._y += moveSpeed;
}

```

}

[/AS]  
as you can see i only tried it on the right movement, although i wanted it on all movements, but it didn’t really work…  
any help/ pointers in the right direction would be appriciated,  
thanks 🙂
