http://www.cursocdo.com.ar/Flash/nave.swf
Código :
onClipEvent (load) {
thrust = 1;
decay = .97;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
xSpeed += thrust;
_rotation += 10
if (this._rotation > 45) {
_rotation = 45
}
} else {
xSpeed *= decay;
_rotation*= decay
}
if (Key.isDown(Key.LEFT)) {
xSpeed -= thrust;
_rotation -= 10
if (this._rotation < 315) {
_rotation = 315
}
} else {
xSpeed *= decay;
_rotation*= decay
}
if (Key.isDown(Key.UP)) {
ySpeed += thrust;
} else {
ySpeed *= decay;
}
if (Key.isDown(Key.DOWN)) {
ySpeed -= thrust;
} else {
ySpeed *= decay;
}
_y -= ySpeed;
_x += xSpeed;
}
