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