Before I begin I want you guys to know that im new to this flash game action script thingo
Ok so ive been following the tutorial on how to make a flash Platform game, by Nathan Stockton.
I followed the script correctly, however now I have a problem. When i go to preview the game the Character jumps up to the height the character can jump then falls and he falls right through the ground, yet he jumps without me even pressing anything.
Ive been trying to find the answer for the last few hours so i thought id just try my luck here
thanks
Here is the script I have:
onClipEvent (load) {
jumping = true;
jump = 10;
speed = 0;
maxmove = 15;
}
onClipEvent (enterFrame) {
if (_root.dead) {
this.gotoAndStop(“dead”);
} else {
speed *= .85;
if (speed>0) {
dir = “right”;
} else if (speed<0) {
dir = “left”;
}
if (dir == “right”){
this._x += speed;
_root._x -= speed;
}
if (dir == “left”) {
this._x += speed;
_root._x -= speed;
}
if (Key.isDown(Key.LEFT)) {
if (speed>-maxmove) {
speed–;
}
this.gotoAndStop(“run”);
this._xscale = -100;
} else if (Key.isDown(Key.RIGHT)) {
if (speed<maxmove) {
speed++;
}
this._xscale = 100;
this.gotoAndStop(“run”);
}
if (speed<1 && speed>-1 && !attacking) {
speed = 0;
this.gotoAndStop(“idle”);
}
if (speed<1 && speed>-1 && !attacking) {
speed = 0;
this.gotoAndStop(“idle”);
}
if (Key.isDown(Key.UP) && !jumping) {
jumping = true;
}
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) {
_x =300
jump = 10;
jumping = true;
falling = true;
}
}