Jump script

I’m trying to make a jump script for a side scoller.
i have my own jump script i use but its really complicated.
Anyone have an easy jump script they use?
It’d be much appreciated.
Thanks

Thanks for the script man it has been usefull.

I’ve been playing around with that jump script and it works wonderfully. My question is I added a platform and called it “platform” (creative eh?) and I added the hitTest code so the object will stop falling when it lands on the platform, but since the code tells the gravity to stop, when I walk off the platform the object doesn’t fall, it just walks left to right and doesn’t fall back to the ground (cause gravity is set to 0). How do I check if its on the platform or ground all the time so the object will fall when it moves off the platform?

Thanks

You would use a code like this, this also does movement code

onClipEvent (load) {
	moveamount = 10;
	gravity = 1.3;
	jumpHeight = 20;
}
onClipEvent (enterFrame) {
	old_x_object = this._x;
	old_y_object = this._y;
	if (Key.isDown(Key.up)) {
		if (jump) {
			yspeed = yspeed-jumpHeight;
			jump = false;
		}
	}
	yspeed = yspeed+gravity;
	y = this._y+yspeed;
	if (_root.back.hittest(this._x+31, y+30, true)) {
		if (yspeed<0) {
		} else {
			jump = true;
		}
		yspeed = 0;
	} else {
		this._y = y;
	}
	this._x = this._x+Key.isDown(Key.RIGHT)*moveamount-Key.isDown(Key.LEFT)*moveamount;
	gotoAndStop(2);
	if (_root.platform.hitTest(this._x+30, this._y+30, true) or _root.back.hitTest(this._x-30, this._y-30, true)) {
		this._x = old_x_object;
		this._y = old_y_object;
	}
}