Frame 1
yspeed = 0;
xspeed = 0;
gravity = 0.2;
rotationspeed = 0;
power = 1;
friction = 0.9;
fly.onEnterFrame = function () {
yspeed = yspeed + gravity;
xspeed = xspeed * friction;
this._x = this._x + xspeed;
rotationspeed = rotationspeed * friction;
this._rotation = 0 + rotationspeed;
if (this._y <= (400 - (this._height / 2))) {
this._y = this._y + yspeed;
if (Key.isDown(37)) {
xspeed = xspeed - power;
rotationspeed = rotationspeed + ((power * xspeed) / 2);
} else if (Key.isDown(39)) {
xspeed = xspeed + power;
rotationspeed = rotationspeed + ((power * xspeed) / 2);
}
} else {
xspeed = xspeed * friction;
yspeed = 0;
this._y = 400 - (this._height / 2);
}
if (Key.isDown(38)) {
yspeed = yspeed - power;
}
if (yspeed < 0) {
yspeed = yspeed * friction;
}
};