rendered paste bodyonClipEvent (load) {
movespeed = 5;
velocity = 0;
airborne = true;
}
onClipEvent (enterFrame) {
if(Key.isDown(KEY.RIGHT)) {
this._x += movespeed;
this.nextFrame();
}
if(Key.isDown(KEY.LEFT)) {
this._x -= movespeed;
this.prevFrame();
}
if (_root.ground.hitTest(this)) {
airborne = false;
}
if (!_root.ground.hitTest(this)) {
airborne = true;
}
if (airborne == true) {
this._y -= velocity;
velocity -= 2;
}
if (airborne == false) {
velocity = 0;
}
}
on(keyPress "<Space>") {
velocity = 40;
airborne == true;
}