All pastes #514657 Raw Edit

Not Working!

public text v1 · immutable
#514657 ·published 2007-05-27 21:03 UTC
rendered paste body
// All the same...

this.onEnterFrame = function() {
	this._y = Math.floor(this._y);
	this._x = Math.floor(this._x);

	UpdateStats();
	UpdatePosition();
	UpdateStance();
	stance = "Standing";
}

// same...

function UpdatePosition() {
	if (Key.isDown(Key.LEFT)) {
		stance = "Running";
		var check = CheckLeftWall(this._x, this._x-speed);
		
		if (check.bool) {
			this._x = Math.floor(check.wallX);
		} else {
			this._x -= speed;
		}
	}
	
	if (Key.isDown(Key.RIGHT)) {
		stance = "Running";
		var width = Math.floor(this._width);
		var check = CheckRightWall(this._x+width, this._x+width+speed);
		
		if (check.bool) {
			this._x = Math.floor(check.wallX) - width;
		} else {
			this._x += speed;
		}
	}
	
	if (Key.isDown(Key.SPACE) && !jumping) {
		StartJump();
	}
	
	// same...
}

function UpdateStance() {
	this.gotoAndStop(this.stance);
	if (this.stance == "Running") {
		UpdatePosition();
	}
}

// all the same...