Frame 1
function jumpFunc(input) {
if (Key.isDown(37)) {
input._xscale = -100;
_root.stance = -1;
_root.ground._x = _root.ground._x + speed;
} else if (Key.isDown(39)) {
input._xscale = 100;
_root.stance = 1;
_root.ground._x = _root.ground._x - speed;
} else if (!Key.isDown()) {
input.gotoAndStop("jump");
_root.crouch = false;
}
input._y = input._y - _root.uvel;
_root.uvel = _root.uvel - _root.gravity;
if (input.hitTest(_root.ground)) {
input._y = ((_root.ground._y - (_root.ground._height / 2)) - (input._height / 2)) + 10;
_root.uvel = 40;
_root.jump = false;
}
}
var stance = 1;
var speed = 15;
var attack = false;
var crouch = false;
var sliding = false;
var jump = false;
var slideAllowed = true;
var uvel = 40;
var fallvel = 0;
var gravity = 6;
var counter = 0;
var slideCounter = 0;
_root.enemy.onEnterFrame = function () {
if (this.hitTest(_root.sageman)) {
this._x = 9001;
_root.output_txt.text = "KICKED HIM TO HIS MOMMA (just put in a enemy for fun.. i'll change the interaction later)";
}
};
_root.sageman.onEnterFrame = function () {
if ((!_root.jump) and (!_root.ground.hitTest(this._x, this._y + (this._height / 2), true))) {
_root.fallvel = _root.fallvel + _root.gravity;
this._y = this._y + _root.fallvel;
if (_root.ground.hitTest(this._x, this._y + (this._height / 2), true)) {
this._y = ((_root.ground._y - (_root.ground._height / 2)) - (this._height / 2)) + 10;
}
}
if (_root.sliding) {
counter++;
_root.ground._x = _root.ground._x - ((speed * 3) * stance);
if (counter >= 10) {
counter = 0;
_root.sliding = false;
_root.slideAllowed = false;
trace("SLIDING STOPPED");
}
} else if (_root.jump) {
jumpFunc(this);
} else {
if (Key.isDown(37)) {
this._xscale = -100;
_root.stance = -1;
this.gotoAndStop("run");
_root.ground._x = _root.ground._x + speed;
} else if (Key.isDown(39)) {
this._xscale = 100;
_root.stance = 1;
this.gotoAndStop("run");
_root.ground._x = _root.ground._x - speed;
} else if (!Key.isDown()) {
this.gotoAndStop("idle");
_root.crouch = false;
}
if (Key.isDown(17) and slideAllowed) {
_root.ground._x = _root.ground._x - ((speed * 2) * stance);
_root.enemy._x = _root.enemy._x - ((speed * 10) * stance);
sliding = true;
if (stance == 1) {
this.gotoAndStop("slide");
} else {
this.gotoAndStop("slideleft");
}
}
if (Key.isDown(18)) {
_root.attack = true;
}
if (Key.isDown(16)) {
_root.jump = true;
this.gotoAndStop("jump");
}
}
if (!slideAllowed) {
slideCounter++;
if (slideCounter >= 30) {
slideAllowed = true;
slideCounter = 0;
}
}
};
Symbol 30 MovieClip Frame 8
stop();
Symbol 33 MovieClip Frame 8
stop();
Symbol 35 MovieClip Frame 1
stop();