Easing movement, arrow controls

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 < 375) {
	this._x += moveSpeed;
	
	
}
if(key.isDown(key.LEFT) and this._x > 25) {
	this._x -= moveSpeed;
	
}
if(key.isDown(key.UP) and this._y > 25) {
	this._y -= moveSpeed;
}
if(key.isDown(key.DOWN) and this._y < 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 < 375) {
	this._x += moveSpeed;
	_x += (endX-_x)/Movespeed;
	
}
if(key.isDown(key.LEFT) and this._x > 25) {
	this._x -= moveSpeed;
	
}
if(key.isDown(key.UP) and this._y > 25) {
	this._y -= moveSpeed;
}
if(key.isDown(key.DOWN) and this._y < 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 :slight_smile:

something like:

[AS]
this._x += moveSpeed/2;
[/AS]

should work. Just change how much you divide it by to get different effects :slight_smile:

you can use endX because it is a variable and you havn’t declared it as anything.

doesn’t seem to give the effect i’m looking for…
have you ever been to www.xgenstudios.com/

theres a game there called fishy, you swim this little fish around, and when you go to stop he kind of drifts a little, since you can’t really instantly stop in the water

i guess you need physics stuff then like acceleration formula, gravity and all that stuff. If i come up with it i’ll tell you but probalby wont’ be soon :-\

hmm, i’ll look into that