onClipEvent (load) {
falling = false;
hitting = false;
gravity = 7;
speed = 6;
jump = 0;
jumping = false;
}
onClipEvent (enterFrame) {
if(!_root.ground.hitTest(this._x, this._y, true) && !jumping) {
_y += gravity;
gravity = 7;
falling = true;
}
if(Key.isDown(Key.SPACE) && jumping == false) {
jumping = true;
luigi.play();
}
if(jumping){
this.gotoAndStop("jump");
this._y -= jump;
jump -= .5;
if (jump<0) {
falling = true;
}
if (jump<-15) {
jump = -15;
}
}
if(_root.ground.hitTest(this._x, this._y, true) && falling) {
jump = 12;
jumping = false;
falling = false;
}
if(Key.isDown(Key.LEFT)) {
gotoAndPlay(2);
_x -= speed;
}
if(Key.isDown(Key.RIGHT)) {
gotoAndPlay(1);
_x += speed;
}
}