Frame 1
c1 = 0;
i = 0;
speed = 7.5;
walking = false;
frame = 2;
gravity = 10;
originalGravity = 10;
jumping = false;
fallSpeed = 10;
jumpHeight = 32;
jumpDuration = 0;
jumpLimit = 10;
platformTimer = 0;
var i:Number = 0;
while (i < 200) {
_root.character.onEnterFrame = function () {
var _local1 = _root;
if (_local1.character._y >= 700) {
_local1.character._x = _local1.originX;
_local1.character._y = _local1.originY;
_local1._x = 0;
}
if (!_local1.character.hitTest(["_root.ground" + i])) {
if (_local1.jumping == false) {
_local1.jumping = true;
_local1.jumpDuration = _local1.jumpLimit;
}
}
};
i++;
}
Instance of Symbol 32 MovieClip "sky" in Frame 1
onClipEvent (load) {
this._xscale = 5550;
this._x = -550;
this._height = 400;
}
Instance of Symbol 34 MovieClip "platform2" in Frame 1
onClipEvent (enterFrame) {
if (hitTest(_root.character)) {
if ((this._y + _root.fallSpeed) >= _root.character._y) {
if (_root.jumpDuration == _root.jumpLimit) {
_root.character._y = this._y - this.height;
_root.jumpDuration = 0;
_root.fallSpeed = _root.originalGravity;
_root.jumping = false;
_root.platformTimer++;
}
}
}
}
Instance of Symbol 34 MovieClip "platform1" in Frame 1
onClipEvent (enterFrame) {
if (hitTest(_root.character)) {
if ((this._y + _root.fallSpeed) >= _root.character._y) {
if (_root.jumpDuration == _root.jumpLimit) {
_root.character._y = this._y - this.height;
_root.jumpDuration = 0;
_root.fallSpeed = _root.originalGravity;
_root.jumping = false;
_root.platformTimer++;
}
}
}
}
Instance of Symbol 34 MovieClip "cloud_platform" in Frame 1
onClipEvent (enterFrame) {
if (hitTest(_root.character)) {
if ((this._y + _root.fallSpeed) >= _root.character._y) {
_root.character._y = this._y - this.height;
if (_root.walking == false) {
_root.character._x = _root.character._x + 3;
_root._x = _root._x - 3;
}
_root.jumpDuration = 0;
_root.fallSpeed = _root.gravity;
_root.jumping = false;
_root.platformTimer++;
}
}
this._x = this._x + 3;
if (this._x >= 5000) {
this._x = -300;
}
}
Instance of Symbol 36 MovieClip in Frame 1
onClipEvent (enterFrame) {
if (hitTest(_root.character)) {
if (Key.isDown(37)) {
_root.character._x = _root.character._x + _root.speed;
_root._x = _root._x - _root.speed;
}
if (Key.isDown(39)) {
_root.character._x = _root.character._x - _root.speed;
_root._x = _root._x + _root.speed;
}
}
}
Instance of Symbol 34 MovieClip "platform3" in Frame 1
onClipEvent (enterFrame) {
if (hitTest(_root.character)) {
if ((this._y + _root.fallSpeed) >= _root.character._y) {
if (_root.jumpDuration == _root.jumpLimit) {
_root.character._y = this._y - this.height;
_root.jumpDuration = 0;
_root.fallSpeed = _root.originalGravity;
_root.jumping = false;
_root.platformTimer++;
}
}
}
}
Instance of Symbol 34 MovieClip "platform4" in Frame 1
onClipEvent (enterFrame) {
if (hitTest(_root.character)) {
if ((this._y + _root.fallSpeed) >= _root.character._y) {
if (_root.jumpDuration == _root.jumpLimit) {
_root.character._y = this._y - this.height;
_root.jumpDuration = 0;
_root.fallSpeed = _root.originalGravity;
_root.jumping = false;
_root.platformTimer++;
}
}
}
}
Instance of Symbol 30 MovieClip [cloud] "cloud3" in Frame 1
onClipEvent (load) {
this._x = (Math.random() * 5000) - 1000;
this._y = ((-Math.random()) * 100) + 50;
this._alpha = (Math.random() * 50) + 40;
this._xscale = (Math.random() * 50) + 50;
this._yscale = this._xscale;
_root.c1 = _root.c1 + 1;
if (_root.c1 <= 30) {
duplicateMovieClip (_root.cloud3, "cloud" + _root.c1, _root.c1);
}
}
onClipEvent (enterFrame) {
this._x = this._x + 0.5;
if (this._x >= 5000) {
this._x = -300;
}
}
Instance of Symbol 28 MovieClip [character2] "character" in Frame 1
onClipEvent (load) {
_root.originX = this._x;
_root.originY = this._y;
}
onClipEvent (enterFrame) {
function gravity() {
this._y = this._y + _root.fallSpeed;
}
if (_root.walking == true) {
_root.frame = _root.frame + 1;
_root.character.gotoAndStop(_root.frame);
_root.walking = false;
} else {
_root.character.gotoAndStop("idle");
}
if (Key.isDown(39)) {
this._xscale = Math.abs(this._xscale);
this._x = this._x + _root.speed;
_root.walking = true;
_root._x = _root._x - _root.speed;
}
if (Key.isDown(37)) {
this._xscale = -Math.abs(this._xscale);
this._x = this._x - _root.speed;
_root.walking = true;
_root._x = _root._x + _root.speed;
}
if (Key.isDown(40)) {
if (_root.jumping == false) {
if (_root.walking == false) {
this.gotoAndStop("duck");
}
}
}
if (Key.isDown(38)) {
if (_root.jumping == false) {
if (_root.jumpDuration >= _root.jumpLimit) {
} else if (_root.platformTimer >= 5) {
_root.platformTimer = 0;
_root.jumpDuration++;
_root.jumping = true;
}
}
}
if (_root.jumping == true) {
if (_root.jumpDuration >= _root.jumpLimit) {
_root.fallSpeed = _root.fallSpeed * 1.2;
} else {
_root.jumpDuration++;
this._y = this._y - ((_root.jumpHeight / _root.jumpDuration) * 4);
}
this.gotoAndStop("jump");
}
gravity();
}
Symbol 8 MovieClip [character] Frame 1
stop();
Symbol 8 MovieClip [character] Frame 21
_root.frame = 2;
Symbol 8 MovieClip [character] Frame 22
stop();
Symbol 28 MovieClip [character2] Frame 1
stop();
Symbol 28 MovieClip [character2] Frame 21
_root.frame = 2;
Symbol 28 MovieClip [character2] Frame 22
stop();