Frame 1
_root.createTextField("texta", 1000, 100, 100, 100, 100);
_root.texta.text = "Loading preloader.";
var my_fmt = new TextFormat();
my_fmt.color = 0;
my_fmt.underline = true;
_root.texta.setTextFormat(my_fmt);
_root.onEnterFrame = function () {
var _local1 = _root;
if (pl.getBytesLoaded() == pl.getBytesTotal()) {
removeMovieClip(_local1.texta);
delete this.onEnterFrame;
}
if ((_local1.getBytesLoaded() / _local1.getBytesTotal()) == 1) {
_local1.play();
}
};
Instance of Symbol 244 MovieClip "pl" in Frame 1
onClipEvent (load) {
_root.stop();
}
Frame 2
function player1(mc) {
var _local1 = this;
_local1.mc = mc;
_local1.score = 0;
_local1.state = "normal";
_local1.actor = "player";
_local1.xVel = 0;
_local1.xMax = 8;
_local1.xWalkMax = 2.6;
_local1.xAirMax = 5;
_local1.xGrabMax = 1;
_local1.xCrouchMax = 2;
_local1.xShadowMax = 1.3;
_local1.xStuckMax = 0.5;
_local1.yVel = 0;
_local1.yMax = 20;
_local1.xAcc = 0.4;
_local1.xAirAcc = 0.5;
_local1.dashVel = 7;
_local1.xSpec = 0;
_local1.ySpec = 0;
_local1.jumping = false;
_local1.head = 40;
_local1.crouched = false;
_local1.crouchMoved = false;
_local1.crouchTime = 0;
_local1.upTime = 0;
_local1.fallTime = 0;
_local1.grabCount = 0;
_local1.holdName = null;
_local1.windup = 0;
_local1.animHoldIdle = 0;
_local1.animHoldWalk = 0;
_local1.animHoldAir = 0;
_local1.animHoldCrouch = 0;
_local1.animHoldWallSlide = 0;
_local1.trans = null;
_local1.attackHold = 0;
_local1.bp = 0;
_local1.hitHold = 0;
_local1.finalHit = false;
_local1.xForce = 0;
_local1.yForce = 0;
_local1.bounced = false;
_local1.dashCount = 0;
_local1.dashHold = 0;
_local1.plane = "ground";
_local1.downCount = 0;
_local1.deflecting = 0;
_local1.headbouncing = 0;
_local1.whacking = 0;
_local1.keyLeft = 37;
_local1.keyRight = 39;
_local1.keyUp1 = 38;
_local1.keyDown1 = 40;
_local1.keyPause = 13;
_local1.keyJump = 83;
_local1.keyAttack = 68;
_local1.keyGrab = 65;
_local1.keyHide = 32;
_local1.keyFast = 16;
_local1.jumpPressed = false;
_local1.doubleJumped = false;
_local1.grabPressed = false;
_local1.dJumpOK = false;
_local1.pausePressed = false;
_local1.attackPressed = false;
_local1.hidePressed = false;
_local1.rightPressed = false;
_local1.leftPressed = false;
_local1.fastPressed = false;
_local1.aura1 = null;
_local1.aura2 = null;
}
function torch(mc, depth) {
var _local1 = this;
var _local2 = mc;
_local1.mc = _local2;
_local1.depth = depth;
_local1.state = "normal";
_local1.actor = "torch";
_local1.xScale0 = _local2._xscale;
_local1.yScale0 = _local2._yscale;
_local1.xVel = 0;
_local1.xMax = 3;
_local1.yVel = 0;
_local1.yMax = 28;
_local1.xAcc = 1;
_local1.xSpec = 0;
_local1.ySpec = 0;
_local1.jumping = false;
_local1.head = 28;
_local1.fallTime = 0;
_local1.grabbedName = null;
_local1.hp = null;
_local1.aura = null;
_local1.energy = 10;
if (_local2._rotation == 180) {
_local2._rotation = 0;
_local2._xscale = -_local2._xscale;
}
_local1.mc.swapDepths(depth);
}
function staff(mc, depth, element) {
var _local1 = this;
_local1.mc = mc;
_local1.selfName = "";
_local1.depth = depth;
_local1.state = "grabbed";
_local1.actor = "staff";
_local1.lastState = "normal";
_local1.xScale0 = p1.mc.mcMC.mcHand._xscale;
_local1.yScale0 = p1.mc.mcMC.mcHand._yscale;
_local1.mc._xscale = _local1.xScale0;
_local1.mc._yscale = _local1.yScale0;
_local1.xVel = 0;
_local1.xMax = 3;
_local1.yVel = 0;
_local1.yMax = 28;
_local1.xAcc = 1;
_local1.xSpec = 0;
_local1.ySpec = 0;
_local1.jumping = false;
_local1.head = 28;
_local1.fallTime = 0;
_local1.grabbedName = null;
_local1.element = element;
}
function enemy1(mc) {
var _local1 = this;
var _local2 = mc;
_local1.mc = _local2;
_local1.state = "normal";
_local1.depth0 = _local2.getDepth();
_local1.actor = "hoodley";
_local1.xVel = 0;
_local1.xMax = 1;
_local1.yVel = 0;
_local1.yMax = 26;
_local1.xHuntMax = 4;
_local1.xFireMax = 6;
_local1.xAcc = 0.8;
_local1.xAirAcc = 0.4;
_local1.xSpec = 0;
_local1.ySpec = 0;
_local1.jumping = false;
_local1.head = 50;
_local1.stopCount = 0;
_local1.grabbedName = null;
_local1.holdName = null;
_local1.grabCount = 0;
_local1.hitCount = 0;
_local1.phase = 1;
_local1.phaseCount = 0;
_local1.alertTime = 0;
_local1.animHoldIdle = 0;
_local1.animHoldWalk = 0;
_local1.attackHold = 0;
_local1.bp = 0;
_local1.hitHold = 0;
_local1.finalHit = false;
_local1.xForce = 0;
_local1.yForce = 0;
_local1.hp = 100;
_local1.energy = 10;
_local1.jumpPressed = false;
_local1.dJumpOK = false;
_local1.pausePressed = false;
if (_local1.mc._xscale > 0) {
_local1.xDest = _local2._x + 10;
} else {
_local1.xDest = _local2._x - 10;
}
_local1.yDest = _local2._y;
_local1.xPatrol = _local2._x;
_local1.stopCount = 50;
}
function projectile(mc, projectileType, ht) {
var _local1 = this;
_local1.mc = mc;
_local1.state = "thrown";
_local1.actor = "projectile";
_local1.projType = projectileType;
_local1.hitTarget = ht;
_local1.xVel = 0;
_local1.xMax = 18;
_local1.yVel = 0;
_local1.yMax = 14;
_local1.xAcc = 3;
_local1.xSpec = 0;
_local1.ySpec = 0;
_local1.jumping = false;
_local1.head = 10;
_local1.grabbedName = null;
_local1.phaseCount = 0;
_local1.life = 40;
}
function boss(mc) {
var _local1 = this;
var _local2 = mc;
_local1.mc = _local2;
_local1.state = "normal";
_local1.actor = "boss";
_local1.xVel = 0;
_local1.xMax = 1;
_local1.yVel = 0;
_local1.yMax = 26;
_local1.xAcc = 0.8;
_local1.xAirAcc = 0.4;
_local1.xSpec = 0;
_local1.ySpec = 0;
_local1.jumping = false;
_local1.head = 50;
_local1.stopCount = 0;
_local1.grabbedName = null;
_local1.holdName = null;
_local1.grabCount = 0;
_local1.hitCount = 0;
_local1.phaseCount = 0;
_local1.animHoldIdle = 0;
_local1.animHoldWalk = 0;
_local1.attackHold = 0;
_local1.bp = 0;
_local1.hitHold = 0;
_local1.finalHit = false;
_local1.xForce = 0;
_local1.yForce = 0;
_local1.hp = 100;
_local1.jumpPressed = false;
_local1.dJumpOK = false;
_local1.pausePressed = false;
_local1.xDest = _local2._x + 1;
_local1.yDest = _local2._y;
_local1.xPatrol = _local2._x;
_local1.stopCount = 50;
}
function torchControl(torchName1) {
var _local1 = this[torchName1];
var _local3 = _local1.mc._x;
var _local2 = _local1.mc._y;
if (_local1.state == "inactive") {
if ((Math.abs(_local3 - p1.mc._x) <= xCutoff) && (Math.abs(_local2 - p1.mc._y) <= yCutoff)) {
_local1.state = "normal";
_local1.mc._visible = true;
}
} else {
if ((_local1.state == "normal") || (_local1.state == "thrown")) {
if (((p1.holdName == null) && (p1.grabCount > 0)) && (p1.mc.mcMC.mcGrab._x != undefined)) {
if (p1.mc._xscale > 0) {
temp = p1.mc.mcMC.mcGrab._x;
} else {
temp = -p1.mc.mcMC.mcGrab._x;
}
if (_local1.mc.mcHit.hitTest(p1.mc._x + temp, p1.mc._y + p1.mc.mcMC.mcGrab._y, true)) {
_local1.state = "grabbed";
_local1.grabbedName = p1;
_local1.mc.swapDepths(grabbedDepth);
_local1.depth = grabbedDepth;
p1.holdName = _local1;
p1.windup = 0;
}
}
}
if (p1.attackHold > 0) {
if (p1.mc._xscale > 0) {
temp = p1.mc.mcMC.mcAttack._x;
} else {
temp = -p1.mc.mcMC.mcAttack._x;
}
if ((p1.mc.mcMC.mcAttack._x != undefined) && (_local1.mc.mcHit.hitTest(p1.mc._x + temp, p1.mc._y + p1.mc.mcMC.mcAttack._y, true))) {
if (p1.mc._xscale > 0) {
_local1.xVel = p1.xForce * 4;
} else {
_local1.xVel = (-p1.xForce) * 4;
}
if (p1.mc.mcMC.mcAttack._y < -10) {
_local1.yVel = p1.yForce * 4;
}
_local1.state = "thrown";
_local1.mc.mcMC.mcHand.gotoAndStop("none");
}
}
if (_local1.state == "normal") {
_local1.mc.mcMC.mcHand.gotoAndStop("none");
_local1._xscale = _local1.xScale0;
_local1._yscale = _local1.yScale0;
if (_local1.stopCount > 0) {
_local1.stopCount++;
if (_local1.stopCount > ((Math.random() * 45) + 15)) {
_local1.stopCount = 0;
_local1.mc._xscale = -_local1.mc._xscale;
}
}
if (_local1.xSpec > 0) {
_local1.xSpec--;
}
if (_local1.xSpec <= 0) {
if (_local1.xVel > _local1.xMax) {
_local1.xVel = _local1.xMax + ((_local1.xMax - _local1.xVel) / 8);
} else if (_local1.xVel < (-_local1.xMax)) {
_local1.xVel = (-_local1.xMax) + ((_local1.xVel + _local1.xMax) / 8);
}
}
if (_local1.xVel != 0) {
if (_local1.stopCount > 0) {
if (mapHit.hitTest(_local3 + _local1.xVel, _local2 - gravity, true)) {
_local1.xVel = 0;
}
}
}
_local1.mc._x = _local1.mc._x + _local1.xVel;
if (((_local1.xVel != 0) && (!Key.isDown(_local1.keyLeft))) && (!Key.isDown(_local1.keyRight))) {
if ((!mapHit.hitTest(_local3, _local2, true)) && (mapHit.hitTest(_local3, _local2 + (gravity * 8), true))) {
temp = 0;
while ((temp < (gravity * 8)) && (!mapHit.hitTest(_local3, _local2 + temp, true))) {
temp = temp + gravity;
}
_local1.mc._y = _local1.mc._y + temp;
}
}
if (_local1.ySpec > 0) {
_local1.ySpec--;
}
if (_local1.ySpec <= 0) {
if (_local1.yVel > _local1.yMax) {
_local1.yVel = _local1.yMax;
} else if (_local1.yVel < (-_local1.yMax)) {
_local1.yVel = -_local1.yMax;
}
}
_local1.mc._y = _local1.mc._y + _local1.yVel;
if ((Math.abs(_local3 - p1.mc._x) > xCutoff) || (Math.abs(_local2 - p1.mc._y) > yCutoff)) {
_local1.state = "inactive";
_local1.mc._visible = false;
}
if (_local1.mc._xscale > 0) {
makeFire(_local1, _local1.mc.mcMC.mcMC._rotation);
} else {
makeFire(_local1, -_local1.mc.mcMC.mcMC._rotation);
}
} else if (_local1.state == "grabbed") {
_local1.mc.gotoAndStop("grabbed");
_local1.mc.mcMC.mcHand.gotoAndStop("Wink");
if (_local1.grabbedName.mc._xscale > 0) {
_local1.mc._x = _local1.grabbedName.mc._x + _local1.grabbedName.mc.mcMC.mcHand._x;
_local1.mc._xscale = _local1.grabbedName.mc.mcMC.mcHand._xscale;
_local1.mc._rotation = _local1.grabbedName.mc.mcMC.mcHand._rotation;
} else {
_local1.mc._x = _local1.grabbedName.mc._x - _local1.grabbedName.mc.mcMC.mcHand._x;
_local1.mc._xscale = -_local1.grabbedName.mc.mcMC.mcHand._xscale;
_local1.mc._rotation = -_local1.grabbedName.mc.mcMC.mcHand._rotation;
}
_local1.mc._y = _local1.grabbedName.mc._y + _local1.grabbedName.mc.mcMC.mcHand._y;
_local1.mc._yscale = _local1.grabbedName.mc.mcMC.mcHand._yscale;
makeFire(_local1, _local1.mc._rotation);
} else if (_local1.state == "thrown") {
_local1.mc.mcMC.mcHand.gotoAndStop("none");
_local1._xscale = _local1.xScale0;
_local1._yscale = _local1.yScale0;
if (_local1.xVel > 0) {
if (_local1.yVel != 0) {
_local1.xVel = _local1.xVel / frictionAir;
} else {
_local1.xVel = _local1.xVel / friction;
}
if (_local1.xVel <= 0.3) {
_local1.xVel = 0;
}
} else if (_local1.xVel < 0) {
if (_local1.yVel != 0) {
_local1.xVel = _local1.xVel / frictionAir;
} else {
_local1.xVel = _local1.xVel / friction;
}
if (_local1.xVel >= -0.3) {
_local1.xVel = 0;
}
}
if (_local1.xVel != 0) {
if (mapHit.hitTest(_local3 + _local1.xVel, _local2 - (gravity * 2), true)) {
if (_local1.xVel > 0) {
temp = _local1.xVel - _local1.xAcc;
enemyBounceRight(_local1, temp);
} else {
temp = _local1.xVel + _local1.xAcc;
enemyBounceLeft(_local1, temp);
}
if (Math.abs(_local1.xVel) <= 0.3) {
_local1.xVel = 0;
}
} else if (_local1.xVel > _local1.xMax) {
if (mapHit.hitTest(_local3 + (_local1.xVel / 2), _local2 - (gravity * 2), true)) {
temp = (_local1.xVel / 2) - _local1.xAcc;
enemyBounceRight(_local1, temp);
} else if (mapHit.hitTest(_local3, _local2 - (gravity * 2), true)) {
temp = -_local1.xAcc;
enemyBounceRight(_local1, temp);
}
} else if (_local1.xVel < (-_local1.xMax)) {
if (mapHit.hitTest(_local3 + (_local1.xVel / 2), _local2 - (gravity * 2), true)) {
temp = (_local1.xVel / 2) + _local1.xAcc;
enemyBounceLeft(_local1, temp);
} else if (mapHit.hitTest(_local3, _local2 - (gravity * 2), true)) {
temp = _local1.xAcc;
enemyBounceLeft(_local1, temp);
}
}
}
_local1.mc._x = _local1.mc._x + _local1.xVel;
if (((_local1.xVel != 0) && (!Key.isDown(_local1.keyLeft))) && (!Key.isDown(_local1.keyRight))) {
if ((!mapHit.hitTest(_local3, _local2, true)) && (mapHit.hitTest(_local3, _local2 + (gravity * 8), true))) {
temp = 0;
while ((temp < (gravity * 8)) && (!mapHit.hitTest(_local3, _local2 + temp, true))) {
temp = temp + gravity;
}
_local1.mc._y = _local1.mc._y + temp;
}
}
if (_local1.yVel > _local1.yMax) {
_local1.yVel = _local1.yMax;
}
if (!mapHit.hitTest(_local1.mc._x, (_local1.mc._y + gravity) + _local1.yVel, true)) {
if ((Math.abs(_local1.xVel) > 20) || (Math.abs(_local1.yVel) > 12)) {
_local1.mc.gotoAndStop("thrownBlur");
} else {
_local1.mc.gotoAndStop("thrown");
}
if (_local1.yVel > 20) {
if (!mapHit.hitTest(_local1.mc._x, (_local1.mc._y + gravity) + (_local1.yVel / 2), true)) {
_local1.yVel = _local1.yVel + gravity;
if (_local1.yVel > gravity) {
_local1.jumping = false;
}
if (!_local1.jumping) {
_local1.mc.gotoAndStop("fall");
}
} else {
enemy0HitGround(_local1);
_local1._y = _local1._y + (-gravity);
}
} else {
_local1.yVel = _local1.yVel + gravity;
if (_local1.yVel > gravity) {
_local1.jumping = false;
}
if (!_local1.jumping) {
_local1.mc.gotoAndStop("fall");
}
}
} else {
enemy0HitGround(_local1);
_local1.mc.gotoAndStop("bouncing");
if (_local1.xVel == 0) {
if (!mapHit.hitTest(_local1.mc._x - 10, _local1.mc._y + 3, true)) {
_local1.xVel = _local1.yVel * 2;
} else if (!mapHit.hitTest(_local1.mc._x - 20, _local1.mc._y + 3, true)) {
_local1.xVel = _local1.yVel;
} else if (!mapHit.hitTest(_local1.mc._x - 40, _local1.mc._y + 3, true)) {
_local1.xVel = _local1.yVel / 2;
} else if (!mapHit.hitTest(_local1.mc._x + 10, _local1.mc._y + 3, true)) {
_local1.xVel = (-_local1.yVel) * 2;
} else if (!mapHit.hitTest(_local1.mc._x + 20, _local1.mc._y + 3, true)) {
_local1.xVel = -_local1.yVel;
} else if (!mapHit.hitTest(_local1.mc._x + 40, _local1.mc._y + 3, true)) {
_local1.xVel = (-_local1.yVel) / 2;
}
}
}
if (_local1.yVel < 0) {
if (mapHit.hitTest(_local1.mc._x, (_local1.mc._y - _local1.head) + _local1.yVel, true)) {
temp = _local1.yVel + gravity;
_local1.mc._y = _local1.mc._y + temp;
_local1.yVel = 0.001;
while (mapHit.hitTest(_local1.mc._x, (_local1.mc._y - _local1.head) + temp, true)) {
_local1.mc._y = _local1.mc._y + gravity;
temp = temp + gravity;
}
}
}
_local1.mc._y = _local1.mc._y + _local1.yVel;
if ((_local1.xVel == 0) && (_local1.yVel == 0)) {
_local1.state = "normal";
_local1.mc.gotoAndStop("down");
if (thrownName == _local1) {
thrownName = null;
}
}
if (_local1.mc._xscale > 0) {
makeFire(_local1, _local1.mc.mcMC.mcMC._rotation);
} else {
makeFire(_local1, -_local1.mc.mcMC.mcMC._rotation);
}
}
}
}
function playerControl(playerNum) {
with (p1) {
animHoldIdle--;
animHoldWalk--;
animHoldAir--;
animHoldCrouch--;
animHoldWallSlide--;
attackHold--;
grabCount--;
xSpec--;
ySpec--;
dashCount--;
dashHold--;
deflecting--;
}
if (Key.isDown(p1.keyHide)) {
if (!p1.hidePressed) {
p1.hidePressed = true;
p1Hide();
}
} else {
p1.hidePressed = false;
}
soundWink.onSoundComplete = function () {
soundWinkDone = true;
};
if (p1.plane == "shadow") {
if (p1.state == "normal") {
shadow_Normal();
}
} else if (p1.plane == "ground") {
if (p1.state == "normal") {
ground_Normal();
} else if (p1.state == "grabbing") {
ground_Grabbing();
} else if (p1.state == "stuck") {
ground_Stuck();
} else if (p1.state == "thrown") {
ground_Thrown();
} else if (p1.state == "down") {
ground_Down();
}
}
}
function actorHitGround(actorName) {
var _local1 = actorName;
_local1.yVel = _local1.yVel + (-gravity);
var _local2 = _local1.yMax;
do {
if (!mapHit.hitTest(_local1.mc._x, (_local1.mc._y + gravity) + _local1.yVel, true)) {
break;
}
_local1.yVel = _local1.yVel + (-gravity);
_local2 = _local2 + (-gravity);
} while (_local2 >= gravity);
_local1.yVel = _local1.yVel + gravity;
_local1.mc._y = _local1.mc._y + _local1.yVel;
if (_local1.yVel != 0) {
_local1.mc.gotoAndStop("bouncing");
_local1.landCount = 6;
}
if (_local1.yVel > gravity) {
_local1.yVel = (-_local1.yVel) / 1.7;
_local1.mc._y = _local1.mc._y + ((-_local1.yVel) - gravity);
_local1.xVel = _local1.xVel / 2;
} else {
_local1.yVel = 0;
}
_local1.jumping = false;
}
function enemy0HitGround(actorName2) {
var _local1 = actorName2;
_local1.yVel = _local1.yVel + (-gravity);
var _local2 = _local1.yMax;
do {
if (!mapHit.hitTest(_local1.mc._x, (_local1.mc._y + gravity) + _local1.yVel, true)) {
break;
}
_local1.yVel = _local1.yVel + (-gravity);
_local2 = _local2 + (-gravity);
} while (_local2 >= gravity);
_local1.yVel = _local1.yVel + gravity;
_local1.mc._y = _local1.mc._y + _local1.yVel;
if (_local1.yVel != 0) {
_local1.mc.gotoAndStop("land");
_local1.landCount = 6;
}
if (_local1.yVel > gravity) {
_local1.yVel = (-_local1.yVel) / 1.7;
_local1.mc._y = _local1.mc._y + ((-_local1.yVel) - gravity);
_local1.xVel = _local1.xVel / 2;
} else {
_local1.yVel = 0;
}
_local1.jumping = false;
}
function enemyBounceRight(actorName3, tempAcc) {
var _local1 = actorName3;
var _local2 = tempAcc;
while (mapHit.hitTest(_local1.mc._x + _local2, _local1.mc._y - (gravity * 2), true)) {
_local2 = _local2 + (-_local1.xAcc);
if (_local2 < 0) {
if (!mapHit.hitTest(_local1.mc._x - 10, _local1.mc._y - 10, true)) {
_local1.mc._x = _local1.mc._x + -10;
_local1.mc._y = _local1.mc._y + -10;
} else if (!mapHit.hitTest(_local1.mc._x - 20, _local1.mc._y - 20, true)) {
_local1.mc._x = _local1.mc._x + -20;
_local1.mc._y = _local1.mc._y + -20;
} else if (!mapHit.hitTest(_local1.mc._x - 30, _local1.mc._y - 30, true)) {
_local1.mc._x = _local1.mc._x + -30;
_local1.mc._y = _local1.mc._y + -30;
}
}
}
_local1.mc._x = _local1.mc._x + _local2;
_local2 = _local1.xVel;
_local1.xVel = 0;
if (!mapHit.hitTest(_local1.mc._x + 20, _local1.mc._y - 10, true)) {
_local1.xVel = _local2 / 2;
} else if (!mapHit.hitTest(_local1.mc._x + 20, _local1.mc._y - 20, true)) {
_local1.xVel = 0;
} else if (!mapHit.hitTest(_local1.mc._x + 20, _local1.mc._y - 40, true)) {
_local1.xVel = (-_local2) / 2;
} else {
_local1.xVel = -_local2;
}
}
function enemyBounceLeft(actorName4, tempAcc) {
var _local1 = actorName4;
var _local2 = tempAcc;
while (mapHit.hitTest(_local1.mc._x + _local2, _local1.mc._y - (gravity * 2), true)) {
_local2 = _local2 + _local1.xAcc;
if (_local2 < 0) {
if (!mapHit.hitTest(_local1.mc._x + 10, _local1.mc._y - 10, true)) {
_local1.mc._x = _local1.mc._x + 10;
_local1.mc._y = _local1.mc._y + -10;
} else if (!mapHit.hitTest(_local1.mc._x + 20, _local1.mc._y - 20, true)) {
_local1.mc._x = _local1.mc._x + 20;
_local1.mc._y = _local1.mc._y + -20;
} else if (!mapHit.hitTest(_local1.mc._x + 30, _local1.mc._y - 30, true)) {
_local1.mc._x = _local1.mc._x + 30;
_local1.mc._y = _local1.mc._y + -30;
}
}
}
_local1.mc._x = _local1.mc._x + _local2;
_local2 = _local1.xVel;
_local1.xVel = 0;
if (!mapHit.hitTest(_local1.mc._x - 20, _local1.mc._y - 10, true)) {
_local1.xVel = _local2 / 2;
} else if (!mapHit.hitTest(_local1.mc._x - 20, _local1.mc._y - 20, true)) {
_local1.xVel = 0;
} else if (!mapHit.hitTest(_local1.mc._x - 20, _local1.mc._y - 40, true)) {
_local1.xVel = (-_local2) / 2;
} else {
_local1.xVel = -_local2;
}
}
function enemy1Control(enemyName1) {
var _local1 = this[enemyName1];
if (_local1.state == "inactive") {
_local1.phaseCount--;
if ((Math.abs(_local1.mc._x - p1.mc._x) <= xCutoff) && (Math.abs(_local1.mc._y - p1.mc._y) <= yCutoff)) {
_local1.state = "normal";
_local1.mc._visible = true;
}
} else if (_local1.state != "dead") {
_local1.animHoldIdle--;
_local1.animHoldWalk--;
_local1.phaseCount--;
_local1.grabCount--;
if ((_local1.state == "normal") || (_local1.state == "thrown")) {
enemy1_grabCheck(_local1);
}
if (((((p1.whacking == 1) && (_local1.state != "clothes")) && (_local1.state != "down")) && (_local1.state != "getup")) && (_local1.state != "whacked")) {
if ((Math.abs(_local1.mc._x - p1.mc._x) < 45) && (Math.abs(_local1.mc._y - p1.mc._y) < 50)) {
p1.whacking = 2;
}
}
if (((((p1.attackHold > 0) && (_local1.state != "grabbed")) && (_local1.state != "clothes")) && (_local1.state != "whacked")) && (p1.mc.mcMC.mcAttack._x != undefined)) {
if (p1.mc._xscale > 0) {
temp = p1.mc.mcMC.mcAttack._x;
} else {
temp = -p1.mc.mcMC.mcAttack._x;
}
if (_local1.mc.mcHit.hitTest(p1.mc._x + temp, p1.mc._y + p1.mc.mcMC.mcAttack._y, true)) {
enemy1_getHit(_local1);
}
}
if ((_local1.phase == 1) || (_local1.phase == 2)) {
if (_local1.state == "normal") {
enemy1_Normal(_local1);
} else if (_local1.state == "grabbed") {
enemy1_Grabbed(_local1);
} else if (_local1.state == "thrown") {
enemy1_Thrown(_local1);
} else if (_local1.state == "hit") {
enemy1_Hit(_local1);
} else if (_local1.state == "falldown") {
enemy1_Falldown(_local1);
} else if (_local1.state == "getup") {
enemy1_Getup(_local1);
} else if (_local1.state == "choking") {
enemy1_Choking(_local1);
} else if (_local1.state == "down") {
enemy1_Down(_local1);
} else if (_local1.state == "onfire") {
enemy1_Onfire(_local1);
} else if (_local1.state == "whacked") {
enemy1_Whacked(_local1);
} else if (_local1.state == "clothes") {
}
}
} else if (_local1.state == "dead") {
}
}
function staffControl(staffName1) {
var _local1 = this[staffName1];
var _local3 = _local1.mc._x;
var _local2 = _local1.mc._y;
if (_local1.state == "inactive") {
if ((Math.abs(_local3 - p1.mc._x) <= xCutoff) && (Math.abs(_local2 - p1.mc._y) <= yCutoff)) {
_local1.state = _local1.lastState;
_local1.mc._visible = true;
}
} else {
if ((_local1.state == "normal") || (_local1.state == "thrown")) {
if (((p1.holdName == null) && (p1.grabCount > 0)) && (p1.mc.mcMC.mcGrab._x != undefined)) {
if (p1.mc._xscale > 0) {
temp = p1.mc.mcMC.mcGrab._x;
} else {
temp = -p1.mc.mcMC.mcGrab._x;
}
if (_local1.mc.mcHit.hitTest(p1.mc._x + temp, p1.mc._y + p1.mc.mcMC.mcGrab._y, true)) {
_local1.state = "grabbed";
_local1.grabbedName = p1;
_local1.mc.swapDepths(grabbedDepth);
_local1.depth = grabbedDepth;
p1.holdName = _local1;
p1.windup = 0;
}
}
}
if (p1.attackHold > 0) {
if (p1.mc._xscale > 0) {
temp = p1.mc.mcMC.mcAttack._x;
} else {
temp = -p1.mc.mcMC.mcAttack._x;
}
if ((p1.mc.mcMC.mcAttack._x != undefined) && (_local1.mc.mcHit.hitTest(p1.mc._x + temp, p1.mc._y + p1.mc.mcMC.mcAttack._y, true))) {
if (p1.mc._xscale > 0) {
_local1.xVel = p1.xForce * 4;
} else {
_local1.xVel = (-p1.xForce) * 4;
}
if (p1.mc.mcMC.mcAttack._y < -10) {
_local1.yVel = p1.yForce * 4;
}
_local1.state = "thrown";
}
}
if (_local1.state == "normal") {
_local1.mc.gotoAndStop("down");
_local1.mc.mcMC.mcHand.gotoAndStop("none");
_local1._xscale = _local1.xScale0;
_local1._yscale = _local1.yScale0;
if (_local1.stopCount > 0) {
_local1.stopCount++;
if (_local1.stopCount > ((Math.random() * 45) + 15)) {
_local1.stopCount = 0;
_local1.mc._xscale = -_local1.mc._xscale;
}
}
if (_local1.xSpec > 0) {
_local1.xSpec--;
}
if (_local1.xSpec <= 0) {
if (_local1.xVel > _local1.xMax) {
_local1.xVel = _local1.xMax + ((_local1.xMax - _local1.xVel) / 8);
} else if (_local1.xVel < (-_local1.xMax)) {
_local1.xVel = (-_local1.xMax) + ((_local1.xVel + _local1.xMax) / 8);
}
}
if (_local1.xVel != 0) {
if (_local1.stopCount > 0) {
if (mapHit.hitTest(_local3 + _local1.xVel, _local2 - gravity, true)) {
_local1.xVel = 0;
}
}
}
_local1.mc._x = _local1.mc._x + _local1.xVel;
if (((_local1.xVel != 0) && (!Key.isDown(_local1.keyLeft))) && (!Key.isDown(_local1.keyRight))) {
if ((!mapHit.hitTest(_local3, _local2, true)) && (mapHit.hitTest(_local3, _local2 + (gravity * 8), true))) {
temp = 0;
while ((temp < (gravity * 8)) && (!mapHit.hitTest(_local3, _local2 + temp, true))) {
temp = temp + gravity;
}
_local1.mc._y = _local1.mc._y + temp;
}
}
if (_local1.ySpec > 0) {
_local1.ySpec--;
}
if (_local1.ySpec <= 0) {
if (_local1.yVel > _local1.yMax) {
_local1.yVel = _local1.yMax;
} else if (_local1.yVel < (-_local1.yMax)) {
_local1.yVel = -_local1.yMax;
}
}
_local1.mc._y = _local1.mc._y + _local1.yVel;
if ((Math.abs(_local3 - p1.mc._x) > xCutoff) || (Math.abs(_local2 - p1.mc._y) > yCutoff)) {
if (mapHit.hitTest(_local3, _local2, true)) {
_local1.lastState = _local1.state;
_local1.state = "inactive";
_local1.mc._visible = false;
}
}
if ((((thrownName != null) && (thrownName != _local1)) && (thrownName.actor != "hoodley")) && (thrownName.actor != "staff")) {
if (_local1.mc.mcHit.hitTest(thrownName.mc.mcHit)) {
_local1.xVel = thrownName.xVel;
_local1.yVel = thrownName.yVel;
thrownName.xVel = (-thrownName.xVel) * 0.8;
thrownName.yVel = (-thrownName.yVel) * 0.8;
_local1.state = "thrown";
_local1.mc.gotoAndStop("thrown");
_local1.mc.mcMC.mcHand.gotoAndStop("none");
}
}
} else if (_local1.state == "grabbed") {
_local1.mc.gotoAndStop("grabbed");
if (_local1.grabbedName.mc._name == "mcP1") {
_local1.mc.mcMC.mcHand.gotoAndStop("Wink");
} else {
_local1.mc.mcMC.mcHand.gotoAndStop("none");
}
if (_local1.grabbedName.mc._xscale > 0) {
_local1.mc._x = _local1.grabbedName.mc._x + _local1.grabbedName.mc.mcMC.mcHand._x;
_local1.mc._xscale = _local1.grabbedName.mc.mcMC.mcHand._xscale;
_local1.mc._rotation = _local1.grabbedName.mc.mcMC.mcHand._rotation;
} else {
_local1.mc._x = _local1.grabbedName.mc._x - _local1.grabbedName.mc.mcMC.mcHand._x;
_local1.mc._xscale = -_local1.grabbedName.mc.mcMC.mcHand._xscale;
_local1.mc._rotation = -_local1.grabbedName.mc.mcMC.mcHand._rotation;
}
_local1.mc._y = _local1.grabbedName.mc._y + _local1.grabbedName.mc.mcMC.mcHand._y;
_local1.mc._yscale = _local1.grabbedName.mc.mcMC.mcHand._yscale;
if ((Math.abs(_local3 - p1.mc._x) > xCutoff) || (Math.abs(_local2 - p1.mc._y) > yCutoff)) {
_local1.lastState = _local1.state;
_local1.state = "inactive";
_local1.mc._visible = false;
}
} else if (_local1.state == "thrown") {
_local1.mc.mcMC.mcHand.gotoAndStop("none");
_local1.mc._xscale = _local1.xScale0;
_local1.mc._yscale = _local1.yScale0;
if ((Math.abs(_local3 - p1.mc._x) > xCutoff) || (Math.abs(_local2 - p1.mc._y) > yCutoff)) {
if (mapHit.hitTest(_local3, _local2, true)) {
_local1.lastState = _local1.state;
_local1.state = "inactive";
_local1.mc._visible = false;
}
}
if (Math.abs(_local1.mc._rotation + 90) > 93) {
_local1.mc._rotation = (_local1.mc._rotation / 2) - 180;
}
if (_local1.xVel > 0) {
if (_local1.yVel != 0) {
_local1.xVel = _local1.xVel / frictionAir;
} else {
_local1.xVel = _local1.xVel / friction;
}
if (_local1.xVel <= 0.3) {
_local1.xVel = 0;
}
} else if (_local1.xVel < 0) {
if (_local1.yVel != 0) {
_local1.xVel = _local1.xVel / frictionAir;
} else {
_local1.xVel = _local1.xVel / friction;
}
if (_local1.xVel >= -0.3) {
_local1.xVel = 0;
}
}
if (_local1.xVel != 0) {
if (mapHit.hitTest(_local3 + _local1.xVel, _local2 - (gravity * 2), true)) {
if (_local1.xVel > 0) {
temp = _local1.xVel - _local1.xAcc;
enemyBounceRight(_local1, temp);
} else {
temp = _local1.xVel + _local1.xAcc;
enemyBounceLeft(_local1, temp);
}
if (Math.abs(_local1.xVel) <= 0.3) {
_local1.xVel = 0;
}
} else if (_local1.xVel > _local1.xMax) {
if (mapHit.hitTest(_local3 + (_local1.xVel / 2), _local2 - (gravity * 2), true)) {
temp = (_local1.xVel / 2) - _local1.xAcc;
enemyBounceRight(_local1, temp);
} else if (mapHit.hitTest(_local3, _local2 - (gravity * 2), true)) {
temp = -_local1.xAcc;
enemyBounceRight(_local1, temp);
}
} else if (_local1.xVel < (-_local1.xMax)) {
if (mapHit.hitTest(_local3 + (_local1.xVel / 2), _local2 - (gravity * 2), true)) {
temp = (_local1.xVel / 2) + _local1.xAcc;
enemyBounceLeft(_local1, temp);
} else if (mapHit.hitTest(_local3, _local2 - (gravity * 2), true)) {
temp = _local1.xAcc;
enemyBounceLeft(_local1, temp);
}
}
}
_local1.mc._x = _local1.mc._x + _local1.xVel;
if (((_local1.xVel != 0) && (!Key.isDown(_local1.keyLeft))) && (!Key.isDown(_local1.keyRight))) {
if ((!mapHit.hitTest(_local3, _local2, true)) && (mapHit.hitTest(_local3, _local2 + (gravity * 8), true))) {
temp = 0;
while ((temp < (gravity * 8)) && (!mapHit.hitTest(_local3, _local2 + temp, true))) {
temp = temp + gravity;
}
_local1.mc._y = _local1.mc._y + temp;
}
}
if (_local1.yVel > _local1.yMax) {
_local1.yVel = _local1.yMax;
}
if (!mapHit.hitTest(_local1.mc._x, (_local1.mc._y + gravity) + _local1.yVel, true)) {
if ((Math.abs(_local1.xVel) > 20) || (Math.abs(_local1.yVel) > 12)) {
_local1.mc.gotoAndStop("thrownBlur");
} else {
_local1.mc.gotoAndStop("thrown");
}
if (_local1.yVel > 20) {
if (!mapHit.hitTest(_local1.mc._x, (_local1.mc._y + gravity) + (_local1.yVel / 2), true)) {
_local1.yVel = _local1.yVel + gravity;
if (_local1.yVel > gravity) {
_local1.jumping = false;
}
if (!_local1.jumping) {
_local1.mc.gotoAndStop("fall");
}
} else {
enemy0HitGround(_local1);
_local1._y = _local1._y + (-gravity);
}
} else {
_local1.yVel = _local1.yVel + gravity;
if (_local1.yVel > gravity) {
_local1.jumping = false;
}
if (!_local1.jumping) {
_local1.mc.gotoAndStop("fall");
}
}
} else {
enemy0HitGround(_local1);
_local1.mc.gotoAndStop("bouncing");
if (_local1.xVel == 0) {
if (!mapHit.hitTest(_local1.mc._x - 10, _local1.mc._y + 3, true)) {
_local1.xVel = _local1.yVel * 2;
} else if (!mapHit.hitTest(_local1.mc._x - 20, _local1.mc._y + 3, true)) {
_local1.xVel = _local1.yVel;
} else if (!mapHit.hitTest(_local1.mc._x - 40, _local1.mc._y + 3, true)) {
_local1.xVel = _local1.yVel / 2;
} else if (!mapHit.hitTest(_local1.mc._x + 10, _local1.mc._y + 3, true)) {
_local1.xVel = (-_local1.yVel) * 2;
} else if (!mapHit.hitTest(_local1.mc._x + 20, _local1.mc._y + 3, true)) {
_local1.xVel = -_local1.yVel;
} else if (!mapHit.hitTest(_local1.mc._x + 40, _local1.mc._y + 3, true)) {
_local1.xVel = (-_local1.yVel) / 2;
}
}
}
if (_local1.yVel < 0) {
if (mapHit.hitTest(_local1.mc._x, (_local1.mc._y - _local1.head) + _local1.yVel, true)) {
temp = _local1.yVel + gravity;
_local1.mc._y = _local1.mc._y + temp;
_local1.yVel = 0.001;
while (mapHit.hitTest(_local1.mc._x, (_local1.mc._y - _local1.head) + temp, true)) {
_local1.mc._y = _local1.mc._y + gravity;
temp = temp + gravity;
}
}
}
_local1.mc._y = _local1.mc._y + _local1.yVel;
if ((_local1.xVel == 0) && (_local1.yVel == 0)) {
_local1.state = "normal";
if (thrownName == _local1) {
thrownName = null;
}
}
}
}
}
function vcam() {
var _local2 = _root;
var _local1 = 30;
if (shakeCam > 0) {
mcCam._x = mcCam._x + (((-shakeCam) / 2) + (Math.random() * shakeCam));
mcCam._y = mcCam._y + (((-shakeCam) / 2) + (Math.random() * shakeCam));
shakeCam = shakeCam + -0.5;
}
if (p1.dashHold > 0) {
if (p1.mc._xscale > 0) {
temp = p1.mc._x + 250;
} else {
temp = p1.mc._x - 250;
}
if ((temp < mcCam._x) || (temp > mcCam._x)) {
mcCam._x = mcCam._x + Math.round((temp - mcCam._x) / 16);
}
} else {
if (p1.mc._xscale > 0) {
temp = p1.mc._x + 80;
} else {
temp = p1.mc._x - 80;
}
if ((temp < mcCam._x) || (temp > mcCam._x)) {
mcCam._x = mcCam._x + Math.round((temp - mcCam._x) / 16);
}
}
if ((p1.state == "stuck") && ((((p1.mc._y + 50) - _local1) < mcCam._y) || (((p1.mc._y + 50) - _local1) > mcCam._y))) {
mcCam._y = mcCam._y + Math.round((((p1.mc._y + 50) - _local1) - mcCam._y) / 12);
} else if (((p1.mc._y - _local1) < mcCam._y) || ((p1.mc._y - _local1) > mcCam._y)) {
mcCam._y = mcCam._y + Math.round(((p1.mc._y - _local1) - mcCam._y) / 12);
}
if (Key.isDown(p1.keyDown1)) {
p1.upTime = 0;
if ((p1.xVel != 0) || (p1.yVel != 0)) {
p1.crouchTime = 0;
} else {
if ((p1.crouchTime > 30) && (p1.yVel == 0)) {
mcCam._y = mcCam._y + 5;
}
p1.crouchTime++;
}
} else {
p1.crouchTime = 0;
if (Key.isDown(p1.keyUp1)) {
if ((p1.xVel != 0) || (p1.yVel != 0)) {
p1.upTime = 0;
} else {
if ((p1.upTime > 30) && (p1.yVel == 0)) {
mcCam._y = mcCam._y + -5;
}
p1.upTime++;
}
} else {
p1.upTime = 0;
}
}
_local2._x = ((-(mcCam._x - (mcCam.mcFrame._width / 2))) * Stage.width) / mcCam.mcFrame._width;
_local2._y = ((-(mcCam._y - (mcCam.mcFrame._height / 2))) * Stage.height) / mcCam.mcFrame._height;
_local2._xscale = (Stage.width / mcCam.mcFrame._width) * 100;
_local2._yscale = (Stage.height / mcCam.mcFrame._height) * 100;
mcAll.mcMain.mcSky._x = mcCam._x - (mcCam._x / 10);
mcAll.mcMain.mcSky._y = mcCam._y - (mcCam._y / 10);
}
function projControl(projName1) {
var _local1 = this[projName1];
switch (_local1.projType) {
case "fireball" :
if (_local1.state == "thrown") {
if (mapHit.hitTest(_local1.mc._x, _local1.mc._y, true)) {
_local1.mc.gotoAndStop("hit");
_local1.state = "hit";
_local1.phaseCount = -123;
makeFX("fire", (_local1.mc._x - 16) + (Math.random() * 32), (_local1.mc._y - 8) + (Math.random() * 16));
makeFX("fire", (_local1.mc._x - 16) + (Math.random() * 32), (_local1.mc._y - 8) + (Math.random() * 16));
}
if (_local1.state == "thrown") {
_local1.mc.gotoAndStop("idle");
if ((((Math.abs(_local1.mc._x - p1.mc._x) < 250) && (Math.abs(_local1.mc._y - p1.mc._y) < 150)) && ((count % 4) == 0)) && (Math.random() > 0.5)) {
makeFX("fire", _local1.mc._x, (_local1.mc._y - 7) + (Math.random() * 14));
}
if (_local1.xVel > _local1.xMax) {
_local1.xVel = _local1.xMax + ((_local1.xMax - _local1.xVel) / 8);
} else if (_local1.xVel < (-_local1.xMax)) {
_local1.xVel = (-_local1.xMax) + ((_local1.xVel + _local1.xMax) / 8);
}
_local1.mc._x = _local1.mc._x + _local1.xVel;
if (_local1.ySpec > 0) {
_local1.ySpec--;
}
if (_local1.ySpec <= 0) {
if (_local1.yVel > _local1.yMax) {
_local1.yVel = _local1.yMax;
} else if (_local1.yVel < (-_local1.yMax)) {
_local1.yVel = -_local1.yMax;
}
}
_local1.mc._y = _local1.mc._y + _local1.yVel;
if ((Math.abs(_local1.mc._x - p1.mc._x) > 350) || (Math.abs(_local1.mc._y - p1.mc._y) > 250)) {
_local1.state = "dead";
_local1.mc._visible = false;
}
}
} else if (_local1.state == "hit") {
if (_local1.phaseCount == -123) {
_local1.phaseCount = 13;
_local1.mc._rotation = -30 + (Math.random() * 60);
}
_local1.phaseCount--;
_local1.mc.gotoAndStop("hit");
if (_local1.phaseCount <= 0) {
_local1.state = "dead";
_local1.mc._visible = false;
}
}
return;
case "wind" :
if (_local1.state == "thrown") {
_local1.life--;
if (_local1.life <= 0) {
_local1.phaseCount = 8;
_local1.state = "hit";
_local1.mc.gotoAndStop("die");
}
if (mapHit.hitTest(_local1.mc._x, _local1.mc._y, true)) {
temp = false;
if ((_local1.yVel > 0) && (mapHit.hitTest(_local1.mc._x + _local1.xVel, _local1.mc._y - _local1.yMax, true))) {
_local1.xVel = -_local1.xVel;
_local1.mc._rotation = -_local1.mc._rotation;
temp = true;
} else if ((_local1.yVel < 0) && (mapHit.hitTest(_local1.mc._x + _local1.xVel, _local1.mc._y + _local1.yMax, true))) {
_local1.xVel = -_local1.xVel;
_local1.mc._rotation = -_local1.mc._rotation;
temp = true;
}
if ((_local1.xVel > 0) && (mapHit.hitTest(_local1.mc._x - _local1.xMax, _local1.mc._y + _local1.yVel, true))) {
_local1.yVel = -_local1.yVel;
_local1.mc._rotation = -_local1.mc._rotation;
temp = true;
} else if ((_local1.xVel < 0) && (mapHit.hitTest(_local1.mc._x + _local1.xMax, _local1.mc._y + _local1.yVel, true))) {
_local1.yVel = -_local1.yVel;
_local1.mc._rotation = -_local1.mc._rotation;
temp = true;
}
_local1.mc._x = _local1.mc._x + _local1.xVel;
_local1.mc._y = _local1.mc._y + _local1.yVel;
if (temp) {
soundFX.attachSound("s_windbounce");
soundFX.start(0, 0);
soundFX.setPan(Math.ceil(((_local1.mc._x - mcCam._x) / 400) * 100));
}
}
if (_local1.state == "thrown") {
_local1.mc.gotoAndStop("idle");
if (_local1.xVel > _local1.xMax) {
_local1.xVel = _local1.xMax + ((_local1.xMax - _local1.xVel) / 8);
} else if (_local1.xVel < (-_local1.xMax)) {
_local1.xVel = (-_local1.xMax) + ((_local1.xVel + _local1.xMax) / 8);
}
_local1.mc._x = _local1.mc._x + _local1.xVel;
if (((_local1.xVel != 0) && (!Key.isDown(_local1.keyLeft))) && (!Key.isDown(_local1.keyRight))) {
if ((!mapHit.hitTest(x1, y1, true)) && (mapHit.hitTest(x1, y1 + (gravity * 8), true))) {
temp = 0;
while ((temp < (gravity * 8)) && (!mapHit.hitTest(x1, y1 + temp, true))) {
temp = temp + gravity;
}
_local1.mc._y = _local1.mc._y + temp;
}
}
if (_local1.ySpec > 0) {
_local1.ySpec--;
}
if (_local1.ySpec <= 0) {
if (_local1.yVel > _local1.yMax) {
_local1.yVel = _local1.yMax;
} else if (_local1.yVel < (-_local1.yMax)) {
_local1.yVel = -_local1.yMax;
}
}
_local1.mc._y = _local1.mc._y + _local1.yVel;
if ((Math.abs(_local1.mc._x - p1.mc._x) > 350) || (Math.abs(_local1.mc._y - p1.mc._y) > 250)) {
_local1.state = "dead";
_local1.mc._visible = false;
}
}
} else if (_local1.state == "hit") {
if (_local1.phaseCount == -123) {
_local1.phaseCount = 10;
}
_local1.phaseCount--;
if (_local1.phaseCount <= 0) {
_local1.state = "dead";
_local1.mc._visible = false;
}
}
return;
case "lightning" :
if (_local1.state == "thrown") {
_local1.life--;
if (_local1.life <= 0) {
_local1.state = "hit";
}
if (mapHit.hitTest(_local1.mc._x, _local1.mc._y, true)) {
_local1.mc.gotoAndStop("die");
_local1.state = "hit";
_local1.phaseCount = 8;
}
if (_local1.state == "thrown") {
_local1.mc._x = _local1.mc._x + _local1.xVel;
if (_local1.ySpec <= 0) {
if (_local1.yVel > _local1.yMax) {
_local1.yVel = _local1.yMax;
} else if (_local1.yVel < (-_local1.yMax)) {
_local1.yVel = -_local1.yMax;
}
}
_local1.mc._y = _local1.mc._y + _local1.yVel;
if ((Math.abs(_local1.mc._x - p1.mc._x) > 350) || (Math.abs(_local1.mc._y - p1.mc._y) > 250)) {
_local1.state = "dead";
_local1.mc._visible = false;
}
}
} else {
if (_local1.state != "hit") {
break;
}
if (_local1.phaseCount == -123) {
_local1.phaseCount = 13;
_local1.mc._rotation = -30 + (Math.random() * 60);
}
_local1.phaseCount--;
if (_local1.phaseCount > 0) {
break;
}
_local1.state = "dead";
_local1.mc._visible = false;
}
}
}
function p1Hide() {
if (((p1.xVel == 0) && (p1.yVel == 0)) && (p1.attackHold <= 0)) {
if (p1.plane == "ground") {
if ((p1.attackHold < 10) && (!mapHitShadow.hitTest(p1.mc._x, p1.mc._y, true))) {
if (p1.state == "normal") {
p1.plane = "shadow";
p1.mc.gotoAndStop("shadowTransIn");
p1.animHoldIdle = 16;
p1.attackHold = 14;
}
}
} else {
p1.plane = "ground";
p1.mc.gotoAndStop("shadowTransOut");
p1.animHoldIdle = 16;
p1.attackHold = 14;
}
}
}
function shadow_Normal() {
if ((p1.attackHold <= 0) && (p1.xSpec <= 0)) {
if (Key.isDown(p1.keyLeft)) {
if (mapHit.hitTest(p1.mc._x, p1.mc._y + (gravity * 2), true)) {
if (((p1.grabCount <= 0) && (p1.windup <= 0)) && (p1.animHoldWalk <= 0)) {
if (p1.mc._xscale > 0) {
p1.mc.gotoAndStop("shadowTurn");
p1.animHoldIdle = 2;
p1.animHoldWalk = 2;
p1.trans = null;
} else {
p1.mc.gotoAndStop("shadowWalk");
p1.trans = "walk";
}
}
p1.mc._xscale = -100;
temp = p1.xVel - p1.xAcc;
if (temp < (-p1.xShadowMax)) {
temp = -p1.xShadowMax;
}
if (!mapHitShadow.hitTest(p1.mc._x + temp, p1.mc._y - gravity, true)) {
if ((!mapHit.hitTest(p1.mc._x + temp, p1.mc._y, true)) && (mapHit.hitTest(p1.mc._x + temp, p1.mc._y + (gravity * 8), true))) {
p1.xVel = temp;
p1.mc._y = p1.mc._y + gravity;
temp = 0;
while ((temp < (gravity * 8)) && (!mapHit.hitTest(p1.mc._x + p1.xVel, p1.mc._y + temp, true))) {
temp = temp + gravity;
}
p1.mc._y = p1.mc._y + temp;
} else if ((!mapHit.hitTest(p1.mc._x + temp, p1.mc._y - gravity, true)) && (mapHit.hitTest((p1.mc._x - p1.xAcc) + temp, p1.mc._y + gravity, true))) {
p1.xVel = temp;
} else if ((!mapHit.hitTest(p1.mc._x + temp, p1.mc._y - 9, true)) && (mapHit.hitTest((p1.mc._x - p1.xAcc) + temp, p1.mc._y + gravity, true))) {
p1.xVel = temp;
temp = gravity * 2;
while (mapHit.hitTest(p1.mc._x + p1.xVel, p1.mc._y - temp, true)) {
temp = temp + gravity;
}
if (p1.xVel > (-p1.xAcc)) {
p1.xVel = -p1.xAcc;
}
p1.mc._y = p1.mc._y + ((-temp) + gravity);
p1.yVel = 0;
} else {
if (p1.xVel > 0) {
if (mapHit.hitTest(p1.mc._x + p1.xVel, p1.mc._y - gravity, true)) {
temp = p1.xVel - p1.xAcc;
do {
if (!mapHit.hitTest(p1.mc._x + temp, p1.mc._y - gravity, true)) {
break;
}
temp = temp + (-p1.xAcc);
} while (temp >= 0);
p1.mc._x = p1.mc._x + temp;
}
} else if (mapHit.hitTest(p1.mc._x + p1.xVel, p1.mc._y - gravity, true)) {
temp = p1.xVel + p1.xAcc;
do {
if (!mapHit.hitTest(p1.mc._x + temp, p1.mc._y - gravity, true)) {
break;
}
temp = temp + p1.xAcc;
} while (temp <= 0);
p1.mc._x = p1.mc._x + temp;
}
p1.xVel = 0;
}
} else {
p1.xVel = 0;
}
} else {
temp = p1.xVel - p1.xAirAcc;
if (temp < (-p1.xShadowMax)) {
temp = -p1.xShadowMax;
}
if (((!mapHit.hitTest(p1.mc._x + temp, p1.mc._y, true)) && (!mapHit.hitTest(p1.mc._x + temp, p1.mc._y - (p1.head / 2), true))) && (!mapHit.hitTest(p1.mc._x + temp, (p1.mc._y - p1.head) + 6, true))) {
if (p1.xVel < (-p1.xShadowMax)) {
if (((!mapHit.hitTest(p1.mc._x + (temp / 2), p1.mc._y, true)) && (!mapHit.hitTest(p1.mc._x + (temp / 2), p1.mc._y - (p1.head / 2), true))) && (!mapHit.hitTest(p1.mc._x + (temp / 2), (p1.mc._y - p1.head) + 6, true))) {
p1.xVel = p1.xVel + (-p1.xAirAcc);
}
} else {
p1.xVel = p1.xVel + (-p1.xAirAcc);
}
} else {
p1.xVel = 0;
}
p1.mc._xscale = -100;
}
if (soundWinkDone) {
soundWink.attachSound("s_sneak");
soundWink.start(0, 0);
soundWink.setPan(Math.ceil(((p1.mc._x - mcCam._x) / 400) * 100));
soundWink.setVolume(70);
soundWinkDone = false;
}
} else if (Key.isDown(p1.keyRight)) {
if (mapHit.hitTest(p1.mc._x, p1.mc._y + (gravity * 2), true)) {
if (((p1.grabCount <= 0) && (p1.windup <= 0)) && (p1.animHoldWalk <= 0)) {
if (p1.mc._xscale < 0) {
p1.mc.gotoAndStop("shadowTurn");
p1.animHoldIdle = 2;
p1.animHoldWalk = 2;
p1.trans = null;
} else {
p1.mc.gotoAndStop("shadowWalk");
p1.trans = "walk";
}
}
p1.mc._xscale = 100;
temp = p1.xVel + p1.xAcc;
if (temp > p1.xShadowMax) {
temp = p1.xShadowMax;
}
if (!mapHitShadow.hitTest(p1.mc._x + temp, p1.mc._y - gravity, true)) {
if ((!mapHit.hitTest(p1.mc._x + temp, p1.mc._y, true)) && (mapHit.hitTest(p1.mc._x + temp, p1.mc._y + (gravity * 8), true))) {
p1.xVel = temp;
p1.mc._y = p1.mc._y + gravity;
temp = 0;
while ((temp < (gravity * 8)) && (!mapHit.hitTest(p1.mc._x + p1.xVel, p1.mc._y + temp, true))) {
temp = temp + gravity;
}
p1.mc._y = p1.mc._y + temp;
} else if ((!mapHit.hitTest(p1.mc._x + temp, p1.mc._y - gravity, true)) && (mapHit.hitTest((p1.mc._x + p1.xAcc) + temp, p1.mc._y + gravity, true))) {
p1.xVel = temp;
} else if ((!mapHit.hitTest(p1.mc._x + temp, p1.mc._y - 9, true)) && (mapHit.hitTest((p1.mc._x + p1.xAcc) + temp, p1.mc._y + gravity, true))) {
p1.xVel = temp;
temp = gravity * 2;
while (mapHit.hitTest(p1.mc._x + p1.xVel, p1.mc._y - temp, true)) {
temp = temp + gravity;
}
if (p1.xVel < p1.xAcc) {
p1.xVel = p1.xAcc;
}
p1.mc._y = p1.mc._y + ((-temp) + gravity);
p1.yVel = 0;
} else {
if (p1.xVel > 0) {
if (mapHit.hitTest(p1.mc._x + p1.xVel, p1.mc._y - gravity, true)) {
temp = p1.xVel - p1.xAcc;
do {
if (!mapHit.hitTest(p1.mc._x + temp, p1.mc._y - gravity, true)) {
break;
}
temp = temp + (-p1.xAcc);
} while (temp >= 0);
p1.mc._x = p1.mc._x + temp;
}
} else if (mapHit.hitTest(p1.mc._x + p1.xVel, p1.mc._y - gravity, true)) {
temp = p1.xVel + p1.xAcc;
do {
if (!mapHit.hitTest(p1.mc._x + temp, p1.mc._y - gravity, true)) {
break;
}
temp = temp + p1.xAcc;
} while (temp <= 0);
p1.mc._x = p1.mc._x + temp;
}
p1.xVel = 0;
}
} else {
p1.xVel = 0;
}
} else {
temp = p1.xVel + p1.xAirAcc;
if (temp > p1.xShadowMax) {
temp = p1.xShadowMax;
}
if (((!mapHit.hitTest(p1.mc._x + temp, p1.mc._y, true)) && (!mapHit.hitTest(p1.mc._x + temp, p1.mc._y - (p1.head / 2), true))) && (!mapHit.hitTest(p1.mc._x + temp, (p1.mc._y - p1.head) + 6, true))) {
if (p1.xVel > p1.xShadowMax) {
if (((!mapHit.hitTest(p1.mc._x + (temp / 2), p1.mc._y, true)) && (!mapHit.hitTest(p1.mc._x + (temp / 2), p1.mc._y - (p1.head / 2), true))) && (!mapHit.hitTest(p1.mc._x + (temp / 2), (p1.mc._y - p1.head) + 6, true))) {
p1.xVel = p1.xVel + p1.xAirAcc;
}
} else {
p1.xVel = p1.xVel + p1.xAirAcc;
}
} else {
p1.xVel = 0;
}
p1.mc._xscale = 100;
}
if (soundWinkDone) {
soundWink.attachSound("s_sneak");
soundWink.start(0, 0);
soundWink.setPan(Math.ceil(((p1.mc._x - mcCam._x) / 400) * 100));
soundWinkDone = false;
}
} else if (p1.xSpec <= 0) {
if (mapHit.hitTest(p1.mc._x, p1.mc._y + gravity, true)) {
if ((p1.animHoldIdle <= 0) && (p1.yVel == 0)) {
if ((p1.grabCount <= 0) && (p1.windup <= 0)) {
if (p1.trans != null) {
p1.trans = null;
p1.mc.gotoAndStop("shadowIdle1");
p1.animHoldIdle = 1;
} else {
p1.mc.gotoAndStop("shadowIdle");
}
}
}
if (p1.xVel > 0) {
p1.xVel = p1.xVel + ((-p1.xAcc) * 2);
if (p1.xVel <= 0.7) {
p1.xVel = 0;
soundWink.stop();
soundWinkDone = true;
}
} else if (p1.xVel < 0) {
p1.xVel = p1.xVel + (p1.xAcc * 2);
if (p1.xVel >= -0.7) {
p1.xVel = 0;
soundWink.stop();
soundWinkDone = true;
}
}
}
}
}
if (p1.xSpec <= 0) {
if (p1.xVel > p1.xMax) {
p1.xVel = p1.xMax + ((p1.xMax - p1.xVel) / 8);
} else if (p1.xVel < (-p1.xMax)) {
p1.xVel = (-p1.xMax) + ((p1.xVel + p1.xMax) / 8);
}
}
if (p1.xVel != 0) {
if (mapHit.hitTest(p1.mc._x + p1.xVel, p1.mc._y - gravity, true)) {
if (p1.xVel > 0) {
temp = p1.xVel - p1.xAcc;
do {
if (!mapHit.hitTest(p1.mc._x + temp, p1.mc._y - gravity, true)) {
break;
}
temp = temp + (-p1.xAcc);
} while (temp >= 0);
p1.mc._x = p1.mc._x + temp;
} else {
temp = p1.xVel + p1.xAcc;
do {
if (!mapHit.hitTest(p1.mc._x + temp, p1.mc._y - gravity, true)) {
break;
}
temp = temp + p1.xAcc;
} while (temp <= 0);
p1.mc._x = p1.mc._x + temp;
}
p1.xVel = 0;
}
}
p1.mc._x = p1.mc._x + p1.xVel;
if ((p1.xVel != 0) && (((!Key.isDown(p1.keyLeft)) && (!Key.isDown(p1.keyRight))) || (p1.attackHold > 0))) {
if ((!mapHit.hitTest(p1.mc._x, p1.mc._y, true)) && (mapHit.hitTest(p1.mc._x, p1.mc._y + (gravity * 8), true))) {
p1_slideDownhill();
}
}
}
function ground_Normal() {
var _local1 = this;
if (!Key.isDown(p1.keyDown1)) {
p1.crouchMoved = false;
p1.crouched = false;
p1.headbouncing = 0;
}
temp = 1;
while (temp <= projectiles) {
temp2 = "proj_" + temp;
temp2 = _local1[temp2];
if (((temp2.mc._x != undefined) && (temp2.state == "thrown")) && ((temp2.hitTarget == 1) || (temp2.hitTarget == 3))) {
if (Math.abs(temp2.mc._x - p1.mc._x) < 200) {
if (p1.deflecting > 0) {
if (p1.mc.mcMC.mcHit.hitTest(temp2.mc._x, temp2.mc._y, true)) {
p1_projectileDeflect();
}
} else if (p1.mc.mcHit.hitTest(temp2.mc._x, temp2.mc._y, true)) {
p1_projectileHit();
}
}
}
temp++;
}
if (p1.whacking == 2) {
p1_whack();
} else if (p1.whacking == 1) {
p1_staffAttack();
} else if ((p1.whacking == 3) && (p1.attackHold <= 0)) {
p1.whacking = 0;
}
if ((Key.isDown(p1.keyFast) && (p1.yVel == 0)) && (p1.attackHold <= 0)) {
p1.fastPressed = true;
p1.trans = null;
if (p1.mc._xscale > 0) {
if (Key.isDown(p1.keyRight)) {
if ((!p1.rightPressed) || (p1.xSpec <= 0)) {
p1_dashStartRight();
}
p1.rightPressed = true;
} else {
p1.rightPressed = false;
}
} else if (p1.mc._xscale < 0) {
if (Key.isDown(p1.keyLeft)) {
if ((!p1.leftPressed) || (p1.xSpec <= 0)) {
p1_dashStartLeft();
}
p1.leftPressed = true;
} else {
p1.leftPressed = false;
}
}
} else {
p1.fastPressed = false;
}
if (Key.isDown(p1.keyAttack)) {
if ((!p1.attackPressed) && (p1.attackHold <= 0)) {
p1.attackPressed = true;
p1_attacks();
}
} else {
p1.attackPressed = false;
}
if ((Key.isDown(p1.keyGrab) && (p1.attackHold <= 0)) && (p1.xSpec <= 0)) {
if ((!p1.grabPressed) && (p1.holdName != null)) {
if (p1.windup < xThrowMax) {
p1.windup++;
}
if (p1.yVel == 0) {
if (Key.isDown(p1.keyDown1)) {
} else if (Key.isDown(p1.keyRight) || (Key.isDown(p1.keyLeft))) {
if (p1.xVel == 0) {
p1.mc.gotoAndStop("throwWalkWindup");
}
} else if (p1.animHoldIdle <= 0) {
p1.mc.gotoAndStop("throwIdleWindup");
p1.mc.mcMC.gotoAndStop(p1.windup);
}
}
} else if ((!p1.grabPressed) && (p1.grabCount <= 0)) {
p1.grabPressed = true;
p1_grab();
}
} else if (((p1.windup > 0) && (p1.holdName != null)) && (p1.attackHold <= 0)) {
p1_throw();
} else {
p1.grabPressed = false;
}
if ((p1.attackHold <= 0) && (p1.xSpec <= 0)) {
if (Key.isDown(p1.keyLeft)) {
if (mapHit.hitTest(p1.mc._x, p1.mc._y + (gravity * 2), true)) {
if (Key.isDown(p1.keyDown1)) {
p1_crouchWalkLeft();
} else {
p1_walkLeft();
}
} else {
p1_hitWallLeft();
}
} else if (Key.isDown(p1.keyRight)) {
if (mapHit.hitTest(p1.mc._x, p1.mc._y + (gravity * 2), true)) {
if (Key.isDown(p1.keyDown1)) {
p1_crouchWalkRight();
} else {
p1_walkRight();
}
} else {
p1_hitWallRight();
}
} else if (p1.xSpec <= 0) {
p1_idle();
}
} else if (p1.xVel != 0) {
if ((p1.dashHold > 0) && (p1.dashHold < 4)) {
p1_dash();
} else if (p1.dashHold > 0) {
if ((!mapHit.hitTest(p1.mc._x + p1.xVel, p1.mc._y - 9, true)) && (mapHit.hitTest(p1.mc._x + p1.xVel, p1.mc._y, true))) {
playerUpHill();
}
}
}
if (p1.xSpec <= 0) {
if (p1.yVel != 0) {
if (p1.xVel > p1.xAirMax) {
p1.xVel = p1.xAirMax + ((p1.xAirMax - p1.xVel) / 8);
} else if (p1.xVel < (-p1.xAirMax)) {
p1.xVel = (-p1.xAirMax) + ((p1.xVel + p1.xAirMax) / 8);
}
} else if (Key.isDown(p1.keyDown1) && (p1.yVel == 0)) {
if (p1.xVel > p1.xCrouchMax) {
p1.xVel = p1.xCrouchMax + ((p1.xCrouchMax - p1.xVel) / 8);
} else if (p1.xVel < (-p1.xCrouchMax)) {
p1.xVel = (-p1.xCrouchMax) + ((p1.xVel + p1.xCrouchMax) / 8);
}
} else if (p1.xVel > p1.xMax) {
p1.xVel = p1.xMax + ((p1.xMax - p1.xVel) / 8);
} else if (p1.xVel < (-p1.xMax)) {
p1.xVel = (-p1.xMax) + ((p1.xVel + p1.xMax) / 8);
}
}
if (p1.xVel != 0) {
p1_xFinalCheck();
}
p1.mc._x = p1.mc._x + p1.xVel;
if ((p1.xVel != 0) && (((!Key.isDown(p1.keyLeft)) && (!Key.isDown(p1.keyRight))) || (p1.attackHold > 0))) {
if ((!mapHit.hitTest(p1.mc._x, p1.mc._y, true)) && (mapHit.hitTest(p1.mc._x, p1.mc._y + (gravity * 8), true))) {
p1_slideDownhill();
}
}
if (!mapHit.hitTest(p1.mc._x, (p1.mc._y + gravity) + p1.yVel, true)) {
p1_fall();
} else {
p1_hitGround();
}
if ((Key.isDown(p1.keyJump) && (p1.state == "normal")) && (p1.attackHold <= 0)) {
p1_jump();
} else if (p1.yVel == 0) {
p1.jumpPressed = false;
p1.doubleJumped = false;
} else {
p1.dJumpOK = true;
}
if (p1.headbouncing == 2) {
p1_headbounce_Step2();
}
if (p1.yVel < 0) {
p1_ceilingCheck();
}
if (p1.ySpec <= 0) {
if (p1.yVel > p1.yMax) {
p1.yVel = p1.yMax;
} else if (p1.yVel < (-p1.yMax)) {
p1.yVel = -p1.yMax;
}
}
p1.mc._y = p1.mc._y + p1.yVel;
}
function ground_Grabbing() {
if (Key.isDown(p1.keyGrab)) {
if (!p1.grabPressed) {
p1.grabPressed = true;
if ((p1.holdName != null) && (p1.attackHold <= 0)) {
if (p1.yVel == 0) {
if (Key.isDown(p1.keyRight)) {
if (p1.mc._xscale > 0) {
p1_throwEnemyWalk();
} else {
p1_chokeEnemy();
}
} else if (Key.isDown(p1.keyLeft)) {
if (p1.mc._xscale < 0) {
p1_throwEnemyWalk();
} else {
p1_chokeEnemy();
}
} else {
p1_throwEnemyIdle();
}
}
if (p1.mc._xscale < 0) {
p1.holdName.xVel = -p1.holdName.xVel;
}
p1.grabPressed = true;
p1.grabCount = 0;
p1.windup = 0;
p1.state = "normal";
}
}
} else {
p1.grabPressed = false;
}
if (p1.state == "grabbing") {
if (p1.grabCount <= 0) {
if ((p1.attackHold <= 0) && (p1.xSpec <= 0)) {
if (Key.isDown(p1.keyLeft)) {
p1_grabbingWalkLeft();
} else if (Key.isDown(p1.keyRight)) {
p1_grabbingWalkRight();
} else if (p1.xSpec <= 0) {
p1_grabbingIdle();
}
}
}
if (p1.xVel != 0) {
p1_xFinalCheck();
}
p1.mc._x = p1.mc._x + p1.xVel;
if ((p1.xVel != 0) && (((!Key.isDown(p1.keyLeft)) && (!Key.isDown(p1.keyRight))) || (p1.attackHold > 0))) {
if ((!mapHit.hitTest(p1.mc._x, p1.mc._y, true)) && (mapHit.hitTest(p1.mc._x, p1.mc._y + (gravity * 8), true))) {
p1_slideDownhill();
}
}
if (!mapHit.hitTest(p1.mc._x, (p1.mc._y + gravity) + p1.yVel, true)) {
if (p1.ySpec <= 0) {
p1.yVel = p1.yVel + gravity;
if (p1.yVel > gravity) {
p1.jumping = false;
}
}
if ((p1.grabCount <= 0) && (p1.animHoldAir <= 0)) {
p1.mc.gotoAndStop("fall");
p1.jumpPressed = true;
p1.animHoldAir = 16;
}
if (p1.yVel > 0) {
p1.fallTime++;
}
} else {
p1_hitGround();
}
if (p1.ySpec <= 0) {
if (p1.yVel > p1.yMax) {
p1.yVel = p1.yMax;
} else if (p1.yVel < (-p1.yMax)) {
p1.yVel = -p1.yMax;
}
}
p1.mc._y = p1.mc._y + p1.yVel;
}
}
function ground_Stuck() {
if (Key.isDown(p1.keyJump)) {
if (!p1.jumpPressed) {
p1.jumpPressed = true;
if (!mapHit.hitTest(p1.mc._x, p1.mc._y + 10, true)) {
p1.mc.gotoAndStop("stuckDrop");
p1.animHoldAir = 4;
p1.state = "normal";
soundWink.stop();
soundWink.attachSound("s_stickOFF");
soundWink.start(0, 0);
soundWink.setPan(Math.ceil(((p1.mc._x - mcCam._x) / 400) * 100));
}
}
} else {
p1.jumpPressed = false;
}
temp = gravity;
while (mapHit.hitTest(p1.mc._x, (p1.mc._y - 40) + temp, true)) {
p1.mc._y = p1.mc._y + gravity;
temp = temp + gravity;
}
if (mapHit.hitTest(p1.mc._x, p1.mc._y - 6, true)) {
p1.mc.gotoAndStop("thrown");
p1.state = "thrown";
if (p1.mc._xscale > 0) {
p1.xVel = 10;
} else {
p1.xVel = -10;
}
}
if (p1.state == "stuck") {
soundWink.setVolume(90);
if (Key.isDown(p1.keyLeft)) {
if (((p1.grabCount <= 0) && (p1.windup <= 0)) && (p1.animHoldWalk <= 0)) {
}
temp = p1.xVel - p1.xAcc;
if (temp < (-p1.xStuckMax)) {
temp = -p1.xStuckMax;
}
if ((!mapHit.hitTest((p1.mc._x - 10) + temp, (p1.mc._y - p1.head) + 10, true)) && (mapHit.hitTest((p1.mc._x - 10) + temp, (p1.mc._y - p1.head) - 10, true))) {
p1.xVel = temp;
if (p1.mc._xscale < 0) {
p1.mc.gotoAndStop("stuckWalkF");
} else {
p1.mc.gotoAndStop("stuckWalkB");
}
p1.trans = "walk";
if (soundWinkDone) {
if (Math.random() > 0.5) {
soundWink.attachSound("s_stickA");
} else {
soundWink.attachSound("s_stickB");
}
soundWink.start(0, 0);
soundWinkDone = false;
}
soundWink.setPan(Math.ceil(((p1.mc._x - mcCam._x) / 400) * 100));
} else {
p1.xVel = 0;
if (p1.trans == "walk") {
p1.trans = null;
p1.mc.gotoAndStop("stuck1");
p1.animHoldIdle = 4;
} else {
p1.mc.gotoAndStop("stuck");
}
}
} else if (Key.isDown(p1.keyRight)) {
if (((p1.grabCount <= 0) && (p1.windup <= 0)) && (p1.animHoldWalk <= 0)) {
}
temp = p1.xVel + p1.xAcc;
if (temp > p1.xStuckMax) {
temp = p1.xStuckMax;
}
if ((!mapHit.hitTest((p1.mc._x + 10) + temp, (p1.mc._y - p1.head) + 10, true)) && (mapHit.hitTest((p1.mc._x + 10) + temp, (p1.mc._y - p1.head) - 10, true))) {
p1.xVel = temp;
if (p1.mc._xscale > 0) {
p1.mc.gotoAndStop("stuckWalkF");
} else {
p1.mc.gotoAndStop("stuckWalkB");
}
p1.trans = "walk";
if (soundWinkDone) {
if (Math.random() > 0.5) {
soundWink.attachSound("s_stickA");
} else {
soundWink.attachSound("s_stickB");
}
soundWink.start(0, 0);
soundWinkDone = false;
}
soundWink.setPan(Math.ceil(((p1.mc._x - mcCam._x) / 400) * 100));
} else {
p1.xVel = 0;
if (p1.trans == "walk") {
p1.trans = null;
p1.mc.gotoAndStop("stuck1");
p1.animHoldIdle = 4;
} else {
p1.mc.gotoAndStop("stuck");
}
}
} else {
if (p1.animHoldIdle <= 0) {
if (p1.trans != null) {
p1.trans = null;
p1.mc.gotoAndStop("stuck1");
p1.animHoldIdle = 4;
} else {
p1.mc.gotoAndStop("stuck");
}
}
if (p1.xVel > 0) {
p1.xVel = p1.xVel + ((-p1.xAcc) * 2);
if (p1.xVel <= 0.7) {
p1.xVel = 0;
soundWink.stop();
soundWinkDone = true;
}
} else if (p1.xVel < 0) {
p1.xVel = p1.xVel + (p1.xAcc * 2);
if (p1.xVel >= -0.7) {
p1.xVel = 0;
soundWink.stop();
soundWinkDone = true;
}
}
}
p1.mc._x = p1.mc._x + p1.xVel;
if (!mapHit.hitTest((p1.mc._x + 10) + temp, (p1.mc._y - p1.head) + 15, true)) {
p1.mc._y = p1.mc._y + (-gravity);
}
}
}
function ground_Thrown() {
if (p1.xVel > 0) {
if (p1.yVel != 0) {
p1.xVel = p1.xVel / frictionAir;
} else {
p1.xVel = p1.xVel / friction;
}
if (p1.xVel <= 0.3) {
p1.xVel = 0;
}
} else if (p1.xVel < 0) {
if (p1.yVel != 0) {
p1.xVel = p1.xVel / frictionAir;
} else {
p1.xVel = p1.xVel / friction;
}
if (p1.xVel >= -0.3) {
p1.xVel = 0;
}
}
if (p1.xVel != 0) {
if (mapHit.hitTest(p1.mc._x + p1.xVel, p1.mc._y - (gravity * 2), true)) {
if (p1.xVel > 0) {
temp = p1.xVel - p1.xAcc;
enemyBounceRight(p1, temp);
} else {
temp = p1.xVel + p1.xAcc;
enemyBounceLeft(p1, temp);
}
if (Math.abs(p1.xVel) <= 0.3) {
p1.xVel = 0;
}
} else if (p1.xVel > p1.xMax) {
if (mapHit.hitTest(p1.mc._x + (p1.xVel / 2), p1.mc._y - (gravity * 2), true)) {
temp = (p1.xVel / 2) - p1.xAcc;
enemyBounceRight(p1, temp);
} else if (mapHit.hitTest(p1.mc._x, p1.mc._y - (gravity * 2), true)) {
temp = -p1.xAcc;
enemyBounceRight(p1, temp);
}
} else if (p1.xVel < (-p1.xMax)) {
if (mapHit.hitTest(p1.mc._x + (p1.xVel / 2), p1.mc._y - (gravity * 2), true)) {
temp = (p1.xVel / 2) + p1.xAcc;
enemyBounceLeft(p1, temp);
} else if (mapHit.hitTest(p1.mc._x, p1.mc._y - (gravity * 2), true)) {
temp = p1.xAcc;
enemyBounceLeft(p1, temp);
}
}
}
p1.mc._x = p1.mc._x + p1.xVel;
if (p1.xVel != 0) {
if ((!mapHit.hitTest(p1.mc._x, p1.mc._y, true)) && (mapHit.hitTest(p1.mc._x, p1.mc._y + (gravity * 8), true))) {
p1_slideDownhill();
}
}
if (p1.yVel > p1.yMax) {
p1.yVel = p1.yMax;
}
if (!mapHit.hitTest(p1.mc._x, (p1.mc._y + gravity) + p1.yVel, true)) {
if ((Math.abs(p1.xVel) > 20) || (Math.abs(p1.yVel) > 12)) {
p1.mc.gotoAndStop("thrownBlur");
} else {
p1.mc.gotoAndStop("thrown");
}
if (p1.yVel > 20) {
if (!mapHit.hitTest(p1.mc._x, (p1.mc._y + gravity) + (p1.yVel / 2), true)) {
p1.yVel = p1.yVel + gravity;
if (p1.yVel > gravity) {
p1.jumping = false;
}
if (!p1.jumping) {
}
} else {
actorHitGround(p1);
p1._y = p1._y + (-gravity);
}
} else {
p1.yVel = p1.yVel + gravity;
if (p1.yVel > gravity) {
p1.jumping = false;
}
if (!p1.jumping) {
}
}
} else {
actorHitGround(p1);
p1.mc.gotoAndStop("bouncing");
if (p1.xVel == 0) {
if (!mapHit.hitTest(p1.mc._x - 10, p1.mc._y + 3, true)) {
p1.xVel = p1.yVel * 2;
} else if (!mapHit.hitTest(p1.mc._x - 20, p1.mc._y + 3, true)) {
p1.xVel = p1.yVel;
} else if (!mapHit.hitTest(p1.mc._x - 40, p1.mc._y + 3, true)) {
p1.xVel = p1.yVel / 2;
} else if (!mapHit.hitTest(p1.mc._x + 10, p1.mc._y + 3, true)) {
p1.xVel = (-p1.yVel) * 2;
} else if (!mapHit.hitTest(p1.mc._x + 20, p1.mc._y + 3, true)) {
p1.xVel = -p1.yVel;
} else if (!mapHit.hitTest(p1.mc._x + 40, p1.mc._y + 3, true)) {
p1.xVel = (-p1.yVel) / 2;
}
if (soundWinkDone) {
soundWink.attachSound("s_winkhit2");
soundWink.start(0, 0);
soundWink.setPan(Math.ceil(((p1.mc._x - mcCam._x) / 400) * 100));
soundWinkDone = false;
}
}
}
if (p1.yVel < 0) {
if (mapHit.hitTest(p1.mc._x, (p1.mc._y - p1.head) + p1.yVel, true)) {
temp = p1.yVel + gravity;
p1.mc._y = p1.mc._y + temp;
p1.yVel = 0.001;
while (mapHit.hitTest(p1.mc._x, (p1.mc._y - p1.head) + temp, true)) {
p1.mc._y = p1.mc._y + gravity;
temp = temp + gravity;
}
}
}
p1.mc._y = p1.mc._y + p1.yVel;
if ((p1.xVel == 0) && (p1.yVel == 0)) {
if (thrownName == p1) {
thrownName = null;
}
p1.state = "down";
} else {
p1.downCount = 5;
}
}
function ground_Down() {
p1.downTime--;
p1.gotoAndStop("down");
if (p1.downTime <= 0) {
p1.state = "normal";
p1.trans = null;
p1.mc.gotoAndStop("getup");
p1.animHoldIdle = 11;
p1.attackHold = 10;
}
}
function playerUpHill() {
if (p1.xVel > 0) {
temp = gravity;
while (mapHit.hitTest(p1.mc._x + p1.xVel, p1.mc._y - temp, true)) {
temp = temp + gravity;
}
if (p1.xVel < p1.xAcc) {
p1.xVel = p1.xAcc;
}
p1.mc._y = p1.mc._y + ((-temp) + gravity);
p1.yVel = 0;
} else {
temp = gravity;
while (mapHit.hitTest(p1.mc._x + p1.xVel, p1.mc._y - temp, true)) {
temp = temp + gravity;
}
if (p1.xVel > (-p1.xAcc)) {
p1.xVel = -p1.xAcc;
}
p1.mc._y = p1.mc._y + ((-temp) + gravity);
p1.yVel = 0;
}
}
function p1_headbounce_Step2() {
with (p1) {
headbouncing = 0;
if (!bounced) {
bounced = true;
yVel = -11;
} else {
yVel = -17;
}
jumping = true;
jumpPressed = true;
mc.gotoAndStop("headbounceUp");
p1.animHoldAir = 17;
}
}
function p1_ceilingCheck() {
if (mapHit.hitTest(p1.mc._x, (p1.mc._y - p1.head) + p1.yVel, true)) {
temp = p1.yVel + gravity;
p1.mc._y = p1.mc._y + temp;
p1.yVel = 0.001;
while (mapHit.hitTest(p1.mc._x, (p1.mc._y - p1.head) + temp, true)) {
p1.mc._y = p1.mc._y + gravity;
temp = temp + gravity;
if (mapHit.hitTest(p1.mc._x, p1.mc._y + gravity, true)) {
if (mapHit.hitTest(p1.mc._x - 50, p1.mc._y, true)) {
p1.mc._x = p1.mc._x + 50;
} else {
p1.mc._x = p1.mc._x + -50;
}
}
}
if (mapHit.hitTest(p1.mc._x + p1.xVel, p1.mc._y + 20, true)) {
p1.mc._x = p1.mc._x + (-p1.xVel);
p1.xVel = 0;
}
}
}
function p1_projectileDeflect() {
var _local1 = this;
if (temp2.projType == "fireball") {
temp2.xVel = (-temp2.xVel) * 2;
temp2.mc._xscale = -temp2.mc._xscale;
temp2.hitTarget = 2;
makeFX("fire", (temp2.mc._x - 16) + (Math.random() * 32), (temp2.mc._y - 8) + (Math.random() * 16));
makeFX("fire", (temp2.mc._x - 16) + (Math.random() * 32), (temp2.mc._y - 8) + (Math.random() * 16));
} else if (temp2.projType == "wind") {
temp2.xVel = (-temp2.xVel) * 2;
temp2.mc._xscale = -temp2.mc._xscale;
temp2.mc._rotation = -temp2.mc._rotation;
temp2.hitTarget = 2;
} else if (temp2.projType == "lightning") {
temp2.xVel = 0;
temp2.yVel = 0;
temp2.mc.gotoAndStop("deflected");
temp2.state = "hit";
temp2.phaseCount = 14;
temp2.mc._rotation = 0;
var _local2 = projectiles;
i = 1;
while (i <= projectiles) {
j = "proj_" + i;
if ((!_local1[j].mc._visible) || (_local1[j].mc == undefined)) {
_local2 = i;
break;
}
i++;
}
mcAll.mcMain.attachMovie("lightning", "proj_mc_" + _local2, projectileDepth + _local2, {_x:x, _y:y});
_local1["proj_" + _local2] = new projectile(mcAll.mcMain["proj_mc_" + _local2], "lightning", 2);
temp2 = _local1["proj_" + _local2];
temp2.life = 10;
temp2.xVel = 15;
temp2.mc._x = temp2.mc._x + 20;
temp2.mc._rotation = Math.random() * 180;
temp2.mc.gotoAndStop("idle2");
i = i + 1;
while (i <= projectiles) {
j = "proj_" + i;
if ((!_local1[j].mc._visible) || (_local1[j].mc == undefined)) {
_local2 = i;
break;
}
i++;
}
mcAll.mcMain.attachMovie("lightning", "proj_mc_" + _local2, projectileDepth + _local2, {_x:x, _y:y});
_local1["proj_" + _local2] = new projectile(mcAll.mcMain["proj_mc_" + _local2], "lightning", 2);
temp2 = _local1["proj_" + _local2];
temp2.life = 10;
temp2.xVel = -15;
temp2.mc._x = temp2.mc._x + -20;
temp2.mc._rotation = Math.random() * 180;
temp2.mc.gotoAndStop("idle2");
i = i + 1;
while (i <= projectiles) {
j = "proj_" + i;
if ((!_local1[j].mc._visible) || (_local1[j].mc == undefined)) {
_local2 = i;
break;
}
i++;
}
mcAll.mcMain.attachMovie("lightning", "proj_mc_" + _local2, projectileDepth + _local2, {_x:x, _y:y});
_local1["proj_" + _local2] = new projectile(mcAll.mcMain["proj_mc_" + _local2], "lightning", 2);
temp2 = _local1["proj_" + _local2];
temp2.life = 7;
if (p1.mc._xscale < 0) {
temp2.xVel = -15;
temp2.mc._x = temp2.mc._x + -165;
} else {
temp2.xVel = 15;
temp2.mc._x = temp2.mc._x + 165;
}
temp2.mc._rotation = Math.random() * 180;
temp2.mc.gotoAndStop("idle2");
}
}
function p1_projectileHit() {
p1.xVel = temp2.xVel;
if (p1.xVel > 0) {
p1.xVel = p1.xVel + (Math.random() * 4);
} else {
p1.xVel = p1.xVel + (Math.random() * -4);
}
p1.yVel = (Math.random() * -6) - 8;
p1.state = "thrown";
p1.mc.gotoAndStop("thrown");
p1.trans = null;
if (p1.holdName != null) {
p1.holdName.state = "thrown";
p1.holdName.mc._rotation = 0;
p1.holdName.xVel = (Math.random() * 10) + p1.xVel;
p1.holdName.yVel = (Math.random() * -6) - 10;
p1.holdName.grabbedName = null;
p1.holdName = null;
p1.grabCount = 0;
}
if (temp2.projType == "fireball") {
temp2.state = "hit";
temp2.mc.gotoAndStop("hit");
temp2.phaseCount = -123;
makeFX("fire", (temp2.mc._x - 16) + (Math.random() * 32), (temp2.mc._y - 8) + (Math.random() * 16));
makeFX("fire", (temp2.mc._x - 16) + (Math.random() * 32), (temp2.mc._y - 8) + (Math.random() * 16));
soundWink.attachSound("s_winkhit2");
soundWink.start(0, 0);
soundWink.setPan(Math.ceil(((p1.mc._x - mcCam._x) / 400) * 100));
soundWinkDone = true;
} else if (temp2.projType == "wind") {
temp2.state = "hit";
temp2.mc.gotoAndStop("hit");
temp2.phaseCount = -123;
soundWink.attachSound("s_winkhit2");
soundWink.start(0, 0);
soundWink.setPan(Math.ceil(((p1.mc._x - mcCam._x) / 400) * 100));
soundWinkDone = true;
} else if (temp2.projType == "lightning") {
temp2.state = "hit";
temp2.mc.gotoAndStop("hit");
temp2.phaseCount = -123;
soundFX.attachSound("s_lightninghit");
soundFX.start(0, 0);
soundFX.setPan(Math.ceil(((p1.mc._x - mcCam._x) / 400) * 100));
}
}
function p1_whack() {
p1.whacking = 3;
p1.trans = null;
p1.mc.gotoAndStop("staffMelee");
p1.animholdIdle = 20;
p1.attackHold = 18;
}
function p1_staffAttack() {
p1.whacking = 0;
p1.trans = null;
p1.mc.gotoAndStop("staffAttack3");
p1.animholdIdle = 14;
p1.attackHold = 13;
staffAttack(p1.holdName, 3, 2, -123);
}
function p1_attacks() {
temp = p1.holdName.mc._name.substring(0, 5);
if (p1.yVel == 0) {
if (temp == "staff") {
if (p1.dashHold < 0) {
if (Key.isDown(p1.keyUp1)) {
p1.xVel = 0;
p1.trans = null;
if (Key.isDown(p1.keyLeft) || (Key.isDown(p1.keyRight))) {
p1.mc.gotoAndStop("staffAttack3");
p1.attackHold = 14;
staffAttack(p1.holdName, 2, 2, -123);
} else {
p1.mc.gotoAndStop("staffAttack1");
p1.attackHold = 14;
staffAttack(p1.holdName, 1, 2, -123);
}
} else if (((p1.mc._xscale > 0) && (Key.isDown(p1.keyRight))) || (((p1.mc._xscale < 0) && (Key.isDown(p1.keyLeft))) && (!Key.isDown(p1.keyDown1)))) {
p1.xVel = 0;
p1.mc.gotoAndStop("staffDeflect");
p1.animHoldIdle = 13;
p1.attackHold = 12;
p1.deflecting = 12;
p1.trans = null;
soundWink.attachSound("s_deflect");
soundWink.start(0, 0);
soundWink.setPan(Math.ceil(((p1.mc._x - mcCam._x) / 400) * 100));
} else {
p1.xVel = 0;
p1.whacking = 1;
}
}
}
} else if (temp == "staff") {
if (Key.isDown(p1.keyDown1)) {
if (Key.isDown(p1.keyLeft) || (Key.isDown(p1.keyRight))) {
p1.mc.gotoAndStop("staffAttackAir3");
p1.attackHold = 14;
p1.animHoldAir = 14;
staffAttack(p1.holdName, 4, 2, -123);
} else {
p1.mc.gotoAndStop("staffAttackAir5");
p1.attackHold = 14;
p1.animHoldAir = 14;
staffAttack(p1.holdName, 5, 2, -123);
}
} else if (Key.isDown(p1.keyUp1)) {
if (Key.isDown(p1.keyLeft) || (Key.isDown(p1.keyRight))) {
p1.mc.gotoAndStop("staffAttackAir3");
p1.attackHold = 14;
p1.animHoldAir = 14;
staffAttack(p1.holdName, 2, 2, -123);
} else {
p1.mc.gotoAndStop("staffAttackAir1");
p1.attackHold = 14;
p1.animHoldAir = 14;
staffAttack(p1.holdName, 1, 2, -123);
}
} else {
p1.mc.gotoAndStop("staffAttackAir3");
p1.attackHold = 14;
p1.animHoldAir = 14;
staffAttack(p1.holdName, 3, 2, -123);
}
}
}
function p1_dashStartRight() {
with (p1) {
dashCount = 0;
dashHold = 9;
xVel = dashVel;
mc.gotoAndStop("dashStart");
xSpec = 9;
animHoldWalk = 9;
animHoldIdle = 9;
soundWink.attachSound("s_run");
soundWink.start(0, 0);
soundWink.setPan(Math.ceil(((p1.mc._x - mcCam._x) / 400) * 100));
soundWink.setVolume(80);
soundWinkDone = false;
}
}
function p1_dashStartLeft() {
with (p1) {
dashCount = 0;
dashHold = 9;
xVel = -dashVel;
mc.gotoAndStop("dashStart");
xSpec = 9;
animHoldWalk = 9;
animHoldIdle = 9;
soundWink.attachSound("s_run");
soundWink.start(0, 0);
soundWink.setPan(Math.ceil(((p1.mc._x - mcCam._x) / 400) * 100));
soundWink.setVolume(80);
soundWinkDone = false;
}
}
function p1_grab() {
p1.grabCount = 10;
if (p1.yVel != 0) {
p1.mc.gotoAndStop("grabAir");
} else if (Key.isDown(p1.keyDown1)) {
p1.xVel = 0;
p1.mc.gotoAndStop("grabCrouch");
} else if (Key.isDown(p1.keyRight) || (Key.isDown(p1.keyLeft))) {
p1.grabCount = 10;
p1.xVel = 0;
p1.mc.gotoAndStop("grabWalk");
p1.attackHold = 14;
p1.animHoldIdle = 24;
p1.trans = null;
} else {
p1.grabCount = 10;
p1.xVel = 0;
p1.mc.gotoAndStop("grabIdle");
p1.attackHold = 14;
p1.animHoldIdle = 24;
}
}
function p1_throw() {
if (p1.yVel == 0) {
if (Key.isDown(p1.keyUp1)) {
if (Key.isDown(p1.keyRight) || (Key.isDown(p1.keyLeft))) {
p1.holdName.xVel = p1.windup + 10;
p1.holdName.yVel = (-p1.windup) - 10;
if (p1.holdName.yVel < (-yThrowMax)) {
p1.holdName.yVel = -yThrowMax;
}
p1.mc.gotoAndStop("throwWalk2");
p1.animHoldWalk = 7;
} else {
p1.holdName.xVel = 0;
p1.holdName.yVel = (-p1.windup) - 15;
if (p1.holdName.yVel < (-yThrowMax)) {
p1.holdName.yVel = -yThrowMax;
}
p1.mc.gotoAndStop("throwIdle1");
p1.animHoldIdle = 7;
}
} else if (Key.isDown(p1.keyRight) || (Key.isDown(p1.keyLeft))) {
if (Key.isDown(p1.keyDown1)) {
p1.holdName.xVel = p1.windup + 10;
p1.holdName.yVel = p1.windup + 10;
if (p1.holdName.yVel > yThrowMax) {
p1.holdName.yVel = yThrowMax;
}
p1.mc.gotoAndStop("throwCrouch");
p1.animHoldCrouch = 11;
} else {
p1.xVel = 0;
p1.xSpec = 12;
p1.holdName.xVel = p1.windup + 20;
p1.holdName.yVel = (-p1.windup) / 4;
p1.mc.gotoAndStop("throwWalk3");
p1.animHoldWalk = 16;
}
} else if (Key.isDown(p1.keyDown1)) {
if (mapHit.hitTest(p1.holdName.mc._x, p1.holdName.mc._y - gravity, true)) {
p1.holdName.mc._x = p1.mc._x;
}
p1.holdName.xVel = 0;
p1.holdName.yVel = p1.windup;
p1.mc.gotoAndStop("throwCrouch");
p1.animHoldCrouch = 11;
} else {
p1.holdName.xVel = p1.windup + 8;
p1.holdName.yVel = (-p1.windup) / 4;
if (p1.windup > 4) {
p1.mc.gotoAndStop("throwIdle3");
p1.animHoldIdle = 16;
} else {
p1.mc.gotoAndStop("throwIdle3b");
p1.animHoldIdle = 10;
}
if (mapHit.hitTest(p1.holdName.mc._x, p1.holdName.mc._y - gravity, true)) {
p1.holdName.mc._x = p1.mc._x;
}
}
} else if (Key.isDown(p1.keyRight) || (Key.isDown(p1.keyLeft))) {
if (Key.isDown(p1.keyUp1)) {
p1.holdName.xVel = p1.windup + 10;
p1.holdName.yVel = (-p1.windup) - 10;
if (p1.holdName.yVel < (-yThrowMax)) {
p1.holdName.yVel = -yThrowMax;
p1.mc.gotoAndStop("throwAir2");
p1.animHoldAir = 12;
}
} else if (Key.isDown(p1.keyDown1)) {
p1.holdName.xVel = p1.windup + 10;
p1.holdName.yVel = p1.windup + 10;
p1.holdName.yVel = yThrowMax;
p1.mc.gotoAndStop("throwAir4");
p1.animHoldAir = 14;
} else {
p1.holdName.xVel = p1.windup + 10;
p1.holdName.yVel = (-p1.windup) / 4;
p1.mc.gotoAndStop("throwAir3");
p1.animHoldAir = 12;
}
} else if (Key.isDown(p1.keyUp1)) {
p1.holdName.xVel = 0;
p1.holdName.yVel = (-p1.windup) - 15;
if (p1.holdName.yVel < (-yThrowMax)) {
p1.holdName.yVel = -yThrowMax;
}
p1.mc.gotoAndStop("throwAir1");
p1.animHoldAir = 7;
} else if (Key.isDown(p1.keyDown1)) {
p1.holdName.xVel = 0;
p1.holdName.yVel = p1.windup + 10;
if (p1.holdName.yVel > yThrowMax) {
p1.holdName.yVel = yThrowMax;
}
p1.mc.gotoAndStop("throwAir5");
p1.animHoldAir = 15;
} else {
p1.holdName.xVel = p1.windup + 8;
p1.holdName.yVel = (-p1.windup) / 4;
p1.mc.gotoAndStop("throwAir3");
p1.animHoldAir = 7;
}
if (p1.mc._xscale < 0) {
p1.holdName.xVel = -p1.holdName.xVel;
}
p1.holdName.state = "thrown";
p1.holdName.mc._rotation = 0;
p1.grabPressed = false;
thrownName = p1.holdName;
p1.holdName.grabbedName = null;
p1.holdName = null;
p1.grabCount = 0;
p1.windup = 0;
}
function p1_crouchWalkLeft() {
p1.crouchMoved = true;
p1.crouched = false;
if (((p1.grabCount <= 0) && (p1.windup <= 0)) && (p1.animHoldCrouch <= 0)) {
p1.mc.gotoAndStop("crouchWalk");
p1.trans = "walk";
}
p1.mc._xscale = -100;
temp = p1.xVel - p1.xAcc;
if (temp < (-p1.xCrouchMax)) {
temp = -p1.xCrouchMax;
}
if ((!mapHit.hitTest(p1.mc._x + temp, p1.mc._y, true)) && (mapHit.hitTest(p1.mc._x + temp, p1.mc._y + (gravity * 8), true))) {
p1.xVel = temp;
p1.mc._y = p1.mc._y + gravity;
temp = 0;
while ((temp < (gravity * 8)) && (!mapHit.hitTest(p1.mc._x + p1.xVel, p1.mc._y + temp, true))) {
temp = temp + gravity;
}
p1.mc._y = p1.mc._y + temp;
} else if ((!mapHit.hitTest(p1.mc._x + temp, p1.mc._y - gravity, true)) && (mapHit.hitTest((p1.mc._x - p1.xAcc) + temp, p1.mc._y + gravity, true))) {
p1.xVel = temp;
} else if ((!mapHit.hitTest(p1.mc._x + temp, p1.mc._y - 9, true)) && (mapHit.hitTest((p1.mc._x - p1.xAcc) + temp, p1.mc._y + gravity, true))) {
p1.xVel = temp;
temp = gravity * 2;
while (mapHit.hitTest(p1.mc._x + p1.xVel, p1.mc._y - temp, true)) {
temp = temp + gravity;
}
if (p1.xVel > (-p1.xAcc)) {
p1.xVel = -p1.xAcc;
}
p1.mc._y = p1.mc._y + ((-temp) + gravity);
p1.yVel = 0;
} else {
if (mapHit.hitTest(p1.mc._x + p1.xVel, p1.mc._y - gravity, true)) {
temp = p1.xVel + p1.xAcc;
do {
if (!mapHit.hitTest(p1.mc._x + temp, p1.mc._y - gravity, true)) {
break;
}
temp = temp + p1.xAcc;
} while (temp <= 0);
p1.mc._x = p1.mc._x + temp;
}
p1.xVel = 0;
}
}
function p1_walkLeft() {
if (((p1.grabCount <= 0) && (p1.windup <= 0)) && (p1.animHoldWalk <= 0)) {
if (p1.mc._xscale > 0) {
p1.mc.gotoAndStop("turn");
p1.animHoldIdle = 2;
p1.animHoldWalk = 2;
p1.trans = null;
} else {
p1.mc.gotoAndStop("walk");
p1.trans = "walk";
}
}
p1.mc._xscale = -100;
temp = p1.xVel - p1.xAcc;
if (temp < (-p1.xWalkMax)) {
temp = -p1.xWalkMax;
}
if ((!mapHit.hitTest(p1.mc._x + temp, p1.mc._y, true)) && (mapHit.hitTest(p1.mc._x + temp, p1.mc._y + (gravity * 8), true))) {
p1.xVel = temp;
p1.mc._y = p1.mc._y + gravity;
temp = 0;
while ((temp < (gravity * 8)) && (!mapHit.hitTest(p1.mc._x + p1.xVel, p1.mc._y + temp, true))) {
temp = temp + gravity;
}
p1.mc._y = p1.mc._y + temp;
} else if (!mapHit.hitTest(p1.mc._x + temp, p1.mc._y - gravity, true)) {
p1.xVel = temp;
} else if (!mapHit.hitTest(p1.mc._x + temp, p1.mc._y - 9, true)) {
p1.xVel = temp;
temp = gravity * 2;
while (mapHit.hitTest(p1.mc._x + p1.xVel, p1.mc._y - temp, true)) {
temp = temp + gravity;
}
if (p1.xVel > (-p1.xAcc)) {
p1.xVel = -p1.xAcc;
}
p1.mc._y = p1.mc._y + ((-temp) + gravity);
p1.yVel = 0;
} else {
if (p1.xVel > 0) {
if (mapHit.hitTest(p1.mc._x + p1.xVel, p1.mc._y - gravity, true)) {
temp = p1.xVel - p1.xAcc;
do {
if (!mapHit.hitTest(p1.mc._x + temp, p1.mc._y - gravity, true)) {
break;
}
temp = temp + (-p1.xAcc);
} while (temp >= 0);
p1.mc._x = p1.mc._x + temp;
}
} else if (mapHit.hitTest(p1.mc._x + p1.xVel, p1.mc._y - gravity, true)) {
temp = p1.xVel + p1.xAcc;
do {
if (!mapHit.hitTest(p1.mc._x + temp, p1.mc._y - gravity, true)) {
break;
}
temp = temp + p1.xAcc;
} while (temp <= 0);
p1.mc._x = p1.mc._x + temp;
}
p1.xVel = 0;
}
}
function p1_hitWallLeft() {
temp = p1.xVel - p1.xAirAcc;
if (temp < (-p1.xWalkMax)) {
temp = -p1.xWalkMax;
}
if (((!mapHit.hitTest(p1.mc._x + temp, p1.mc._y, true)) && (!mapHit.hitTest(p1.mc._x + temp, p1.mc._y - (p1.head / 2), true))) && (!mapHit.hitTest(p1.mc._x + temp, (p1.mc._y - p1.head) + 6, true))) {
if (p1.xVel < (-p1.xWalkMax)) {
if (((!mapHit.hitTest(p1.mc._x + (temp / 2), p1.mc._y, true)) && (!mapHit.hitTest(p1.mc._x + (temp / 2), p1.mc._y - (p1.head / 2), true))) && (!mapHit.hitTest(p1.mc._x + (temp / 2), (p1.mc._y - p1.head) + 6, true))) {
p1.xVel = p1.xVel + (-p1.xAirAcc);
}
} else {
p1.xVel = p1.xVel + (-p1.xAirAcc);
}
} else {
p1.xVel = 0;
}
p1.mc._xscale = -100;
}
function p1_crouchWalkRight() {
p1.crouchMoved = true;
p1.crouched = false;
if (((p1.grabCount <= 0) && (p1.windup <= 0)) && (p1.animHoldCrouch <= 0)) {
p1.mc.gotoAndStop("crouchWalk");
p1.trans = "walk";
}
p1.mc._xscale = 100;
temp = p1.xVel + p1.xAcc;
if (temp > p1.xCrouchMax) {
temp = p1.xCrouchMax;
}
if ((!mapHit.hitTest(p1.mc._x + temp, p1.mc._y, true)) && (mapHit.hitTest(p1.mc._x + temp, p1.mc._y + (gravity * 8), true))) {
p1.xVel = temp;
p1.mc._y = p1.mc._y + gravity;
temp = 0;
while ((temp < (gravity * 8)) && (!mapHit.hitTest(p1.mc._x + p1.xVel, p1.mc._y + temp, true))) {
temp = temp + gravity;
}
p1.mc._y = p1.mc._y + temp;
} else if ((!mapHit.hitTest(p1.mc._x + temp, p1.mc._y - gravity, true)) && (mapHit.hitTest((p1.mc._x + p1.xAcc) + temp, p1.mc._y + gravity, true))) {
p1.xVel = temp;
} else if ((!mapHit.hitTest(p1.mc._x + temp, p1.mc._y - 9, true)) && (mapHit.hitTest((p1.mc._x + p1.xAcc) + temp, p1.mc._y + gravity, true))) {
p1.xVel = temp;
temp = gravity * 2;
while (mapHit.hitTest(p1.mc._x + p1.xVel, p1.mc._y - temp, true)) {
temp = temp + gravity;
}
if (p1.xVel < p1.xAcc) {
p1.xVel = p1.xAcc;
}
p1.mc._y = p1.mc._y + ((-temp) + gravity);
p1.yVel = 0;
} else {
if (mapHit.hitTest(p1.mc._x + p1.xVel, p1.mc._y - gravity, true)) {
temp = p1.xVel - p1.xAcc;
do {
if (!mapHit.hitTest(p1.mc._x + temp, p1.mc._y - gravity, true)) {
break;
}
temp = temp + (-p1.xAcc);
} while (temp >= 0);
p1.mc._x = p1.mc._x + temp;
}
p1.xVel = 0;
}
}
function p1_walkRight() {
if (((p1.grabCount <= 0) && (p1.windup <= 0)) && (p1.animHoldWalk <= 0)) {
if (p1.mc._xscale < 0) {
p1.mc.gotoAndStop("turn");
p1.animHoldIdle = 2;
p1.animHoldWalk = 2;
p1.trans = null;
} else {
p1.mc.gotoAndStop("walk");
p1.trans = "walk";
}
}
p1.mc._xscale = 100;
temp = p1.xVel + p1.xAcc;
if (temp > p1.xWalkMax) {
temp = p1.xWalkMax;
}
if ((!mapHit.hitTest(p1.mc._x + temp, p1.mc._y, true)) && (mapHit.hitTest(p1.mc._x + temp, p1.mc._y + (gravity * 8), true))) {
p1.xVel = temp;
p1.mc._y = p1.mc._y + gravity;
temp = 0;
while ((temp < (gravity * 8)) && (!mapHit.hitTest(p1.mc._x + p1.xVel, p1.mc._y + temp, true))) {
temp = temp + gravity;
}
p1.mc._y = p1.mc._y + temp;
} else if (!mapHit.hitTest(p1.mc._x + temp, p1.mc._y - gravity, true)) {
p1.xVel = temp;
} else if (!mapHit.hitTest(p1.mc._x + temp, p1.mc._y - 9, true)) {
p1.xVel = temp;
temp = gravity * 2;
while (mapHit.hitTest(p1.mc._x + p1.xVel, p1.mc._y - temp, true)) {
temp = temp + gravity;
}
if (p1.xVel < p1.xAcc) {
p1.xVel = p1.xAcc;
}
p1.mc._y = p1.mc._y + ((-temp) + gravity);
p1.yVel = 0;
} else {
if (p1.xVel > 0) {
if (mapHit.hitTest(p1.mc._x + p1.xVel, p1.mc._y - gravity, true)) {
temp = p1.xVel - p1.xAcc;
do {
if (!mapHit.hitTest(p1.mc._x + temp, p1.mc._y - gravity, true)) {
break;
}
temp = temp + (-p1.xAcc);
} while (temp >= 0);
p1.mc._x = p1.mc._x + temp;
}
} else if (mapHit.hitTest(p1.mc._x + p1.xVel, p1.mc._y - gravity, true)) {
temp = p1.xVel + p1.xAcc;
do {
if (!mapHit.hitTest(p1.mc._x + temp, p1.mc._y - gravity, true)) {
break;
}
temp = temp + p1.xAcc;
} while (temp <= 0);
p1.mc._x = p1.mc._x + temp;
}
p1.xVel = 0;
}
}
function p1_hitWallRight() {
temp = p1.xVel + p1.xAirAcc;
if (temp > p1.xWalkMax) {
temp = p1.xWalkMax;
}
if (((!mapHit.hitTest(p1.mc._x + temp, p1.mc._y, true)) && (!mapHit.hitTest(p1.mc._x + temp, p1.mc._y - (p1.head / 2), true))) && (!mapHit.hitTest(p1.mc._x + temp, (p1.mc._y - p1.head) + 6, true))) {
if (p1.xVel > p1.xWalkMax) {
if (((!mapHit.hitTest(p1.mc._x + (temp / 2), p1.mc._y, true)) && (!mapHit.hitTest(p1.mc._x + (temp / 2), p1.mc._y - (p1.head / 2), true))) && (!mapHit.hitTest(p1.mc._x + (temp / 2), (p1.mc._y - p1.head) + 6, true))) {
p1.xVel = p1.xVel + p1.xAirAcc;
}
} else {
p1.xVel = p1.xVel + p1.xAirAcc;
}
} else {
p1.xVel = 0;
}
p1.mc._xscale = 100;
}
function p1_idle() {
if (mapHit.hitTest(p1.mc._x, p1.mc._y + gravity, true)) {
if ((p1.animHoldIdle <= 0) && (p1.yVel == 0)) {
if (Key.isDown(p1.keyDown1)) {
if (p1.crouchMoved) {
if (!p1.crouched) {
p1.crouched = true;
p1.mc.gotoAndStop("crouch2");
p1.trans = "walk";
}
} else if (!p1.crouched) {
p1.crouched = true;
p1.mc.gotoAndStop("crouch");
p1.trans = "walk";
}
} else if ((p1.grabCount <= 0) && (p1.windup <= 0)) {
if (p1.trans != null) {
p1.trans = null;
p1.mc.gotoAndStop("idle1");
p1.animHoldIdle = 3;
} else {
p1.mc.gotoAndStop("idle");
}
}
}
if (p1.xVel > 0) {
p1.xVel = p1.xVel + ((-p1.xAcc) * 2);
if (p1.xVel <= 0.7) {
p1.xVel = 0;
}
} else if (p1.xVel < 0) {
p1.xVel = p1.xVel + (p1.xAcc * 2);
if (p1.xVel >= -0.7) {
p1.xVel = 0;
}
}
} else if (p1.xVel > 0) {
if ((p1.grabCount <= 0) && (p1.animHoldAir <= 0)) {
if (p1.windup <= 0) {
p1.mc.gotoAndStop("fall");
} else {
p1.mc.gotoAndStop("throwAirWindup");
p1.mc.mcMC.gotoAndStop(p1.windup);
}
p1.jumpPressed = true;
p1.animHoldAir = 16;
}
p1.xVel = p1.xVel + ((-p1.xAcc) / 2);
if (p1.xVel <= 0) {
p1.xVel = 0;
}
} else if (p1.xVel < 0) {
if ((p1.grabCount <= 0) && (p1.animHoldAir <= 0)) {
if (p1.windup <= 0) {
p1.mc.gotoAndStop("fall");
} else {
p1.mc.gotoAndStop("throwAirWindup");
p1.mc.mcMC.gotoAndStop(p1.windup);
}
p1.jumpPressed = true;
p1.animHoldAir = 16;
}
p1.xVel = p1.xVel + (p1.xAcc / 2);
if (p1.xVel >= 0) {
p1.xVel = 0;
}
}
}
function p1_dash() {
if ((p1.mc._xscale > 0) && (Key.isDown(p1.keyRight))) {
if (p1.yVel == 0) {
p1.mc.gotoAndStop("dashLoop");
}
p1.dashHold++;
p1.xVel = p1.dashVel;
p1.xSpec++;
if ((!mapHit.hitTest(p1.mc._x + p1.xVel, p1.mc._y - 9, true)) && (mapHit.hitTest(p1.mc._x + p1.xVel, p1.mc._y, true))) {
playerUpHill();
}
} else if ((p1.mc._xscale < 0) && (Key.isDown(p1.keyLeft))) {
if (p1.yVel == 0) {
p1.mc.gotoAndStop("dashLoop");
}
p1.dashHold++;
p1.xVel = -p1.dashVel;
p1.xSpec++;
if ((!mapHit.hitTest(p1.mc._x + p1.xVel, p1.mc._y - 9, true)) && (mapHit.hitTest(p1.mc._x + p1.xVel, p1.mc._y, true))) {
playerUpHill();
}
} else if (p1.yVel == 0) {
p1.mc.gotoAndStop("dashEnd");
p1.animHoldIdle = 6;
}
}
function p1_xFinalCheck() {
if (mapHit.hitTest(p1.mc._x + p1.xVel, p1.mc._y - gravity, true)) {
if (p1.xVel > 0) {
temp = p1.xVel - p1.xAcc;
do {
if (!mapHit.hitTest(p1.mc._x + temp, p1.mc._y - gravity, true)) {
break;
}
temp = temp + (-p1.xAcc);
} while (temp >= 0);
p1.mc._x = p1.mc._x + temp;
} else {
temp = p1.xVel + p1.xAcc;
do {
if (!mapHit.hitTest(p1.mc._x + temp, p1.mc._y - gravity, true)) {
break;
}
temp = temp + p1.xAcc;
} while (temp <= 0);
p1.mc._x = p1.mc._x + temp;
}
p1.xVel = 0;
}
}
function p1_slideDownhill() {
temp = 0;
while ((temp < (gravity * 8)) && (!mapHit.hitTest(p1.mc._x, p1.mc._y + temp, true))) {
temp = temp + gravity;
}
p1.mc._y = p1.mc._y + temp;
}
function p1_fall() {
if (p1.ySpec <= 0) {
p1.yVel = p1.yVel + gravity;
if (p1.yVel > gravity) {
p1.jumping = false;
}
p1.trans = null;
}
if ((p1.grabCount <= 0) && (p1.animHoldAir <= 0)) {
if (p1.windup <= 0) {
p1.mc.gotoAndStop("fall");
} else {
p1.mc.gotoAndStop("throwAirWindup");
p1.mc.mcMC.gotoAndStop(p1.windup);
}
p1.jumpPressed = true;
p1.animHoldAir = 16;
}
if (p1.yVel > 0) {
p1.fallTime++;
}
}
function p1_hitGround() {
p1.yVel = p1.yVel + (-gravity);
temp = p1.yMax;
if (!mapHit.hitTest(p1.mc._x, p1.mc._y - p1.head, true)) {
while (mapHit.hitTest(p1.mc._x, p1.mc._y + p1.yVel, true)) {
p1.yVel = p1.yVel + (-gravity);
temp = temp + (-gravity);
if (temp < gravity) {
if (mapHit.hitTest(p1.mc._x - 50, p1.mc._y + 10, true)) {
p1.mc._x = p1.mc._x + 50;
} else {
p1.mc._x = p1.mc._x + -50;
}
p1.yVel = (-gravity) - 0.001;
break;
}
}
p1.yVel = p1.yVel + gravity;
p1.mc._y = p1.mc._y + p1.yVel;
} else if (!mapHit.hitTest(p1.mc._x - 50, p1.mc._y - gravity, true)) {
p1.mc._x = p1.mc._x + -5;
} else if (!mapHit.hitTest(p1.mc._x + 50, p1.mc._y - gravity, true)) {
p1.mc._x = p1.mc._x + 5;
}
if ((p1.fallTime > 2) && (p1.yVel != 0)) {
if (!Key.isDown(p1.keyDown1)) {
if ((!Key.isDown(p1.keyLeft)) && (!Key.isDown(p1.keyRight))) {
if (p1.windup <= 0) {
p1.mc.gotoAndStop("land");
} else {
p1.mc.gotoAndStop("throwLandWindup");
}
p1.animHoldIdle = 12;
if (p1.yVel > 4) {
soundWink.attachSound("s_winkland");
soundWink.start(0, 0);
soundWink.setPan(Math.ceil(((p1.mc._x - mcCam._x) / 400) * 100));
soundWink.setVolume(60);
}
}
} else {
p1.mc.gotoAndStop("crouched");
p1.trans = "walk";
p1.crouched = true;
}
p1.fallTime = 0;
}
with (p1) {
yVel = 0;
jumping = false;
headbouncing = 0;
bounced = false;
}
}
function p1_jump() {
if ((Key.isDown(p1.keyDown1) && (p1.dJumpOK)) && (p1.yVel > 0)) {
p1.headbouncing = 1;
p1.yVel = 14;
p1.mc.gotoAndStop("headBounceDown");
} else if (!p1.jumpPressed) {
if (!mapHit.hitTest(p1.mc._x, (p1.mc._y - p1.head) - 21, true)) {
with (p1) {
jumping = true;
crouched = false;
jumpPressed = true;
yVel = -16;
}
if (p1.windup <= 0) {
if (p1.dashHold > 0) {
p1.mc.gotoAndStop("dashJump");
p1.animHoldAir = 26;
} else {
p1.mc.gotoAndStop("jump");
p1.trans = null;
p1.animHoldAir = 10;
}
} else {
p1.mc.gotoAndStop("throwJumpWindup");
p1.animHoldAir = 10;
}
}
} else if (((p1.dJumpOK && (!p1.doubleJumped)) && (p1.yVel < 3)) && (!Key.isDown(p1.keyDown1))) {
if (mapHit.hitTest(p1.mc._x + 10.2, (p1.mc._y - p1.head) - 20, true) && (mapHit.hitTest(p1.mc._x - 10.2, (p1.mc._y - p1.head) - 20, true))) {
temp = -gravity;
while (!mapHit.hitTest(p1.mc._x, (p1.mc._y - p1.head) + temp, true)) {
p1.mc._y = p1.mc._y + temp;
temp = temp + (-gravity);
}
p1.jumping = true;
p1.mc.gotoAndStop("stick");
p1.xVel = 0;
p1.yVel = 0.001;
p1.animHoldIdle = 9;
p1.animHoldAir = 9;
p1.xSpec = 2;
p1.ySpec = 2;
p1.state = "stuck";
p1.bounced = false;
p1.holdName.xVel = (Math.random() * 8) - 4;
p1.holdName.yVel = -4;
p1.holdName.state = "thrown";
p1.holdName.mc._rotation = 0;
p1.holdName.grabbedName = null;
p1.holdName = null;
p1.grabCount = 0;
p1.windup = 0;
soundWink.attachSound("s_stickON");
soundWink.start(0, 0);
soundWink.setPan(Math.ceil(((p1.mc._x - mcCam._x) / 400) * 100));
}
}
p1.dJumpOK = false;
}
function p1_grabbingWalkLeft() {
if (mapHit.hitTest(p1.mc._x, p1.mc._y + (gravity * 2), true)) {
if (((p1.grabCount <= 0) && (p1.windup <= 0)) && (p1.animHoldWalk <= 0)) {
if (p1.mc._xscale < 0) {
p1.mc.gotoAndStop("grabbingWalkF");
} else {
p1.mc.gotoAndStop("grabbingWalkB");
}
}
temp = p1.xVel - p1.xAcc;
if (temp < (-p1.xGrabMax)) {
temp = -p1.xGrabMax;
}
if ((!mapHit.hitTest(p1.mc._x + temp, p1.mc._y, true)) && (mapHit.hitTest(p1.mc._x + temp, p1.mc._y + (gravity * 8), true))) {
p1.xVel = temp;
p1.mc._y = p1.mc._y + gravity;
temp = 0;
while ((temp < (gravity * 8)) && (!mapHit.hitTest(p1.mc._x + p1.xVel, p1.mc._y + temp, true))) {
temp = temp + gravity;
}
p1.mc._y = p1.mc._y + temp;
} else if (!mapHit.hitTest(p1.mc._x + temp, p1.mc._y - gravity, true)) {
p1.xVel = temp;
} else if (!mapHit.hitTest(p1.mc._x + temp, p1.mc._y - 9, true)) {
p1.xVel = temp;
temp = gravity * 2;
while (mapHit.hitTest(p1.mc._x + p1.xVel, p1.mc._y - temp, true)) {
temp = temp + gravity;
}
if (p1.xVel > (-p1.xAcc)) {
p1.xVel = -p1.xAcc;
}
p1.mc._y = p1.mc._y + ((-temp) + gravity);
p1.yVel = 0;
} else {
if (p1.xVel > 0) {
if (mapHit.hitTest(p1.mc._x + p1.xVel, p1.mc._y - gravity, true)) {
temp = p1.xVel - p1.xAcc;
do {
if (!mapHit.hitTest(p1.mc._x + temp, p1.mc._y - gravity, true)) {
break;
}
temp = temp + (-p1.xAcc);
} while (temp >= 0);
p1.mc._x = p1.mc._x + temp;
}
} else if (mapHit.hitTest(p1.mc._x + p1.xVel, p1.mc._y - gravity, true)) {
temp = p1.xVel + p1.xAcc;
do {
if (!mapHit.hitTest(p1.mc._x + temp, p1.mc._y - gravity, true)) {
break;
}
temp = temp + p1.xAcc;
} while (temp <= 0);
p1.mc._x = p1.mc._x + temp;
}
p1.xVel = 0;
}
} else {
temp = p1.xVel - p1.xAirAcc;
if (temp < (-p1.xGrabMax)) {
temp = -p1.xGrabMax;
}
if (((!mapHit.hitTest(p1.mc._x + temp, p1.mc._y, true)) && (!mapHit.hitTest(p1.mc._x + temp, p1.mc._y - (p1.head / 2), true))) && (!mapHit.hitTest(p1.mc._x + temp, (p1.mc._y - p1.head) + 6, true))) {
if (p1.xVel < (-p1.xGrabMax)) {
if (((!mapHit.hitTest(p1.mc._x + (temp / 2), p1.mc._y, true)) && (!mapHit.hitTest(p1.mc._x + (temp / 2), p1.mc._y - (p1.head / 2), true))) && (!mapHit.hitTest(p1.mc._x + (temp / 2), (p1.mc._y - p1.head) + 6, true))) {
p1.xVel = p1.xVel + (-p1.xAirAcc);
}
} else {
p1.xVel = p1.xVel + (-p1.xAirAcc);
}
} else {
p1.xVel = 0;
}
}
}
function p1_grabbingWalkRight() {
if (mapHit.hitTest(p1.mc._x, p1.mc._y + (gravity * 2), true)) {
if (((p1.grabCount <= 0) && (p1.windup <= 0)) && (p1.animHoldWalk <= 0)) {
if (p1.mc._xscale < 0) {
p1.mc.gotoAndStop("grabbingWalkB");
} else {
p1.mc.gotoAndStop("grabbingWalkF");
}
}
temp = p1.xVel + p1.xAcc;
if (temp > p1.xGrabMax) {
temp = p1.xGrabMax;
}
if ((!mapHit.hitTest(p1.mc._x + temp, p1.mc._y, true)) && (mapHit.hitTest(p1.mc._x + temp, p1.mc._y + (gravity * 8), true))) {
p1.xVel = temp;
p1.mc._y = p1.mc._y + gravity;
temp = 0;
while ((temp < (gravity * 8)) && (!mapHit.hitTest(p1.mc._x + p1.xVel, p1.mc._y + temp, true))) {
temp = temp + gravity;
}
p1.mc._y = p1.mc._y + temp;
} else if (!mapHit.hitTest(p1.mc._x + temp, p1.mc._y - gravity, true)) {
p1.xVel = temp;
} else if (!mapHit.hitTest(p1.mc._x + temp, p1.mc._y - 9, true)) {
p1.xVel = temp;
temp = gravity * 2;
while (mapHit.hitTest(p1.mc._x + p1.xVel, p1.mc._y - temp, true)) {
temp = temp + gravity;
}
if (p1.xVel < p1.xAcc) {
p1.xVel = p1.xAcc;
}
p1.mc._y = p1.mc._y + ((-temp) + gravity);
p1.yVel = 0;
} else {
if (p1.xVel > 0) {
if (mapHit.hitTest(p1.mc._x + p1.xVel, p1.mc._y - gravity, true)) {
temp = p1.xVel - p1.xAcc;
do {
if (!mapHit.hitTest(p1.mc._x + temp, p1.mc._y - gravity, true)) {
break;
}
temp = temp + (-p1.xAcc);
} while (temp >= 0);
p1.mc._x = p1.mc._x + temp;
}
} else if (mapHit.hitTest(p1.mc._x + p1.xVel, p1.mc._y - gravity, true)) {
temp = p1.xVel + p1.xAcc;
do {
if (!mapHit.hitTest(p1.mc._x + temp, p1.mc._y - gravity, true)) {
break;
}
temp = temp + p1.xAcc;
} while (temp <= 0);
p1.mc._x = p1.mc._x + temp;
}
p1.xVel = 0;
}
} else {
temp = p1.xVel + p1.xAirAcc;
if (temp > p1.xGrabMax) {
temp = p1.xGrabMax;
}
if (((!mapHit.hitTest(p1.mc._x + temp, p1.mc._y, true)) && (!mapHit.hitTest(p1.mc._x + temp, p1.mc._y - (p1.head / 2), true))) && (!mapHit.hitTest(p1.mc._x + temp, (p1.mc._y - p1.head) + 6, true))) {
if (p1.xVel > p1.xGrabMax) {
if (((!mapHit.hitTest(p1.mc._x + (temp / 2), p1.mc._y, true)) && (!mapHit.hitTest(p1.mc._x + (temp / 2), p1.mc._y - (p1.head / 2), true))) && (!mapHit.hitTest(p1.mc._x + (temp / 2), (p1.mc._y - p1.head) + 6, true))) {
p1.xVel = p1.xVel + p1.xAirAcc;
}
} else {
p1.xVel = p1.xVel + p1.xAirAcc;
}
} else {
p1.xVel = 0;
}
}
}
function p1_grabbingIdle() {
if (mapHit.hitTest(p1.mc._x, p1.mc._y + gravity, true)) {
if ((p1.animHoldIdle <= 0) && (p1.yVel == 0)) {
if ((p1.grabCount <= 0) && (p1.windup <= 0)) {
p1.mc.gotoAndStop("grabbingIdle");
}
}
if (p1.xVel > 0) {
p1.xVel = p1.xVel + ((-p1.xAcc) * 2);
if (p1.xVel <= 0.7) {
p1.xVel = 0;
}
} else if (p1.xVel < 0) {
p1.xVel = p1.xVel + (p1.xAcc * 2);
if (p1.xVel >= -0.7) {
p1.xVel = 0;
}
}
}
}
function p1_throwEnemyWalk() {
p1.holdName.xVel = 20;
p1.holdName.yVel = -15;
p1.mc.gotoAndStop("throwWalk3");
p1.animHoldWalk = 7;
p1.holdName.state = "thrown";
thrownName = p1.holdName;
p1.holdName.grabbedName = null;
p1.holdName = null;
}
function p1_chokeEnemy() {
p1.xVel = 0;
p1.mc.gotoAndStop("grabbingChoke");
p1.attackHold = 84;
p1.trans = null;
p1.holdName.mc.gotoAndStop("choke");
p1.holdName.state = "choking";
p1.holdName.phaseCount = 54;
p1.holdName.mc.swapDepths(p1.holdName.mc.getDepth() + enemyDeadOffset);
soundFX.attachSound("s_choke");
soundFX.start(0, 0);
}
function p1_throwEnemyIdle() {
if (p1.mc._xscale < 0) {
p1.holdName.xVel = -12;
} else {
p1.holdName.xVel = 12;
}
p1.holdName.yVel = -10;
p1.mc.gotoAndStop("throwIdle3");
p1.animHoldIdle = 7;
p1.holdName.state = "thrown";
thrownName = p1.holdName;
p1.holdName.grabbedName = null;
p1.holdName = null;
}
function enemy1_Normal(enemyName) {
temp = 1;
while (temp <= projectiles) {
temp2 = "proj_" + temp;
temp2 = this[temp2];
if (((temp2.mc._x != undefined) && (temp2.state == "thrown")) && ((temp2.hitTarget == 2) || (temp2.hitTarget == 3))) {
if (Math.abs(temp2.mc._x - enemyName.mc._x) < 200) {
if (enemyName.mc.mcHit.hitTest(temp2.mc._x, temp2.mc._y, true)) {
enemy1_projectileHit(enemyName);
}
}
}
temp++;
}
if (enemyName.grabCount > 0) {
enemy1_grabStaff(enemyName);
}
if (p1.headbouncing == 1) {
if (enemyName.mc.mcHit.hitTest(p1.mc._x, p1.mc._y, true)) {
enemy1_headbounced(enemyName);
}
}
if ((enemyName.phase == 1) && (enemyName.state == "normal")) {
if ((p1.plane == "ground") && (p1.state != "stuck")) {
if ((((p1.mc._x - enemyName.mc._x) < 150) && ((p1.mc._x - enemyName.mc._x) > 0)) && (enemyName.mc._xscale > 0)) {
if (Math.abs(p1.mc._y - enemyName.mc._y) < 36) {
if ((!mapHit.hitTest(enemyName.mc._x + 50, enemyName.mc._y - (enemyName.head / 2), true)) && (!mapHit.hitTest(enemyName.mc._x + 100, enemyName.mc._y - (enemyName.head / 2), true))) {
enemyName.alertTime++;
if (Math.abs(p1.xVel) > 4) {
if (enemyName.alertTime > 2) {
enemy1_alerted(enemyName);
}
} else if (p1.crouching) {
if (enemyName.alertTime > 24) {
enemy1_alerted(enemyName);
}
} else if (enemyName.alertTime > 12) {
enemy1_alerted(enemyName);
}
}
}
} else if ((((p1.mc._x - enemyName.mc._x) > -150) && ((p1.mc._x - enemyName.mc._x) < 0)) && (enemyName.mc._xscale < 0)) {
if (Math.abs(p1.mc._y - enemyName.mc._y) < 36) {
if ((!mapHit.hitTest(enemyName.mc._x - 50, enemyName.mc._y - (enemyName.head / 2), true)) && (!mapHit.hitTest(enemyName.mc._x - 100, enemyName.mc._y - (enemyName.head / 2), true))) {
enemyName.alertTime++;
if (Math.abs(p1.xVel) > 4) {
if (enemyName.alertTime > 2) {
enemy1_alerted(enemyName);
}
} else if (p1.crouching) {
if (enemyName.alertTime > 24) {
enemy1_alerted(enemyName);
}
} else if (enemyName.alertTime > 12) {
enemy1_alerted(enemyName);
}
}
}
}
} else {
enemyName.alertTime = 0;
}
if (enemyName.stopCount > 0) {
enemyName.stopCount--;
} else if (enemyName.stopCount == 0) {
temp = Math.random();
if (temp < 0.2) {
enemyName.stopCount--;
if (enemyName.mc._x < enemyName.xPatrol) {
enemyName.xDest = enemyName.xPatrol + 150;
if (enemyName.mc._xscale < 0) {
enemyName.mc._xscale = 100;
enemyName.mc.gotoAndStop("turn");
}
enemyName.animHoldWalk = 9;
} else {
enemyName.xDest = enemyName.xPatrol - 150;
if (enemyName.mc._xscale > 0) {
enemyName.mc._xscale = -100;
enemyName.mc.gotoAndStop("turn");
}
enemyName.animHoldWalk = 9;
}
}
}
if ((enemyName.xVel != 0) && (Math.abs(enemyName.xDest - enemyName.mc._x) < (enemyName.xAcc + 0.2))) {
enemyName.mc._x = enemyName.xDest;
enemyName.xVel = 0;
enemyName.stopCount = 90;
enemyName.mc.gotoAndStop("idle");
} else if ((enemyName.holdName == null) && (enemyName.grabCount <= 0)) {
temp = 1;
while (temp <= staffs) {
temp2 = "staff_" + temp;
temp2 = this[temp2];
if ((temp2.grabbedName == null) && (temp2.state == "normal")) {
if ((Math.abs(enemyName.mc._x - temp2.mc._x) < 16) && (Math.abs(enemyName.mc._y - temp2.mc._y) < 12)) {
enemyName.grabCount = 15;
enemyName.mc.gotoAndStop("grabIdle");
enemyName.animHoldIdle = 24;
enemyName.stopCount = 26;
enemyName.xVel = 0;
enemyName.xDest = enemyName.mc._x;
break;
}
}
temp++;
}
}
if ((enemyName.stopCount < 0) && (enemyName.mc._xscale < 0)) {
if (mapHit.hitTest(enemyName.mc._x, enemyName.mc._y + gravity, true)) {
if (enemyName.animHoldWalk <= 0) {
enemyName.mc.gotoAndStop("walk");
}
temp = enemyName.xVel - enemyName.xAcc;
if (temp < (-enemyName.xMax)) {
temp = -enemyName.xMax;
}
enemy1Walk(enemyName, -100, temp, 4);
} else {
temp = enemyName.xVel - enemyName.xAirAcc;
if (temp < (-enemyName.xMax)) {
temp = -enemyName.xMax;
}
if (((!mapHit.hitTest(enemyName.mc._x + temp, enemyName.mc._y, true)) && (!mapHit.hitTest(enemyName.mc._x + temp, enemyName.mc._y - (enemyName.head / 2), true))) && (!mapHit.hitTest(enemyName.mc._x + temp, (enemyName.mc._y - enemyName.head) + 6, true))) {
if (enemyName.xVel < (-enemyName.xMax)) {
if (((!mapHit.hitTest(enemyName.mc._x + (temp / 2), enemyName.mc._y, true)) && (!mapHit.hitTest(enemyName.mc._x + (temp / 2), enemyName.mc._y - (enemyName.head / 2), true))) && (!mapHit.hitTest(enemyName.mc._x + (temp / 2), (enemyName.mc._y - enemyName.head) + 6, true))) {
enemyName.xVel = enemyName.xVel + (-enemyName.xAirAcc);
}
} else {
enemyName.xVel = enemyName.xVel + (-enemyName.xAirAcc);
}
} else {
enemyName.xVel = 0;
enemyName.xDest = enemyName.mc._x + 10;
enemyName.stopCount = -1;
}
}
} else if ((enemyName.stopCount < 0) && (enemyName.mc._xscale > 0)) {
if (mapHit.hitTest(enemyName.mc._x, enemyName.mc._y + gravity, true)) {
if (enemyName.animHoldWalk <= 0) {
enemyName.mc.gotoAndStop("walk");
}
temp = enemyName.xVel + enemyName.xAcc;
if (temp > enemyName.xMax) {
temp = enemyName.xMax;
}
enemy1Walk(enemyName, 100, temp, 4);
} else {
temp = enemyName.xVel + enemyName.xAirAcc;
if (temp > enemyName.xMax) {
temp = enemyName.xMax;
}
if (((!mapHit.hitTest(enemyName.mc._x + temp, enemyName.mc._y, true)) && (!mapHit.hitTest(enemyName.mc._x + temp, enemyName.mc._y - (enemyName.head / 2), true))) && (!mapHit.hitTest(enemyName.mc._x + temp, (enemyName.mc._y - enemyName.head) + 6, true))) {
if (enemyName.xVel > enemyName.xMax) {
if (((!mapHit.hitTest(enemyName.mc._x + (temp / 2), enemyName.mc._y, true)) && (!mapHit.hitTest(enemyName.mc._x + (temp / 2), enemyName.mc._y - (enemyName.head / 2), true))) && (!mapHit.hitTest(enemyName.mc._x + (temp / 2), (enemyName.mc._y - enemyName.head) + 6, true))) {
enemyName.xVel = enemyName.xVel + enemyName.xAirAcc;
}
} else {
enemyName.xVel = enemyName.xVel + enemyName.xAirAcc;
}
} else {
enemyName.xVel = 0;
enemyName.xDest = enemyName.mc._x - 10;
enemyName.stopCount = -1;
}
}
} else if (enemyName.xSpec <= 0) {
if (mapHit.hitTest(enemyName.mc._x, enemyName.mc._y + gravity, true)) {
if ((enemyName.animHoldIdle <= 0) && (enemyName.yVel == 0)) {
if ((enemyName.grabCount <= 0) && (enemyName.windup <= 0)) {
enemyName.mc.gotoAndStop("idle");
}
}
if (enemyName.xVel > 0) {
enemyName.xVel = enemyName.xVel + ((-enemyName.xAcc) * 2);
if (enemyName.xVel <= 0.7) {
enemyName.xVel = 0;
}
} else if (enemyName.xVel < 0) {
enemyName.xVel = enemyName.xVel + (enemyName.xAcc * 2);
if (enemyName.xVel >= -0.7) {
enemyName.xVel = 0;
}
}
} else if (enemyName.xVel > 0) {
if ((enemyName.grabCount <= 0) && (enemyName.animHoldAir <= 0)) {
if (enemyName.windup <= 0) {
enemyName.mc.gotoAndStop("fall");
}
enemyName.jumpPressed = true;
enemyName.animHoldAir = 16;
}
enemyName.mc._xscale = 100;
enemyName.xVel = enemyName.xVel + ((-enemyName.xAcc) / 2);
if (enemyName.xVel <= 0) {
enemyName.xVel = 0;
}
} else if (enemyName.xVel < 0) {
if ((enemyName.grabCount <= 0) && (enemyName.animHoldAir <= 0)) {
if (enemyName.windup <= 0) {
enemyName.mc.gotoAndStop("fall");
}
enemyName.jumpPressed = true;
enemyName.animHoldAir = 16;
}
enemyName.mc._xscale = -100;
enemyName.xVel = enemyName.xVel + (enemyName.xAcc / 2);
if (enemyName.xVel >= 0) {
enemyName.xVel = 0;
}
}
}
if (enemyName.xSpec > 0) {
enemyName.xSpec--;
}
if (enemyName.xSpec <= 0) {
if (enemyName.xVel > enemyName.xMax) {
enemyName.xVel = enemyName.xMax + ((enemyName.xMax - enemyName.xVel) / 8);
} else if (enemyName.xVel < (-enemyName.xMax)) {
enemyName.xVel = (-enemyName.xMax) + ((enemyName.xVel + enemyName.xMax) / 8);
}
}
} else if ((enemyName.phase == 2) && (enemyName.state == "normal")) {
enemyName.attackHold--;
if ((enemyName.attackHold > 0) && (p1.plane == "ground")) {
if (enemyName.mc._xscale > 0) {
temp = enemyName.mc.mcMC.mcAttack._x;
} else {
temp = -enemyName.mc.mcMC.mcAttack._x;
}
if (((enemyName.mc.mcMC.mcAttack._x != undefined) && (p1.mc.mcHit.hitTest(enemyName.mc._x + temp, enemyName.mc._y + enemyName.mc.mcMC.mcAttack._y, true))) && (p1.state != "thrown")) {
if (p1.deflecting <= 0) {
if (((p1.holdName != null) && (p1.state == "grabbing")) || ((p1.holdName.state == "choking") && (p1.state == "normal"))) {
if (p1.holdName.state == "choking") {
p1.holdName.mc.swapDepths(p1.holdName.depth0);
}
p1.holdName.state = "normal";
p1.holdName.phase = 2;
p1.holdName.mc.gotoAndStop("idle2");
p1.holdName.grabbedName = null;
p1.holdName = null;
} else if (p1.holdName != null) {
p1.holdName.state = "thrown";
if (enemyName.mc._x < p1.mc._x) {
p1.holdName.xVel = p1.holdName.xVel + ((Math.random() * 6) + 8);
} else {
p1.holdName.xVel = p1.holdName.xVel + ((Math.random() * -6) - 8);
}
p1.holdName.yVel = p1.holdName.yVel + ((Math.random() * -12) - 5);
p1.holdName.mc._rotation = 0;
p1.holdName = null;
p1.windup = 0;
}
p1.state = "thrown";
p1.mc.gotoAndStop("thrown");
p1.whacking = 0;
p1.hp = p1.hp + (-enemyName.bp);
p1.xVel = enemyName.xForce;
p1.yVel = enemyName.yForce;
p1.grabCount = 0;
p1.attackHold = 0;
if (enemyName.mc._x < p1.mc._x) {
p1.mc._xscale = -100;
} else {
p1.mc._xscale = 100;
}
soundWink.attachSound("s_winkhit1");
soundWink.start(0, 0);
soundWink.setPan(Math.ceil(((enemyName.mc._x - mcCam._x) / 400) * 100));
soundWinkDone = true;
} else if (((enemyName.mc._x > p1.mc._x) && (p1.mc._xscale > 0)) || ((enemyName.mc._x < p1.mc._x) && (p1.mc._xscale < 0))) {
if (p1.mc._xscale > 0) {
enemyName.xVel = (Math.random() * 8) + 15;
} else {
enemyName.xVel = (Math.random() * -8) - 15;
}
enemyName.yVel = (Math.random() * -8) - 11;
enemyName.state = "thrown";
soundFX.attachSound("s_hoodleyhit");
soundFX.start(0, 0);
soundFX.setPan(Math.ceil(((enemyName.mc._x - mcCam._x) / 400) * 100));
}
}
}
if (enemyName.phaseCount <= 0) {
enemyName.phase = 1;
enemyName.mc.gotoAndStop("alertToIdle");
enemyName.animHoldIdle = 10;
enemyName.stopCount = 9 + (Math.random() * 15);
} else {
if ((p1.plane == "ground") && (p1.state != "stuck")) {
if ((((p1.mc._x - enemyName.mc._x) < 150) && ((p1.mc._x - enemyName.mc._x) > 0)) && (enemyName.mc._xscale > 0)) {
if (Math.abs(p1.mc._y - enemyName.mc._y) < 40) {
if ((!mapHit.hitTest(enemyName.mc._x + 50, enemyName.mc._y - (enemyName.head / 2), true)) && (!mapHit.hitTest(enemyName.mc._x + 100, enemyName.mc._y - (enemyName.head / 2), true))) {
enemyName.phaseCount = 300;
soundHuntCount++;
}
}
} else if ((((p1.mc._x - enemyName.mc._x) > -150) && ((p1.mc._x - enemyName.mc._x) < 0)) && (enemyName.mc._xscale < 0)) {
if (Math.abs(p1.mc._y - enemyName.mc._y) < 40) {
if ((!mapHit.hitTest(enemyName.mc._x - 50, enemyName.mc._y - (enemyName.head / 2), true)) && (!mapHit.hitTest(enemyName.mc._x - 100, enemyName.mc._y - (enemyName.head / 2), true))) {
enemyName.phaseCount = 300;
soundHuntCount++;
}
}
}
}
if (enemyName.stopCount > 0) {
enemyName.stopCount--;
} else if (enemyName.stopCount == 0) {
temp = Math.random();
if (enemyName.mc._xscale < 0) {
if ((((p1.mc._x - enemyName.mc._x) > -200) && ((p1.mc._x - enemyName.mc._x) < 0)) && (enemyName.mc._xscale < 0)) {
if (Math.abs(p1.mc._y - enemyName.mc._y) < 80) {
if (p1.plane == "ground") {
enemyName.mc._xscale = -100;
enemyName.xDest = p1.mc._x;
enemyName.mc.gotoAndStop("walk2");
}
}
} else {
enemyName.mc._xscale = 100;
enemyName.xDest = enemyName.mc._x + 250;
enemyName.mc.gotoAndStop("turn2");
enemyName.animHoldIdle = 4;
enemyName.animHoldWalk = 4;
}
enemyName.stopCount--;
} else if (enemyName.mc._xscale > 0) {
if ((((p1.mc._x - enemyName.mc._x) < 200) && ((p1.mc._x - enemyName.mc._x) > 0)) && (enemyName.mc._xscale > 0)) {
if (Math.abs(p1.mc._y - enemyName.mc._y) < 80) {
if (p1.plane == "ground") {
enemyName.mc._xscale = 100;
enemyName.xDest = p1.mc._x;
enemyName.mc.gotoAndStop("walk2");
}
}
} else {
enemyName.mc._xscale = -100;
enemyName.xDest = enemyName.mc._x - 250;
enemyName.mc.gotoAndStop("turn2");
enemyName.animHoldIdle = 4;
enemyName.animHoldWalk = 4;
}
enemyName.stopCount--;
}
}
if ((enemyName.holdName == null) && (enemyName.grabCount <= 0)) {
temp = 1;
while (temp <= staffs) {
temp2 = "staff_" + temp;
temp2 = this[temp2];
if ((temp2.grabbedName == null) && (temp2.state == "normal")) {
if ((Math.abs(enemyName.mc._x - temp2.mc._x) < 16) && (Math.abs(enemyName.mc._y - temp2.mc._y) < 12)) {
enemyName.grabCount = 15;
enemyName.mc.gotoAndStop("grabIdle2");
enemyName.animHoldIdle = 24;
enemyName.stopCount = 26;
enemyName.xVel = 0;
enemyName.xDest = enemyName.mc._x;
break;
}
}
temp++;
}
}
if (((enemyName.stopCount <= 0) && (enemyName.xSpec <= 0)) && (enemyName.attackHold <= 0)) {
temp = Math.random();
if ((((enemyName.xVel != 0) && (Math.abs(enemyName.xDest - enemyName.mc._x) < (enemyName.xAcc + 0.2))) || ((enemyName.xDest < enemyName.mc._x) && (enemyName.mc._xscale > 0))) || ((enemyName.xDest > enemyName.mc._x) && (enemyName.mc._xscale < 0))) {
enemyName.mc._x = enemyName.xDest;
enemyName.xVel = 0;
enemyName.stopCount = 40;
enemyName.mc.gotoAndStop("idle2");
} else if ((p1.plane == "ground") && (enemyName.animHoldWalk <= 0)) {
if ((p1.state == "normal") || (p1.state == "grabbing")) {
if (enemyName.mc._xscale < 0) {
if ((((temp > 0.7) && ((p1.mc._x - enemyName.mc._x) > -80)) && ((p1.mc._x - enemyName.mc._x) < 0)) && (Math.abs(p1.mc._y - enemyName.mc._y) < 50)) {
if ((!mapHit.hitTest(enemyName.mc._x + 50, enemyName.mc._y - (enemyName.head / 2), true)) && (!mapHit.hitTest(enemyName.mc._x + 100, enemyName.mc._y - (enemyName.head / 2), true))) {
with (enemyName) {
xVel = -11;
xForce = -11;
xSpec = 5;
mc.gotoAndStop("headbutt");
animHoldIdle = 23;
animHoldWalk = 10;
attackHold = 60;
bp = 10;
hitHold = 0;
finalHit = true;
yForce = -11;
stopCount = 30;
}
}
} else if ((((((temp > 0.3) && ((p1.mc._x - enemyName.mc._x) > -200)) && ((p1.mc._x - enemyName.mc._x) < 0)) && (Math.abs(p1.mc._y - enemyName.mc._y) < 60)) && (enemyName.holdName.actor == "staff")) && (enemyName.attackHold <= 0)) {
if ((!mapHit.hitTest(enemyName.mc._x + 50, enemyName.mc._y - (enemyName.head / 2), true)) && (!mapHit.hitTest(enemyName.mc._x + 100, enemyName.mc._y - (enemyName.head / 2), true))) {
enemyName.mc.gotoAndStop("staffAttack");
enemyName.animHoldIdle = 17;
enemyName.attackHold = 47;
enemyName.stopCount = 15;
staffAttack(enemyName.holdName, 3, 1, 10);
}
}
} else if (enemyName.mc._xscale > 0) {
if ((((temp > 0.7) && ((p1.mc._x - enemyName.mc._x) < 80)) && ((p1.mc._x - enemyName.mc._x) > 0)) && (Math.abs(p1.mc._y - enemyName.mc._y) < 50)) {
if ((!mapHit.hitTest(enemyName.mc._x + 50, enemyName.mc._y - (enemyName.head / 2), true)) && (!mapHit.hitTest(enemyName.mc._x + 100, enemyName.mc._y - (enemyName.head / 2), true))) {
with (enemyName) {
xVel = 11;
xForce = 11;
xSpec = 5;
mc.gotoAndStop("headbutt");
animHoldIdle = 23;
animHoldWalk = 10;
attackHold = 60;
bp = 10;
hitHold = 0;
finalHit = true;
yForce = -11;
stopCount = 30;
}
}
} else if ((((((temp > 0.3) && ((p1.mc._x - enemyName.mc._x) < 200)) && ((p1.mc._x - enemyName.mc._x) > 0)) && (Math.abs(p1.mc._y - enemyName.mc._y) < 60)) && (enemyName.holdName.actor == "staff")) && (enemyName.attackHold <= 0)) {
if ((!mapHit.hitTest(enemyName.mc._x + 50, enemyName.mc._y - (enemyName.head / 2), true)) && (!mapHit.hitTest(enemyName.mc._x + 100, enemyName.mc._y - (enemyName.head / 2), true))) {
enemyName.mc.gotoAndStop("staffAttack");
enemyName.animHoldIdle = 17;
enemyName.attackHold = 47;
enemyName.stopCount = 15;
staffAttack(enemyName.holdName, 3, 1, 10);
}
}
}
} else if (Math.random() > 0.9) {
enemyName.xDest = enemyName.mc._x;
}
}
}
if ((((enemyName.xSpec <= 0) && (enemyName.attackHold <= 0)) && (enemyName.stopCount < 0)) && (enemyName.mc._xscale < 0)) {
if (mapHit.hitTest(enemyName.mc._x, enemyName.mc._y + gravity, true)) {
if (enemyName.animHoldWalk <= 0) {
enemyName.mc.gotoAndStop("walk2");
}
temp = enemyName.xVel - enemyName.xAcc;
if (temp < (-enemyName.xHuntMax)) {
temp = -enemyName.xHuntMax;
}
enemy1Walk(enemyName, -100, temp, 4);
} else {
temp = enemyName.xVel - enemyName.xAirAcc;
if (temp < (-enemyName.xHuntMax)) {
temp = -enemyName.xHuntMax;
}
if (((!mapHit.hitTest(enemyName.mc._x + temp, enemyName.mc._y, true)) && (!mapHit.hitTest(enemyName.mc._x + temp, enemyName.mc._y - (enemyName.head / 2), true))) && (!mapHit.hitTest(enemyName.mc._x + temp, (enemyName.mc._y - enemyName.head) + 6, true))) {
if (enemyName.xVel < (-enemyName.xHuntMax)) {
if (((!mapHit.hitTest(enemyName.mc._x + (temp / 2), enemyName.mc._y, true)) && (!mapHit.hitTest(enemyName.mc._x + (temp / 2), enemyName.mc._y - (enemyName.head / 2), true))) && (!mapHit.hitTest(enemyName.mc._x + (temp / 2), (enemyName.mc._y - enemyName.head) + 6, true))) {
enemyName.xVel = enemyName.xVel + (-enemyName.xAirAcc);
}
} else {
enemyName.xVel = enemyName.xVel + (-enemyName.xAirAcc);
}
} else {
enemyName.xVel = 0;
}
}
} else if ((((enemyName.xSpec <= 0) && (enemyName.attackHold <= 0)) && (enemyName.stopCount < 0)) && (enemyName.mc._xscale > 0)) {
if (mapHit.hitTest(enemyName.mc._x, enemyName.mc._y + gravity, true)) {
if (enemyName.animHoldWalk <= 0) {
enemyName.mc.gotoAndStop("walk2");
}
temp = enemyName.xVel + enemyName.xAcc;
if (temp > enemyName.xHuntMax) {
temp = enemyName.xHuntMax;
}
enemy1Walk(enemyName, 100, temp, 4);
} else {
temp = enemyName.xVel + enemyName.xAirAcc;
if (temp > enemyName.xHuntMax) {
temp = enemyName.xHuntMax;
}
if (((!mapHit.hitTest(enemyName.mc._x + temp, enemyName.mc._y, true)) && (!mapHit.hitTest(enemyName.mc._x + temp, enemyName.mc._y - (enemyName.head / 2), true))) && (!mapHit.hitTest(enemyName.mc._x + temp, (enemyName.mc._y - enemyName.head) + 6, true))) {
if (enemyName.xVel > enemyName.xHuntMax) {
if (((!mapHit.hitTest(enemyName.mc._x + (temp / 2), enemyName.mc._y, true)) && (!mapHit.hitTest(enemyName.mc._x + (temp / 2), enemyName.mc._y - (enemyName.head / 2), true))) && (!mapHit.hitTest(enemyName.mc._x + (temp / 2), (enemyName.mc._y - enemyName.head) + 6, true))) {
enemyName.xVel = enemyName.xVel + enemyName.xAirAcc;
}
} else {
enemyName.xVel = enemyName.xVel + enemyName.xAirAcc;
}
} else {
enemyName.xVel = 0;
enemyName.xDest = enemyName.mc._x - 10;
enemyName.stopCount = -1;
}
}
} else if (enemyName.xSpec <= 0) {
if (mapHit.hitTest(enemyName.mc._x, enemyName.mc._y + gravity, true)) {
if ((enemyName.animHoldIdle <= 0) && (enemyName.yVel == 0)) {
if ((enemyName.grabCount <= 0) && (enemyName.windup <= 0)) {
enemyName.mc.gotoAndStop("idle2");
}
}
if (enemyName.xVel > 0) {
enemyName.xVel = enemyName.xVel + ((-enemyName.xAcc) * 2);
if (enemyName.xVel <= 0.7) {
enemyName.xVel = 0;
}
} else if (enemyName.xVel < 0) {
enemyName.xVel = enemyName.xVel + (enemyName.xAcc * 2);
if (enemyName.xVel >= -0.7) {
enemyName.xVel = 0;
}
}
} else if (enemyName.xVel > 0) {
if ((enemyName.grabCount <= 0) && (enemyName.animHoldAir <= 0)) {
if (enemyName.windup <= 0) {
enemyName.mc.gotoAndStop("fall");
}
enemyName.jumpPressed = true;
enemyName.animHoldAir = 16;
}
enemyName.mc._xscale = 100;
enemyName.xVel = enemyName.xVel + ((-enemyName.xAcc) / 2);
if (enemyName.xVel <= 0) {
enemyName.xVel = 0;
}
} else if (enemyName.xVel < 0) {
if ((enemyName.grabCount <= 0) && (enemyName.animHoldAir <= 0)) {
if (enemyName.windup <= 0) {
enemyName.mc.gotoAndStop("fall");
}
enemyName.jumpPressed = true;
enemyName.animHoldAir = 16;
}
enemyName.mc._xscale = -100;
enemyName.xVel = enemyName.xVel + (enemyName.xAcc / 2);
if (enemyName.xVel >= 0) {
enemyName.xVel = 0;
}
}
}
if (enemyName.xSpec > 0) {
enemyName.xSpec--;
}
if (enemyName.xSpec <= 0) {
if (enemyName.xVel > enemyName.xHuntMax) {
enemyName.xVel = enemyName.xHuntMax + ((enemyName.xHuntMax - enemyName.xVel) / 8);
} else if (enemyName.xVel < (-enemyName.xHuntMax)) {
enemyName.xVel = (-enemyName.xHuntMax) + ((enemyName.xVel + enemyName.xHuntMax) / 8);
}
}
}
}
if (enemyName.xVel != 0) {
if (enemyName.stopCount >= 0) {
if (mapHit.hitTest(enemyName.mc._x + enemyName.xVel, enemyName.mc._y - gravity, true) && (mapHit.hitTest(enemyName.mc._x + enemyName.xVel, enemyName.mc._y - 9, true))) {
enemyName.xVel = 0;
enemyName.xDest = enemyName.mc._x;
enemyName.stopCount = -1;
}
}
}
enemyName.mc._x = enemyName.mc._x + enemyName.xVel;
if ((enemyName.xVel != 0) && (enemyName.stopCount < 0)) {
if ((!mapHit.hitTest(enemyName.mc._x, enemyName.mc._y, true)) && (mapHit.hitTest(enemyName.mc._x, enemyName.mc._y + (gravity * 8), true))) {
temp = 0;
while ((temp < (gravity * 8)) && (!mapHit.hitTest(enemyName.mc._x, enemyName.mc._y + temp, true))) {
temp = temp + gravity;
}
enemyName.mc._y = enemyName.mc._y + temp;
}
}
if (!mapHit.hitTest(enemyName.mc._x, (enemyName.mc._y + gravity) + enemyName.yVel, true)) {
enemyName.yVel = enemyName.yVel + gravity;
if (!enemyName.jumping) {
enemyName.mc.gotoAndStop("fall");
}
} else {
enemyName.yVel = enemyName.yVel + (-gravity);
temp = enemyName.yMax;
while (mapHit.hitTest(enemyName.mc._x, enemyName.mc._y + enemyName.yVel, true)) {
enemyName.yVel = enemyName.yVel + (-gravity);
temp = temp + (-gravity);
if (temp < gravity) {
if (!mapHit.hitTest(enemyName.mc._x - 50, enemyName.mc._y - gravity, true)) {
enemyName.mc._x = enemyName.mc._x + -5;
while ((!mapHit.hitTest(enemyName.mc._x - 50, enemyName.mc._y - gravity, true)) && (mapHit.hitTest(enemyName.mc._x, enemyName.mc._y - gravity, true))) {
enemyName.mc._x = enemyName.mc._x + -5;
}
} else {
enemyName.mc._x = enemyName.mc._x + 5;
while ((!mapHit.hitTest(enemyName.mc._x + 50, enemyName.mc._y - gravity, true)) && (mapHit.hitTest(enemyName.mc._x, enemyName.mc._y - gravity, true))) {
enemyName.mc._x = enemyName.mc._x + 5;
}
}
enemyName.xDest = enemyName.mc._x;
enemyName.yVel = -gravity;
break;
}
}
enemyName.yVel = enemyName.yVel + gravity;
enemyName.mc._y = enemyName.mc._y + enemyName.yVel;
if (enemyName.yVel != 0) {
enemyName.mc.gotoAndStop("land");
enemyName.landCount = 6;
}
enemyName.yVel = 0;
enemyName.jumping = false;
}
if (enemyName.yVel < 0) {
if (mapHit.hitTest(enemyName.mc._x, (enemyName.mc._y - enemyName.head) + enemyName.yVel, true)) {
temp = enemyName.yVel + gravity;
enemyName.mc._y = enemyName.mc._y + temp;
enemyName.yVel = 0.001;
while (mapHit.hitTest(enemyName.mc._x, (enemyName.mc._y - enemyName.head) + temp, true)) {
enemyName.mc._y = enemyName.mc._y + gravity;
temp = temp + gravity;
if (mapHit.hitTest(enemyName.mc._x, enemyName.mc._y + gravity, true)) {
if (!mapHit.hitTest(enemyName.mc._x - 50, enemyName.mc._y, true)) {
enemyName.mc._x = enemyName.mc._x + -50;
} else {
enemyName.mc._x = enemyName.mc._x + 50;
}
}
}
}
}
if (enemyName.ySpec > 0) {
enemyName.ySpec--;
}
if (enemyName.ySpec <= 0) {
if (enemyName.yVel > enemyName.yMax) {
enemyName.yVel = enemyName.yMax;
} else if (enemyName.yVel < (-enemyName.yMax)) {
enemyName.yVel = -enemyName.yMax;
}
}
enemyName.mc._y = enemyName.mc._y + enemyName.yVel;
if ((Math.abs(enemyName.mc._x - p1.mc._x) > xCutoff) || (Math.abs(enemyName.mc._y - p1.mc._y) > yCutoff)) {
if (mapHit.hitTest(enemyName.mc._x, enemyName.mc._y, true)) {
enemyName.state = "inactive";
enemyName.mc._visible = false;
}
}
if ((thrownName != null) && (thrownName != enemyName)) {
if (thrownName.actor != "torch") {
if (enemyName.mc.mcHit.hitTest(thrownName.mc.mcHit)) {
enemyName.xVel = thrownName.xVel;
enemyName.yVel = thrownName.yVel;
if (thrownName.xVel != 0) {
thrownName.xVel = (-thrownName.xVel) * 0.8;
} else {
thrownName.xVel = (Math.random() * 16) - 8;
}
thrownName.yVel = (-thrownName.yVel) * 0.8;
if (Math.abs(thrownName.xVel) > 8) {
enemyName.state = "thrown";
enemyName.mc.gotoAndStop("thrown");
if (enemyName.holdName != null) {
enemyName.holdName.state = "thrown";
enemyName.holdName.mc._rotation = 0;
enemyName.holdName.xVel = (Math.random() * 32) - 16;
enemyName.holdName.yVel = (Math.random() * -10) - 12;
enemyName.holdName.grabbedName = null;
enemyName.holdName = null;
enemyName.grabCount = 0;
}
}
}
} else if ((thrownName.state == "thrown") && ((Math.abs(thrownName.xVel) > 6) || (Math.abs(thrownName.yVel) > 6))) {
if (enemyName.mc.mcHit.hitTest(thrownName.mc._x, thrownName.mc._y, true)) {
enemyName.state = "onfire";
enemyName.mc.gotoAndStop("onfire");
enemyName.phaseCount = 180;
thrownName.state = "hit";
thrownName.mc.gotoAndStop("hit");
thrownName.xVel = 0;
thrownName.yVel = 0;
thrownName = null;
if (enemyName.holdName != null) {
enemyName.holdName.state = "thrown";
enemyName.holdName.mc._rotation = 0;
enemyName.holdName.xVel = (Math.random() * 16) - 8;
enemyName.holdName.yVel = (Math.random() * -6) - 12;
enemyName.holdName.grabbedName = null;
enemyName.holdName = null;
enemyName.grabCount = 0;
}
soundFX.attachSound("s_torchhit");
soundFX.start(0, 0);
soundFX.setPan(Math.ceil(((enemyName.mc._x - mcCam._x) / 400) * 100));
soundHoodleyFire.attachSound("s_hoodleyfire");
soundHoodleyFire.start(0, 5);
}
}
}
}
function enemy1_Grabbed(enemyName) {
var _local1 = enemyName;
if (p1.xVel != 0) {
if (((p1.mc._xscale < 0) && (p1.xVel > 0)) || ((p1.mc._xscale > 0) && (p1.xVel < 0))) {
_local1.mc.gotoAndStop("grabbedB");
} else {
_local1.mc.gotoAndStop("grabbedF");
}
} else if (_local1.animHoldIdle <= 0) {
_local1.mc.gotoAndStop("grabbed");
}
if (_local1.grabbedName.mc._xscale > 0) {
_local1.mc._x = _local1.grabbedName.mc._x + _local1.grabbedName.mc.mcMC.mcHand._x;
_local1.mc._xscale = 100;
} else {
_local1.mc._x = _local1.grabbedName.mc._x - _local1.grabbedName.mc.mcMC.mcHand._x;
_local1.mc._xscale = -100;
}
}
function enemy1_Thrown(enemyName) {
var _local1 = enemyName;
if (_local1.xVel > 0) {
if (_local1.yVel != 0) {
_local1.xVel = _local1.xVel / frictionAir;
} else {
_local1.xVel = _local1.xVel / friction;
}
if (_local1.xVel <= 0.3) {
_local1.xVel = 0;
}
} else if (_local1.xVel < 0) {
if (_local1.yVel != 0) {
_local1.xVel = _local1.xVel / frictionAir;
} else {
_local1.xVel = _local1.xVel / friction;
}
if (_local1.xVel >= -0.3) {
_local1.xVel = 0;
}
}
if (_local1.xVel != 0) {
if (mapHit.hitTest(_local1.mc._x + _local1.xVel, _local1.mc._y - (gravity * 2), true)) {
if (_local1.xVel > 0) {
temp = _local1.xVel - _local1.xAcc;
enemyBounceRight(_local1, temp);
} else {
temp = _local1.xVel + _local1.xAcc;
enemyBounceLeft(_local1, temp);
}
if (Math.abs(_local1.xVel) <= 0.3) {
_local1.xVel = 0;
_local1.xDest = _local1.mc._x + 10;
_local1.stopCount = -1;
}
} else if (_local1.xVel > _local1.xMax) {
if (mapHit.hitTest(_local1.mc._x + (_local1.xVel / 2), _local1.mc._y - (gravity * 2), true)) {
temp = (_local1.xVel / 2) - _local1.xAcc;
enemyBounceRight(_local1, temp);
} else if (mapHit.hitTest(_local1.mc._x, _local1.mc._y - (gravity * 2), true)) {
temp = -_local1.xAcc;
enemyBounceRight(_local1, temp);
}
} else if (_local1.xVel < (-_local1.xMax)) {
if (mapHit.hitTest(_local1.mc._x + (_local1.xVel / 2), _local1.mc._y - (gravity * 2), true)) {
temp = (_local1.xVel / 2) + _local1.xAcc;
enemyBounceLeft(_local1, temp);
} else if (mapHit.hitTest(_local1.mc._x, _local1.mc._y - (gravity * 2), true)) {
temp = _local1.xAcc;
enemyBounceLeft(_local1, temp);
}
}
}
_local1.mc._x = _local1.mc._x + _local1.xVel;
if (((_local1.xVel != 0) && (!Key.isDown(_local1.keyLeft))) && (!Key.isDown(_local1.keyRight))) {
if ((!mapHit.hitTest(_local1.mc._x, _local1.mc._y, true)) && (mapHit.hitTest(_local1.mc._x, _local1.mc._y + (gravity * 8), true))) {
temp = 0;
while ((temp < (gravity * 8)) && (!mapHit.hitTest(_local1.mc._x, _local1.mc._y + temp, true))) {
temp = temp + gravity;
}
_local1.mc._y = _local1.mc._y + temp;
}
}
if (_local1.yVel > _local1.yMax) {
_local1.yVel = _local1.yMax;
}
if (!mapHit.hitTest(_local1.mc._x, (_local1.mc._y + gravity) + _local1.yVel, true)) {
_local1.mc.gotoAndStop("thrown");
if (_local1.yVel > 20) {
if (_local1.yVel > 20) {
if (!mapHit.hitTest(_local1.mc._x, (_local1.mc._y + gravity) + (_local1.yVel / 2), true)) {
_local1.yVel = _local1.yVel + gravity;
if (_local1.yVel > gravity) {
_local1.jumping = false;
}
if (!_local1.jumping) {
}
} else {
enemy0HitGround(_local1);
_local1._y = _local1._y + (-gravity);
}
}
} else {
_local1.yVel = _local1.yVel + gravity;
if (_local1.yVel > gravity) {
_local1.jumping = false;
}
if (!_local1.jumping) {
}
}
} else {
enemy0HitGround(_local1);
_local1.mc.gotoAndStop("bouncing");
_local1.animHoldIdle = 4;
if (_local1.xVel == 0) {
if (!mapHit.hitTest(_local1.mc._x - 10, _local1.mc._y + 3, true)) {
_local1.xVel = _local1.yVel * 2;
} else if (!mapHit.hitTest(_local1.mc._x - 20, _local1.mc._y + 3, true)) {
_local1.xVel = _local1.yVel;
} else if (!mapHit.hitTest(_local1.mc._x - 40, _local1.mc._y + 3, true)) {
_local1.xVel = _local1.yVel / 2;
} else if (!mapHit.hitTest(_local1.mc._x + 10, _local1.mc._y + 3, true)) {
_local1.xVel = (-_local1.yVel) * 2;
} else if (!mapHit.hitTest(_local1.mc._x + 20, _local1.mc._y + 3, true)) {
_local1.xVel = -_local1.yVel;
} else if (!mapHit.hitTest(_local1.mc._x + 40, _local1.mc._y + 3, true)) {
_local1.xVel = (-_local1.yVel) / 2;
}
}
}
if (_local1.yVel < 0) {
if (mapHit.hitTest(_local1.mc._x, (_local1.mc._y - _local1.head) + _local1.yVel, true)) {
temp = _local1.yVel + gravity;
_local1.mc._y = _local1.mc._y + temp;
_local1.yVel = 0.001;
while (mapHit.hitTest(_local1.mc._x, (_local1.mc._y - _local1.head) + temp, true)) {
_local1.mc._y = _local1.mc._y + gravity;
temp = temp + gravity;
}
}
}
_local1.mc._y = _local1.mc._y + _local1.yVel;
if ((_local1.xVel == 0) && (_local1.yVel == 0)) {
if (thrownName == _local1) {
thrownName = null;
}
_local1.state = "down";
} else {
_local1.phaseCount = 30;
}
}
function enemy1_Hit(enemyName) {
var _local1 = enemyName;
_local1.hitCount--;
if (_local1.hitCount <= 0) {
if (_local1.yVel != 0) {
_local1.mc.gotoAndStop("fall");
} else {
_local1.mc.gotoAndStop("idle");
}
_local1.state = "normal";
} else {
_local1.mc.gotoAndStop("hit2");
if (_local1.xVel > 0) {
if (_local1.yVel != 0) {
_local1.xVel = _local1.xVel / frictionAir;
} else {
_local1.xVel = _local1.xVel / friction;
}
if (_local1.xVel <= 0.9) {
_local1.xVel = 0;
}
} else if (_local1.xVel < 0) {
if (_local1.yVel != 0) {
_local1.xVel = _local1.xVel / frictionAir;
} else {
_local1.xVel = _local1.xVel / friction;
}
if (_local1.xVel >= -0.9) {
_local1.xVel = 0;
}
}
if (_local1.xVel != 0) {
if (_local1.stopCount >= 0) {
if (mapHit.hitTest(_local1.mc._x + _local1.xVel, _local1.mc._y - gravity, true)) {
_local1.xVel = 0;
_local1.xDest = _local1.mc._x - 10;
_local1.stopCount = -1;
}
}
}
_local1.mc._x = _local1.mc._x + _local1.xVel;
if ((_local1.xVel != 0) && (_local1.stopCount < 0)) {
if ((!mapHit.hitTest(_local1.mc._x, _local1.mc._y, true)) && (mapHit.hitTest(_local1.mc._x, _local1.mc._y + (gravity * 8), true))) {
temp = 0;
while ((temp < (gravity * 8)) && (!mapHit.hitTest(_local1.mc._x, _local1.mc._y + temp, true))) {
temp = temp + gravity;
}
_local1.mc._y = _local1.mc._y + temp;
}
}
if (!mapHit.hitTest(_local1.mc._x, (_local1.mc._y + gravity) + _local1.yVel, true)) {
_local1.yVel = _local1.yVel + gravity;
if (!_local1.jumping) {
}
} else {
_local1.yVel = _local1.yVel + (-gravity);
temp = _local1.yMax;
while (mapHit.hitTest(_local1.mc._x, _local1.mc._y + _local1.yVel, true)) {
_local1.yVel = _local1.yVel + (-gravity);
temp = temp + (-gravity);
if (temp < gravity) {
if (!mapHit.hitTest(_local1.mc._x - 50, _local1.mc._y + _local1.head, true)) {
_local1.mc._x = _local1.mc._x + -50;
} else if (!mapHit.hitTest(_local1.mc._x + 50, _local1.mc._y + _local1.head, true)) {
_local1.mc._x = _local1.mc._x + 50;
}
_local1.yVel = 0;
break;
}
}
_local1.yVel = _local1.yVel + gravity;
_local1.mc._y = _local1.mc._y + _local1.yVel;
if (_local1.yVel != 0) {
_local1.landCount = 6;
}
_local1.yVel = 0;
_local1.jumping = false;
}
if (_local1.ySpec <= 0) {
if (_local1.yVel > _local1.yMax) {
_local1.yVel = _local1.yMax;
} else if (_local1.yVel < (-_local1.yMax)) {
_local1.yVel = -_local1.yMax;
}
}
_local1.mc._y = _local1.mc._y + _local1.yVel;
}
}
function enemy1_Falldown(enemyName) {
var _local1 = enemyName;
_local1.hitCount--;
if ((_local1.hitCount <= 0) && (_local1.yVel == 0)) {
if (_local1.hp > 0) {
_local1.hitCount = 12;
_local1.mc.gotoAndStop("getup");
_local1.state = "getup";
}
}
if (_local1.xVel > 0) {
if (_local1.yVel != 0) {
_local1.xVel = _local1.xVel / frictionAir;
} else {
_local1.xVel = _local1.xVel / friction;
}
if (_local1.xVel <= 0.9) {
_local1.xVel = 0;
}
} else if (_local1.xVel < 0) {
if (_local1.yVel != 0) {
_local1.xVel = _local1.xVel / frictionAir;
} else {
_local1.xVel = _local1.xVel / friction;
}
if (_local1.xVel >= -0.9) {
_local1.xVel = 0;
}
}
if (_local1.xVel != 0) {
if (_local1.stopCount >= 0) {
if (mapHit.hitTest(_local1.mc._x + _local1.xVel, _local1.mc._y - gravity, true)) {
_local1.xVel = 0;
_local1.xDest = _local1.mc._x;
_local1.stopCount = -1;
}
}
}
_local1.mc._x = _local1.mc._x + _local1.xVel;
if ((_local1.xVel != 0) && (_local1.stopCount < 0)) {
if ((!mapHit.hitTest(_local1.mc._x, _local1.mc._y, true)) && (mapHit.hitTest(_local1.mc._x, _local1.mc._y + (gravity * 8), true))) {
temp = 0;
while ((temp < (gravity * 8)) && (!mapHit.hitTest(_local1.mc._x, _local1.mc._y + temp, true))) {
temp = temp + gravity;
}
_local1.mc._y = _local1.mc._y + temp;
}
}
if (!mapHit.hitTest(_local1.mc._x, (_local1.mc._y + gravity) + _local1.yVel, true)) {
_local1.yVel = _local1.yVel + gravity;
if (!_local1.jumping) {
}
if (_local1.yVel > 0) {
_local1.fallTime++;
}
} else {
_local1.yVel = _local1.yVel + (-gravity);
temp = _local1.yMax;
while (mapHit.hitTest(_local1.mc._x, _local1.mc._y + _local1.yVel, true)) {
_local1.yVel = _local1.yVel + (-gravity);
temp = temp + (-gravity);
if (temp < gravity) {
if (!mapHit.hitTest(_local1.mc._x - 50, _local1.mc._y + _local1.head, true)) {
_local1.mc._x = _local1.mc._x + -50;
} else if (!mapHit.hitTest(_local1.mc._x + 50, _local1.mc._y + _local1.head, true)) {
_local1.mc._x = _local1.mc._x + 50;
}
_local1.yVel = 0;
break;
}
}
_local1.yVel = _local1.yVel + gravity;
_local1.mc._y = _local1.mc._y + _local1.yVel;
if (_local1.yVel != 0) {
}
_local1.yVel = 0;
_local1.jumping = false;
_local1.fallTime = 0;
}
if (_local1.ySpec <= 0) {
if (_local1.yVel > _local1.yMax) {
_local1.yVel = _local1.yMax;
} else if (_local1.yVel < (-_local1.yMax)) {
_local1.yVel = -_local1.yMax;
}
}
_local1.mc._y = _local1.mc._y + _local1.yVel;
}
function enemy1_Getup(enemyName) {
var _local1 = enemyName;
_local1.hitCount--;
if (_local1.hitCount <= 0) {
_local1.mc.gotoAndStop("idle");
_local1.state = "normal";
}
}
function enemy1_Choking(enemyName) {
var _local1 = enemyName;
if (_local1.mc._xscale < 0) {
_local1.mc._x = p1.mc._x - p1.mc.mcMC.mcHand;
} else {
_local1.mc._x = p1.mc._x + p1.mc.mcMC.mcHand;
}
if (_local1.phaseCount <= 0) {
p1.holdName = null;
_local1.state = "clothes";
soundFX.attachSound("s_choke2");
soundFX.start(0, 0);
}
}
function enemy1_Down(enemyName) {
var _local1 = enemyName;
if (_local1.animHoldIdle <= 0) {
_local1.mc.gotoAndStop("down");
}
if (_local1.phaseCount <= 0) {
_local1.state = "normal";
_local1.mc.gotoAndStop("getup");
_local1.animHoldIdle = 23;
_local1.animHoldWalk = 23;
_local1.xSpec = 23;
_local1.mc.swapDepths(_local1.depth0);
_local1.phase = 2;
_local1.phaseCount = 300;
_local1.xDest = _local1.mc._x;
_local1.stopCount = -1;
}
}
function enemy1_Onfire(enemyName) {
var _local1 = enemyName;
var _local2 = this;
if (_local1.phaseCount > 0) {
temp = 1;
while (temp <= projectiles) {
temp2 = "proj_" + temp;
temp2 = _local2[temp2];
if ((temp2.mc._x != undefined) && (temp2.state == "thrown")) {
if (Math.abs(temp2.mc._x - _local1.mc._x) < 300) {
if (_local1.mc.mcHit.hitTest(temp2.mc._x, temp2.mc._y, true)) {
_local1.xVel = temp2.xVel;
_local1.yVel = -6 - (Math.random() * 8);
_local1.state = "thrown";
_local1.mc.gotoAndStop("thrown");
temp2.state = "hit";
temp2.phaseCount = -123;
}
}
}
temp++;
}
if (p1.headbouncing == 1) {
if (_local1.mc.mcHit.hitTest(p1.mc._x, p1.mc._y, true)) {
p1.headbouncing = 2;
p1.mc._y = _local1.mc._y - _local1.head;
_local1.mc.gotoAndStop("drop");
_local1.animHoldIdle = 19;
_local1.xVel = 0;
_local1.state = "down";
_local1.phaseCount = 90;
_local1.holdName.mc.swapDepths(_local1.holdName.mc.getDepth() + enemyDeadOffset);
}
}
if (_local1.state == "onfire") {
soundHoodleyFire.setPan(Math.ceil(((_local1.mc._x - mcCam._x) / 400) * 100));
soundHoodleyFire.setVolume(Math.abs(100 - Math.abs(Math.ceil(((_local1.mc._x - mcCam._x) / 400) * 100))) + 30);
if (Math.abs(_local1.mc._x - _local1.xDest) < 5) {
_local1.mc._x = _local1.xDest;
_local1.xVel = 0;
if (Math.random() > 0.5) {
_local1.xDest = (_local1.mc._x + (Math.random() * 100)) + 60;
} else {
_local1.xDest = (_local1.mc._x - (Math.random() * 100)) - 60;
}
if ((_local1.mc._xscale > 0) && (_local1.xDest < _local1.mc._x)) {
_local1.mc._xscale = -100;
_local1.mc.gotoAndStop("turnFire");
_local1.animHoldWalk = 2;
} else if ((_local1.mc._xscale < 0) && (_local1.xDest > _local1.mc._x)) {
_local1.mc._xscale = 100;
_local1.mc.gotoAndStop("turnFire");
_local1.animHoldWalk = 2;
} else {
_local1.gotoAndStop("onfire");
}
}
if (_local1.mc._xscale < 0) {
if (mapHit.hitTest(_local1.mc._x, _local1.mc._y + gravity, true)) {
if (_local1.animHoldWalk <= 0) {
_local1.mc.gotoAndStop("onfire");
}
temp = _local1.xVel - _local1.xAcc;
if (temp < (-_local1.xFireMax)) {
temp = -_local1.xFireMax;
}
enemy1Walk(_local1, -100, temp, 4);
} else {
temp = _local1.xVel - _local1.xAirAcc;
if (temp < (-_local1.xFireMax)) {
temp = -_local1.xFireMax;
}
if (((!mapHit.hitTest(_local1.mc._x + temp, _local1.mc._y, true)) && (!mapHit.hitTest(_local1.mc._x + temp, _local1.mc._y - (_local1.head / 2), true))) && (!mapHit.hitTest(_local1.mc._x + temp, (_local1.mc._y - _local1.head) + 6, true))) {
if (_local1.xVel < (-_local1.xFireMax)) {
if (((!mapHit.hitTest(_local1.mc._x + (temp / 2), _local1.mc._y, true)) && (!mapHit.hitTest(_local1.mc._x + (temp / 2), _local1.mc._y - (_local1.head / 2), true))) && (!mapHit.hitTest(_local1.mc._x + (temp / 2), (_local1.mc._y - _local1.head) + 6, true))) {
_local1.xVel = _local1.xVel + (-_local1.xAirAcc);
}
} else {
_local1.xVel = _local1.xVel + (-_local1.xAirAcc);
}
} else {
_local1.xVel = 0;
}
}
} else if (_local1.mc._xscale > 0) {
if (mapHit.hitTest(_local1.mc._x, _local1.mc._y + gravity, true)) {
if (_local1.animHoldWalk <= 0) {
_local1.mc.gotoAndStop("onfire");
}
temp = _local1.xVel + _local1.xAcc;
if (temp > _local1.xFireMax) {
temp = _local1.xFireMax;
}
enemy1Walk(_local1, 100, temp, 4);
} else {
temp = _local1.xVel + _local1.xAirAcc;
if (temp > _local1.xFireMax) {
temp = _local1.xFireMax;
}
if (((!mapHit.hitTest(_local1.mc._x + temp, _local1.mc._y, true)) && (!mapHit.hitTest(_local1.mc._x + temp, _local1.mc._y - (_local1.head / 2), true))) && (!mapHit.hitTest(_local1.mc._x + temp, (_local1.mc._y - _local1.head) + 6, true))) {
if (_local1.xVel > _local1.xFireMax) {
if (((!mapHit.hitTest(_local1.mc._x + (temp / 2), _local1.mc._y, true)) && (!mapHit.hitTest(_local1.mc._x + (temp / 2), _local1.mc._y - (_local1.head / 2), true))) && (!mapHit.hitTest(_local1.mc._x + (temp / 2), (_local1.mc._y - _local1.head) + 6, true))) {
_local1.xVel = _local1.xVel + _local1.xAirAcc;
}
} else {
_local1.xVel = _local1.xVel + _local1.xAirAcc;
}
} else {
_local1.xVel = 0;
}
}
}
if (_local1.xSpec > 0) {
_local1.xSpec--;
}
if (_local1.xSpec <= 0) {
if (_local1.xVel > _local1.xFireMax) {
_local1.xVel = _local1.xFireMax + ((_local1.xFireMax - _local1.xVel) / 8);
} else if (_local1.xVel < (-_local1.xFireMax)) {
_local1.xVel = (-_local1.xFireMax) + ((_local1.xVel + _local1.xFireMax) / 8);
}
}
}
if (_local1.xVel != 0) {
if (mapHit.hitTest(_local1.mc._x + _local1.xVel, _local1.mc._y - gravity, true)) {
_local1.xVel = 0;
}
}
_local1.mc._x = _local1.mc._x + _local1.xVel;
if (_local1.xVel != 0) {
if ((!mapHit.hitTest(_local1.mc._x, _local1.mc._y, true)) && (mapHit.hitTest(_local1.mc._x, _local1.mc._y + (gravity * 8), true))) {
temp = 0;
while ((temp < (gravity * 8)) && (!mapHit.hitTest(_local1.mc._x, _local1.mc._y + temp, true))) {
temp = temp + gravity;
}
_local1.mc._y = _local1.mc._y + temp;
}
}
if (!mapHit.hitTest(_local1.mc._x, (_local1.mc._y + gravity) + _local1.yVel, true)) {
_local1.yVel = _local1.yVel + gravity;
} else {
_local1.yVel = _local1.yVel + (-gravity);
temp = _local1.yMax;
while (mapHit.hitTest(_local1.mc._x, _local1.mc._y + _local1.yVel, true)) {
_local1.yVel = _local1.yVel + (-gravity);
temp = temp + (-gravity);
if (temp < gravity) {
if (!mapHit.hitTest(_local1.mc._x - 50, _local1.mc._y + 10, true)) {
_local1.mc._x = _local1.mc._x + -50;
} else {
_local1.mc._x = _local1.mc._x + 50;
}
_local1.yVel = 0;
break;
}
}
_local1.yVel = _local1.yVel + gravity;
_local1.mc._y = _local1.mc._y + _local1.yVel;
_local1.yVel = 0;
_local1.jumping = false;
}
if (_local1.yVel < 0) {
if (mapHit.hitTest(_local1.mc._x, (_local1.mc._y - _local1.head) + _local1.yVel, true)) {
temp = _local1.yVel + gravity;
_local1.mc._y = _local1.mc._y + temp;
_local1.yVel = 0.001;
while (mapHit.hitTest(_local1.mc._x, (_local1.mc._y - _local1.head) + temp, true)) {
_local1.mc._y = _local1.mc._y + gravity;
temp = temp + gravity;
}
}
}
if (_local1.ySpec > 0) {
_local1.ySpec--;
}
if (_local1.ySpec <= 0) {
if (_local1.yVel > _local1.yMax) {
_local1.yVel = _local1.yMax;
} else if (_local1.yVel < (-_local1.yMax)) {
_local1.yVel = -_local1.yMax;
}
}
_local1.mc._y = _local1.mc._y + _local1.yVel;
if ((Math.abs(_local1.mc._x - p1.mc._x) > xCutoff) || (Math.abs(_local1.mc._y - p1.mc._y) > yCutoff)) {
_local1.mc._visible = false;
} else if (Math.random() > 0.75) {
makeFX("fire", (_local1.mc._x - 16) + (Math.random() * 32), (_local1.mc._y - 6) - (Math.random() * 30));
}
if ((thrownName != null) && (thrownName != _local1)) {
if (thrownName.actor != "torch") {
if (_local1.mc.mcHit.hitTest(thrownName.mc.mcHit)) {
_local1.xVel = thrownName.xVel;
_local1.yVel = thrownName.yVel;
thrownName.xVel = (-thrownName.xVel) * 0.8;
thrownName.yVel = (-thrownName.yVel) * 0.8;
}
} else if ((thrownName.state == "thrown") && ((Math.abs(thrownName.xVel) > 6) || (Math.abs(thrownName.yVel) > 6))) {
if (_local1.mc.mcHit.hitTest(thrownName.mc._x, thrownName.mc._y, true)) {
_local1.state = "onfire";
_local1.mc.gotoAndStop("onfire");
_local1.phaseCount = 120;
thrownName.state = "hit";
thrownName.mc.gotoAndStop("hit");
thrownName.xVel = 0;
thrownName.yVel = 0;
thrownName = null;
}
}
}
} else {
_local1.state = "normal";
_local1.phase = 2;
_local1.phaseCount = 300;
_local1.mc.gotoAndStop("idle2");
}
}
function enemy1_Whacked(enemyName) {
var _local1 = enemyName;
if (_local1.phaseCount == 25) {
shakeCam = 10;
} else if (_local1.phaseCount <= 0) {
_local1.mc._visible = false;
_local1.mc._x = -50000;
_local1.mc._y = -50000;
_local1.state = "dead";
}
}
function enemy1Walk(enemyName, bDirection, velocity, xBuffer) {
var _local1 = enemyName;
var _local2 = velocity;
var _local3 = xBuffer;
if (bDirection < 0) {
if ((!mapHit.hitTest((_local1.mc._x - _local3) + _local2, _local1.mc._y, true)) && (mapHit.hitTest((_local1.mc._x - _local3) + _local2, _local1.mc._y + (gravity * 8), true))) {
_local1.xVel = _local2;
_local1.mc._y = _local1.mc._y + gravity;
_local2 = 0;
while ((_local2 < (gravity * 8)) && (!mapHit.hitTest((_local1.mc._x - _local3) + _local1.xVel, _local1.mc._y + _local2, true))) {
_local2 = _local2 + gravity;
}
_local1.mc._y = _local1.mc._y + _local2;
} else if ((!mapHit.hitTest((_local1.mc._x - _local3) + _local2, _local1.mc._y - gravity, true)) && (mapHit.hitTest(((_local1.mc._x - _local3) - _local1.xAcc) + _local2, _local1.mc._y + gravity, true))) {
_local1.xVel = _local2;
} else if ((!mapHit.hitTest((_local1.mc._x - _local3) + _local2, _local1.mc._y - 9, true)) && (mapHit.hitTest((_local1.mc._x - _local3) + _local2, _local1.mc._y, true))) {
_local1.xVel = _local2;
_local2 = gravity * 2;
while (mapHit.hitTest((_local1.mc._x - _local3) + _local1.xVel, _local1.mc._y - _local2, true)) {
_local2 = _local2 + gravity;
}
if (_local1.xVel > (-_local1.xAcc)) {
_local1.xVel = -_local1.xAcc;
}
_local1.mc._y = _local1.mc._y + ((-_local2) + gravity);
_local1.yVel = 0;
} else {
if (_local1.xVel > 0) {
if (mapHit.hitTest((_local1.mc._x + _local3) + _local1.xVel, _local1.mc._y - gravity, true)) {
_local2 = _local1.xVel - _local1.xAcc;
do {
if (!mapHit.hitTest((_local1.mc._x + _local3) + _local2, _local1.mc._y - gravity, true)) {
break;
}
_local2 = _local2 + (-_local1.xAcc);
} while (_local2 >= 0);
_local1.mc._x = _local1.mc._x + _local2;
}
} else if (mapHit.hitTest((_local1.mc._x - _local3) + _local1.xVel, _local1.mc._y - gravity, true)) {
_local2 = _local1.xVel + _local1.xAcc;
do {
if (!mapHit.hitTest((_local1.mc._x - _local3) + _local2, _local1.mc._y - gravity, true)) {
break;
}
_local2 = _local2 + _local1.xAcc;
} while (_local2 <= 0);
_local1.mc._x = _local1.mc._x + _local2;
}
_local1.xVel = 0;
_local1.stopCount = 60 + Math.ceil(Math.random() * 30);
if ((_local1.state == "normal") && (_local1.phase == 1)) {
_local1.mc.gotoAndStop("idle");
} else if ((_local1.state == "normal") && (_local1.phase == 2)) {
_local1.mc.gotoAndStop("idle2");
}
}
} else if ((!mapHit.hitTest((_local1.mc._x + _local3) + _local2, _local1.mc._y, true)) && (mapHit.hitTest((_local1.mc._x + _local3) + _local2, _local1.mc._y + (gravity * 8), true))) {
_local1.xVel = _local2;
_local1.mc._y = _local1.mc._y + gravity;
_local2 = 0;
while ((_local2 < (gravity * 8)) && (!mapHit.hitTest((_local1.mc._x + _local3) + _local1.xVel, _local1.mc._y + _local2, true))) {
_local2 = _local2 + gravity;
}
_local1.mc._y = _local1.mc._y + _local2;
} else if ((!mapHit.hitTest((_local1.mc._x + _local3) + _local2, _local1.mc._y - gravity, true)) && (mapHit.hitTest(((_local1.mc._x + _local3) + _local1.xAcc) + _local2, _local1.mc._y + gravity, true))) {
_local1.xVel = _local2;
} else if ((!mapHit.hitTest((_local1.mc._x + _local3) + _local2, _local1.mc._y - 9, true)) && (mapHit.hitTest((_local1.mc._x + _local3) + _local2, _local1.mc._y, true))) {
_local1.xVel = _local2;
_local2 = gravity * 2;
while (mapHit.hitTest((_local1.mc._x + _local3) + _local1.xVel, _local1.mc._y - _local2, true)) {
_local2 = _local2 + gravity;
}
if (_local1.xVel < _local1.xAcc) {
_local1.xVel = _local1.xAcc;
}
_local1.mc._y = _local1.mc._y + ((-_local2) + gravity);
_local1.yVel = 0;
} else {
if (_local1.xVel > 0) {
if (mapHit.hitTest((_local1.mc._x + _local3) + _local1.xVel, _local1.mc._y - gravity, true)) {
_local2 = _local1.xVel - _local1.xAcc;
do {
if (!mapHit.hitTest((_local1.mc._x + _local3) + _local2, _local1.mc._y - gravity, true)) {
break;
}
_local2 = _local2 + (-_local1.xAcc);
} while (_local2 >= 0);
_local1.mc._x = _local1.mc._x + _local2;
}
} else if (mapHit.hitTest((_local1.mc._x - _local3) + _local1.xVel, _local1.mc._y - gravity, true)) {
_local2 = _local1.xVel + _local1.xAcc;
do {
if (!mapHit.hitTest((_local1.mc._x + _local3) + _local2, _local1.mc._y - gravity, true)) {
break;
}
_local2 = _local2 + _local1.xAcc;
} while (_local2 <= 0);
_local1.mc._x = _local1.mc._x + _local2;
}
_local1.xVel = 0;
_local1.stopCount = 60 + Math.ceil(Math.random() * 30);
if ((_local1.state == "normal") && (_local1.phase == 1)) {
_local1.mc.gotoAndStop("idle");
} else if ((_local1.state == "normal") && (_local1.phase == 2)) {
_local1.mc.gotoAndStop("idle2");
}
}
}
function enemy1Jump(enemyName) {
with (enemyName) {
jumping = true;
crouched = false;
jumpPressed = true;
yVel = -20;
animHoldAir = 10;
mc.gotoAndStop("jump");
}
}
function enemy1_grabCheck(enemyName) {
var _local1 = enemyName;
if ((((p1.holdName == null) && (p1.grabCount > 0)) && (p1.yVel == 0)) && (p1.mc.mcMC.mcGrab._x != undefined)) {
if ((((_local1.mc._xscale > 0) && (p1.mc._xscale > 0)) && (p1.mc._x < _local1.mc._x)) || (((_local1.mc._xscale < 0) && (p1.mc._xscale < 0)) && (p1.mc._x > _local1.mc._x))) {
if (p1.mc._xscale > 0) {
temp = p1.mc.mcMC.mcGrab._x;
} else {
temp = -p1.mc.mcMC.mcGrab._x;
}
if (_local1.mc.mcHit.hitTest(p1.mc._x + temp, p1.mc._y + p1.mc.mcMC.mcGrab._y, true)) {
_local1.state = "grabbed";
_local1.xVel = 0;
_local1.mc.gotoAndStop("grabbed0");
_local1.animHoldIdle = 10;
_local1.grabbedName = p1;
p1.holdName = _local1;
p1.windup = 0;
p1.mc.gotoAndStop("grabIdleFinish");
p1.animHoldIdle = 10;
p1.state = "grabbing";
if (_local1.holdName != null) {
_local1.holdName.state = "thrown";
_local1.holdName.mc._rotation = 0;
if (_local1.mc._xscale > 0) {
_local1.holdName.xVel = 6;
} else {
_local1.holdName.xVel = -6;
}
_local1.holdName.yVel = -8;
_local1.holdName.grabbedName = null;
_local1.holdName = null;
_local1.grabCount = 0;
}
soundFX.attachSound("s_grabbed");
soundFX.start(0, 0);
}
}
}
}
function enemy1_getHit(enemyName) {
var _local1 = enemyName;
if (p1.whacking == 3) {
_local1.state = "whacked";
_local1.mc.gotoAndStop("whacked");
_local1.mc.swapDepths(topDepth);
_local1.phaseCount = 34;
if (_local1.holdName != null) {
_local1.holdName.state = "thrown";
_local1.holdName.mc._rotation = 0;
if (_local1.mc._xscale > 0) {
_local1.holdName.xVel = (Math.random() * 4) + 4;
} else {
_local1.holdName.xVel = (Math.random() * -4) - 4;
}
_local1.holdName.yVel = (Math.random() * -6) - 8;
_local1.holdName.grabbedName = null;
_local1.holdName = null;
_local1.grabCount = 0;
}
soundFX.attachSound("s_whacked");
soundFX.start(0, 0);
} else if (p1.finalHit) {
if (p1.mc._x <= _local1.mc._x) {
_local1.xVel = 10;
} else {
_local1.xVel = -10;
}
_local1.hitCount = 22;
_local1.mc.gotoAndStop("falldown");
_local1.state = "falldown";
} else {
if (p1.mc._x <= _local1.mc._x) {
_local1.xVel = p1.xForce;
} else {
_local1.xVel = -p1.xForce;
}
_local1.yVel = p1.yForce;
_local1.hitCount = p1.hitHold;
_local1.state = "hit";
}
}
function enemy1_projectileHit(enemyName) {
var _local1 = enemyName;
_local1.xVel = temp2.xVel;
_local1.yVel = -6 - (Math.random() * 8);
_local1.state = "thrown";
_local1.mc.gotoAndStop("thrown");
if (_local1.holdName != null) {
_local1.holdName.state = "thrown";
_local1.holdName.mc._rotation = 0;
_local1.holdName.xVel = (Math.random() * 10) + _local1.xVel;
_local1.holdName.yVel = (Math.random() * -6) - 10;
_local1.holdName.grabbedName = null;
_local1.holdName = null;
_local1.grabCount = 0;
}
if (temp2.projType == "fireball") {
temp2.state = "hit";
temp2.mc.gotoAndStop("hit");
temp2.phaseCount = -123;
makeFX("fire", (temp2.mc._x - 16) + (Math.random() * 32), (temp2.mc._y - 8) + (Math.random() * 16));
makeFX("fire", (temp2.mc._x - 16) + (Math.random() * 32), (temp2.mc._y - 8) + (Math.random() * 16));
soundFX.attachSound("s_hoodleyhit");
soundFX.start(0, 0);
soundFX.setPan(Math.ceil(((_local1.mc._x - mcCam._x) / 400) * 100));
} else if (temp2.projType == "wind") {
temp2.state = "hit";
temp2.mc.gotoAndStop("hit");
temp2.phaseCount = -123;
soundFX.attachSound("s_hoodleyhit");
soundFX.start(0, 0);
soundFX.setPan(Math.ceil(((_local1.mc._x - mcCam._x) / 400) * 100));
} else if (temp2.projType == "lightning") {
temp2.state = "hit";
temp2.mc.gotoAndStop("hit");
temp2.phaseCount = -123;
soundFX.attachSound("s_lightninghit");
soundFX.start(0, 0);
soundFX.setPan(Math.ceil(((_local1.mc._x - mcCam._x) / 400) * 100));
}
}
function enemy1_grabStaff(enemyName) {
var _local1 = enemyName;
var _local2 = this;
temp = 1;
while (temp <= staffs) {
temp2 = "staff_" + temp;
temp2 = _local2[temp2];
if (((temp2.grabbedName == null) && (temp2.state == "normal")) && (_local1.mc.mcMC.mcGrab != undefined)) {
if (_local1.mc._xscale > 0) {
temp = _local1.mc.mcMC.mcGrab._x;
} else {
temp = -_local1.mc.mcMC.mcGrab._x;
}
if (temp2.mc.mcHit.hitTest(_local1.mc._x + temp, _local1.mc._y + _local1.mc.mcMC.mcGrab._y, true)) {
temp2.state = "grabbed";
temp2.grabbedName = _local1;
temp2.mc.swapDepths(_local1.depth0 + 1);
temp2.depth = _local1.depth0 + 1;
_local1.holdName = temp2;
_local1.grabCount = 0;
return;
}
}
temp++;
}
}
function enemy1_headbounced(enemyName) {
var _local1 = enemyName;
p1.headbouncing = 2;
p1.mc._y = _local1.mc._y - _local1.head;
_local1.mc.gotoAndStop("drop");
_local1.animHoldIdle = 19;
_local1.xVel = 0;
_local1.state = "down";
_local1.phaseCount = 90;
_local1.holdName.mc.swapDepths(_local1.holdName.mc.getDepth() + enemyDeadOffset);
if (_local1.holdName != null) {
_local1.holdName.state = "thrown";
_local1.holdName.mc._rotation = 0;
_local1.holdName.yVel = (Math.random() * 4) + 6;
_local1.holdName.grabbedName = null;
_local1.holdName = null;
_local1.grabCount = 0;
}
soundFX.attachSound("s_headbounce");
soundFX.start(0, 0);
}
function enemy1_alerted(enemyName) {
with (enemyName) {
alertTime = 0;
phase = 2;
xVel = 0;
stopCount = 15;
mc.gotoAndStop("alert");
animHoldIdle = 8;
phaseCount = 300;
xDest = p1.mc._x;
}
soundHuntCount++;
}
function getHyp(x1, y1, rot, scale) {
var _local3 = rot;
var _local1 = {x:x1, y:y1};
var _local2 = (scale / 100) * Math.sqrt((x1 * x1) + (y1 * y1));
if (scale > 0) {
_local1.x = Math.cos((_local3 - 80) / 57.3) * _local2;
_local1.y = Math.sin((_local3 - 80) / 57.3) * _local2;
} else {
_local1.x = Math.cos((_local3 - 100) / 57.3) * _local2;
_local1.y = Math.sin((_local3 - 100) / 57.3) * _local2;
}
return(_local1);
}
function makeFire(baseName, rot) {
var _local2 = baseName;
var _local3 = _root;
if (!_local3.paused) {
x1 = _local2.mc._x;
y1 = _local2.mc._y;
if ((Math.abs(x1 - _local3.mcCam._x) < 220) && (Math.abs(y1 - _local3.mcCam._y) < 120)) {
fireNum++;
if (fireNum > fireMax) {
fireNum = 1;
}
if ((_local3.count % 2) == 0) {
var _local1 = getHyp(_local2.mc.mcMC.mcFire._x, _local2.mc.mcMC.mcFire._y, rot, _local2.mc._xscale);
if (_local2.mc._xscale > 0) {
_local1.x = x1 + _local1.x;
_local1.y = y1 + _local1.y;
} else {
_local1.x = x1 - _local1.x;
_local1.y = y1 - _local1.y;
}
rand = Math.random();
temp = (rand * 20) + 60;
var depth = _local2.depth;
_local3.mcAll.mcMain.firePart.duplicateMovieClip("firePart" + fireNum, ((depth - 1000) + 100) + fireNum, {_x:_local1.x, _y:_local1.y, _xscale:temp, _yscale:temp});
temp = temp + 3;
_local3.mcAll.mcMain.firePartBack.duplicateMovieClip("firePartBack" + fireNum, (depth - 1000) + fireNum, {_x:_local1.x, _y:_local1.y, _xscale:temp, _yscale:temp});
temp = (Math.random() * 15) + 50;
_local3.mcAll.mcMain.firePartWhite.duplicateMovieClip("firePartWhite" + fireNum, ((depth - 1000) + 200) + fireNum, {_x:_local1.x, _y:_local1.y, _xscale:temp, _yscale:temp});
}
}
}
}
function makeFX(fxType, x, y) {
var _local2 = _root;
var _local3 = y;
if (!_local2.paused) {
rand = Math.random();
var _local1 = torchDepth;
if (!(fxType === "fire")) {
} else {
fireNum++;
if (fireNum > fireMax) {
fireNum = 1;
}
temp = (rand * 20) + 60;
_local2.mcAll.mcMain.firePart.duplicateMovieClip("firePart" + fireNum, ((_local1 - 1000) + 100) + fireNum, {_x:x, _y:_local3, _xscale:temp, _yscale:temp});
temp = temp + 3;
_local2.mcAll.mcMain.firePartBack.duplicateMovieClip("firePartBack" + fireNum, (_local1 - 1000) + fireNum, {_x:x, _y:_local3, _xscale:temp, _yscale:temp});
temp = (Math.random() * 15) + 50;
_local2.mcAll.mcMain.firePartWhite.duplicateMovieClip("firePartWhite" + fireNum, ((_local1 - 1000) + 200) + fireNum, {_x:x, _y:_local3, _xscale:temp, _yscale:temp});
}
}
}
function staffAttack(staffName1, direction, hitTarget, xSpeed) {
var _local2 = this;
var _local3 = staffName1;
_local3.mc.mcMC.mcFX.gotoAndStop(_local3.element);
shakeCam = shakeCam + 3;
var _local1 = projectiles;
temp = 1;
while (temp <= projectiles) {
temp2 = _local2["proj_" + temp];
if ((!temp2.mc._visible) || (temp2.mc == undefined)) {
_local1 = temp;
break;
}
temp++;
}
if (_local3.mc._xscale > 0) {
x = _local3.mc._x + 35;
} else {
x = _local3.mc._x - 35;
}
y = _local3.mc._y - 10;
switch (_local3.element) {
case "fire" :
mcAll.mcMain.attachMovie("fireball", "proj_mc_" + _local1, projectileDepth + _local1, {_x:x, _y:y});
_local2["proj_" + _local1] = new projectile(mcAll.mcMain["proj_mc_" + _local1], "fireball", hitTarget);
temp = _local2["proj_" + _local1];
switch (direction) {
case 1 :
temp.xVel = 0;
temp.yVel = -temp.yMax;
temp.mc._rotation = -90;
temp.mc._x = _local3.mc._x;
break;
case 2 :
temp.xVel = (temp.xMax * 2) / 3;
temp.yVel = ((-temp.yMax) * 2) / 3;
temp.mc._rotation = -45;
break;
case 3 :
if (xSpeed == -123) {
temp.xVel = temp.xMax;
} else {
temp.xVel = xSpeed;
}
temp.yVel = 0;
temp.mc._rotation = 0;
break;
case 4 :
temp.xVel = (temp.xMax * 2) / 3;
temp.yVel = (temp.yMax * 2) / 3;
temp.mc._rotation = 45;
break;
case 5 :
temp.xVel = 0;
temp.yVel = temp.yMax;
temp.mc._rotation = 90;
temp.mc._x = _local3.mc._x;
}
if (_local3.mc._xscale < 0) {
temp.xVel = -temp.xVel;
temp.mc._xscale = -100;
temp.mc._rotation = -temp.mc._rotation;
}
makeFX("fire", x, y);
makeFX("fire", x, y);
makeFX("fire", x, y);
soundFX.attachSound("s_fireball");
soundFX.start(0, 0);
return;
case "wind" :
mcAll.mcMain.attachMovie("wind", "proj_mc_" + _local1, projectileDepth + _local1, {_x:x, _y:y});
_local2["proj_" + _local1] = new projectile(mcAll.mcMain["proj_mc_" + _local1], "wind", hitTarget);
temp = _local2["proj_" + _local1];
temp.mc.gotoAndPlay(Math.ceil(Math.random() * 3));
i = 1;
while (i <= projectiles) {
j = _local2["proj_" + i];
if ((!j.mc._visible) || (j.mc == undefined)) {
_local1 = i;
break;
}
i++;
}
mcAll.mcMain.attachMovie("wind", "proj_mc_" + _local1, projectileDepth + _local1, {_x:x, _y:y});
_local2["proj_" + _local1] = new projectile(mcAll.mcMain["proj_mc_" + _local1], "wind", hitTarget);
temp2 = _local2["proj_" + _local1];
temp2.mc.gotoAndPlay(Math.ceil(Math.random() * 3));
switch (direction) {
case 1 :
temp.xVel = -3;
temp.yVel = -16;
temp.mc._rotation = -100;
temp2.xVel = 3;
temp2.yVel = -16;
temp2.mc._rotation = -80;
if (_local3.mc._xscale < 0) {
temp.mc._x = temp.mc._x + 20;
temp2.mc._x = temp2.mc._x + 20;
} else {
temp.mc._x = temp.mc._x + -20;
temp2.mc._x = temp2.mc._x + -20;
}
break;
case 2 :
temp.xVel = 7;
temp.yVel = -10;
temp.mc._rotation = -55;
temp2.xVel = 10;
temp2.yVel = -7;
temp2.mc._rotation = -35;
break;
case 3 :
if (xSpeed == -123) {
temp.xVel = 16;
temp2.xVel = 16;
temp.yVel = -3;
temp2.yVel = 3;
} else {
temp.xVel = 12;
temp2.xVel = 12;
temp.yVel = -2;
temp2.yVel = 2;
}
temp.mc._rotation = -10;
temp2.mc._rotation = 10;
break;
case 4 :
temp.xVel = 7;
temp.yVel = 10;
temp.mc._rotation = 55;
temp2.xVel = 10;
temp2.yVel = 7;
temp2.mc._rotation = 35;
break;
case 5 :
temp.xVel = -3;
temp.yVel = 16;
temp.mc._rotation = 100;
temp2.xVel = 3;
temp2.yVel = 16;
temp2.mc._rotation = 80;
if (_local3.mc._xscale < 0) {
temp.mc._x = temp.mc._x + 20;
temp2.mc._x = temp2.mc._x + 20;
} else {
temp.mc._x = temp.mc._x + -20;
temp2.mc._x = temp2.mc._x + -20;
}
}
if (((_local3.mc._xscale < 0) && (direction != 1)) && (direction != 5)) {
temp.xVel = -temp.xVel;
temp.mc._xscale = -100;
temp.mc._rotation = -temp.mc._rotation;
temp2.xVel = -temp2.xVel;
temp2.mc._xscale = -100;
temp2.mc._rotation = -temp2.mc._rotation;
}
soundFX.attachSound("s_wind");
soundFX.start(0, 0);
return;
case "lightning" :
mcAll.mcMain.attachMovie("lightning", "proj_mc_" + _local1, projectileDepth + _local1, {_x:x, _y:y});
_local2["proj_" + _local1] = new projectile(mcAll.mcMain["proj_mc_" + _local1], "lightning", hitTarget);
temp = _local2["proj_" + _local1];
temp.life = 7;
i = 1;
while (i <= projectiles) {
j = _local2["proj_" + i];
if ((!j.mc._visible) || (j.mc == undefined)) {
_local1 = i;
break;
}
i++;
}
mcAll.mcMain.attachMovie("lightning", "proj_mc_" + _local1, projectileDepth + _local1, {_x:x, _y:y});
_local2["proj_" + _local1] = new projectile(mcAll.mcMain["proj_mc_" + _local1], "lightning", hitTarget);
temp2 = _local2["proj_" + _local1];
temp2.life = 7;
if (Math.random() > 0.5) {
mcAll.mcMain.attachMovie("lightning_bolt1", "bolt_mc_" + (_local1 + 20), (projectileDepth + _local1) + 20, {_x:x, _y:y});
} else {
mcAll.mcMain.attachMovie("lightning_bolt2", "bolt_mc_" + (_local1 + 20), (projectileDepth + _local1) + 20, {_x:x, _y:y});
}
var boltMC = mcAll.mcMain["bolt_mc_" + (_local1 + 20)];
if (Math.random() > 0.5) {
boltMC._yscale = -boltMC._yscale;
}
switch (direction) {
case 1 :
temp.xVel = 0;
temp2.xVel = 0;
temp.yVel = -20;
temp2.yVel = -20;
temp2.mc._y = temp2.mc._y + -130;
boltMC._rotation = -90;
if (_local3.mc._xscale < 0) {
temp2.mc._x = temp2.mc._x + 20;
boltMC._x = boltMC._x + 20;
} else {
temp2.mc._x = temp2.mc._x + -20;
boltMC._x = boltMC._x + -20;
}
boltMC._y = boltMC._y + -10;
break;
case 2 :
temp.xVel = 10;
temp2.xVel = 10;
temp.yVel = -10;
temp2.yVel = -10;
if (_local3.mc._xscale < 0) {
temp2.mc._x = temp2.mc._x + -65;
} else {
temp2.mc._x = temp2.mc._x + 65;
}
temp2.mc._y = temp2.mc._y + -65;
boltMC._rotation = -45;
break;
case 3 :
if (xSpeed == -123) {
temp.xVel = 20;
temp2.xVel = 20;
temp.yVel = 0;
temp2.yVel = 0;
if (_local3.mc._xscale < 0) {
temp2.mc._x = temp2.mc._x + -130;
} else {
temp2.mc._x = temp2.mc._x + 130;
}
} else {
temp.xVel = 15;
temp2.xVel = 15;
temp.yVel = 0;
temp2.yVel = 0;
if (_local3.mc._xscale < 0) {
temp2.mc._x = temp2.mc._x + -110;
} else {
temp2.mc._x = temp2.mc._x + 110;
}
}
break;
case 4 :
temp.xVel = 10;
temp2.xVel = 10;
temp.yVel = 10;
temp2.yVel = 10;
if (_local3.mc._xscale < 0) {
temp2.mc._x = temp2.mc._x + -65;
} else {
temp2.mc._x = temp2.mc._x + 65;
}
temp2.mc._y = temp2.mc._y + 65;
boltMC._rotation = 45;
break;
case 5 :
temp.xVel = 0;
temp2.xVel = 0;
temp.yVel = 20;
temp2.yVel = 20;
temp2.mc._y = temp2.mc._y + 130;
boltMC._rotation = 90;
if (_local3.mc._xscale < 0) {
temp2.mc._x = temp2.mc._x + 20;
boltMC._x = boltMC._x + 20;
} else {
temp2.mc._x = temp2.mc._x + -20;
boltMC._x = boltMC._x + -20;
}
boltMC._y = boltMC._y + 10;
}
if (((_local3.mc._xscale < 0) && (direction != 1)) && (direction != 5)) {
temp.xVel = -temp.xVel;
temp.mc._xscale = -100;
temp2.xVel = -temp2.xVel;
temp2.mc._xscale = -100;
boltMC._xscale = -boltMC._xscale;
boltMC._rotation = -boltMC._rotation;
}
soundFX.attachSound("s_lightning");
soundFX.start(0, 0);
}
}
function loadBoss() {
mcAll.mcMain.attachMovie("boss", ("boss_mc_" + enemies) + 100, enemyDepth + ((enemies + 100) * 10), {_x:p1.mc._x + 200, _y:p1.mc._y});
boss = new boss(mcAll.mcMain["boss_mc_" + (enemies + 100)]);
mapHit.mcBossBlock._x = mapHit.mcBossBlock._x + -1000;
mcCam.mcBoss._visible = true;
mcCam.mcBoss.play();
stopAllSounds();
soundMusic.attachSound("boss_intro");
soundMusic.start(0, 0);
}
function saveGame() {
savefile = SharedObject.getLocal("winkData");
savefile.data.winkX = p1.mc._x;
savefile.data.winkY = p1.mc._y;
if (p1.holdName.actor == "staff") {
savefile.data.winkHoldName = p1.holdName.selfName;
} else {
savefile.data.winkHoldName = null;
}
temp = savefile.flush();
if (temp == true) {
mcCam.textMsg.text = "Game SAVED successfully";
} else if (temp == false) {
mcCam.textMsg.text = "Game save failed, allocate more disk space to Flash";
}
}
function loadSavedGame() {
savefile = SharedObject.getLocal("winkData");
if (savefile.data != null) {
p1.mc._x = savefile.data.winkX;
p1.mc._y = savefile.data.winkY;
mcCam._x = p1.mc._x;
mcCam._y = p1.mc._y;
}
if (savefile.data.winkHoldName == null) {
temp = null;
} else {
temp = this[savefile.data.winkHoldName];
}
if ((temp != null) && (temp.grabbedName.actor == "hoodley")) {
temp.grabbedName.grabCount = 0;
temp.grabbedName.holdName = null;
p1.holdName.grabbedName = null;
p1.holdName.state = "thrown";
p1.holdName = temp;
p1.holdName.grabbedName = p1;
p1.holdName.state = "grabbed";
p1.holdName.mc.swapDepths(grabbedDepth);
p1.holdName.mc._visible = true;
} else if (temp == null) {
if (p1.holdName != null) {
p1.holdName.grabbedName = null;
p1.holdName.state = "thrown";
p1.holdName = null;
}
} else {
p1.holdName = temp;
p1.holdName.grabbedName = p1;
p1.holdName.state = "grabbed";
p1.holdName.mc.swapDepths(grabbedDepth);
}
mcCam.textMsg.text = "Saved game LOADED";
}
function updateMusic() {
if (bossCount < 1) {
var _local1 = false;
if (soundHuntCount > 0) {
if ((soundArray[0] != "hunt_A") && (soundArray[0] != "hunt_B")) {
_local1 = true;
}
if ((Math.random() > 0.6) || (soundHuntA)) {
soundArray[1] = "hunt_A";
} else {
soundArray[1] = "hunt_B";
}
} else if (p1.plane == "shadow") {
if ((((((soundArray[0] == "ambient_A") || (soundArray[0] == "ambient_B")) || (soundArray[0] == "sneak_INTO_ambient")) || (soundArray[0] == "ambient_AA")) || (soundArray[0] == "ambient_BB")) || (soundArray[0] == "ambient_AAA")) {
soundArray[1] = "ambient_INTO_sneak";
} else if ((soundArray[0] == "hunt_A") || (soundArray[0] == "hunt_B")) {
soundArray[1] = "hunt_INTO_sneak";
} else if ((Math.random() > 0.6) || (soundSneakA)) {
soundArray[1] = "sneak_A";
} else {
soundArray[1] = "sneak_B";
}
} else if ((soundArray[0] == "hunt_A") || (soundArray[0] == "hunt_B")) {
soundArray[1] = "hunt_INTO_ambient";
} else if (((soundArray[0] == "sneak_A") || (soundArray[0] == "sneak_B")) || (soundArray[0] == "ambient_INTO_sneak")) {
soundArray[1] = "sneak_INTO_ambient";
} else {
temp = Math.random();
if ((temp > 0.8) || (soundAmbientA)) {
soundArray[1] = "ambient_A";
} else if (temp > 0.5) {
soundArray[1] = "ambient_B";
} else if (temp > 0.3) {
soundArray[1] = "ambient_AA";
} else if (temp > 0.15) {
soundArray[1] = "ambient_BB";
} else {
soundArray[1] = "ambient_AAA";
}
}
if (_local1) {
soundMusic.stop();
soundArray[0] = soundArray[1];
soundArray[1] = "ambient_A";
if (soundArray[0] == "hunt_A") {
soundMusic.attachSound("hunt_A");
soundHuntA = false;
} else if (soundArray[0] == "hunt_B") {
soundMusic.attachSound("hunt_B");
}
soundMusic.start(0, 0);
} else {
soundMusic.onSoundComplete = function () {
soundArray[0] = soundArray[1];
soundArray[1] = "ambient_A";
switch (soundArray[0]) {
case "hunt_A" :
soundMusic.attachSound("hunt_A");
soundHuntA = false;
break;
case "hunt_B" :
break;
case "sneak_A" :
soundMusic.attachSound("sneak_A");
soundHuntA = true;
soundSneakA = false;
break;
case "sneak_B" :
soundMusic.attachSound("sneak_B");
soundHuntA = true;
break;
case "ambient_A" :
soundMusic.attachSound("ambient_A");
soundHuntA = true;
soundAmbientA = false;
break;
case "ambient_B" :
soundMusic.attachSound("ambient_B");
soundHuntA = true;
break;
case "ambient_AA" :
soundMusic.attachSound("ambient_AA");
soundHuntA = true;
soundAmbientA = false;
break;
case "ambient_BB" :
soundMusic.attachSound("ambient_BB");
soundHuntA = true;
break;
case "ambient_AAA" :
soundMusic.attachSound("ambient_AAA");
soundHuntA = true;
soundAmbientA = false;
break;
case "ambient_INTO_sneak" :
soundMusic.attachSound("ambient_INTO_sneak");
soundSneakA = true;
break;
case "sneak_INTO_ambient" :
soundMusic.attachSound("sneak_INTO_ambient");
soundAmbientA = true;
break;
case "hunt_INTO_ambient" :
soundMusic.attachSound("hunt_INTO_ambient");
soundAmbientA = true;
break;
case "hunt_INTO_sneak" :
soundMusic.attachSound("hunt_INTO_sneak");
soundSneakA = true;
break;
default :
soundMusic.attachSound("ambient_A");
}
soundMusic.start(0, 0);
};
}
} else {
soundMusic.onSoundComplete = function () {
soundMusic.attachSound("boss_loop");
soundMusic.start(0, 1000);
};
}
}
function loadGame() {
var _local1 = this;
mcAll.mcMain.attachMovie("player_wink", "mcP1", p1Depth, {_x:-2740, _y:-210});
p1 = new player1(mcAll.mcMain.mcP1);
mcCam._x = p1.mc._x;
mcCam._y = p1.mc._y;
temp3 = 0;
for (temp3 in mcAll.mcMain) {
if (typeof(mcAll.mcMain[temp3]) == "movieclip") {
if (mcAll.mcMain[temp3].enemyType == "hoodley") {
enemies++;
mcAll.mcMain[temp3].swapDepths(enemyDepth + (enemies * 10));
_local1["enemy1_" + enemies] = new enemy1(mcAll.mcMain[temp3]);
if (Math.random() > 0.5) {
_local1["enemy1_" + enemies].mc._xscale = -100;
}
if (mcAll.mcMain[temp3].staffType != "none") {
var _local3 = mcAll.mcMain[temp3]._x;
var _local2 = mcAll.mcMain[temp3]._y;
staffs++;
if (mcAll.mcMain[temp3].staffType == "fire") {
mcAll.mcMain.attachMovie("staff_fire", "staff_mc_" + staffs, staffDepth + staffs, {_x:_local3, _y:_local2});
} else if (mcAll.mcMain[temp3].staffType == "wind") {
mcAll.mcMain.attachMovie("staff_wind", "staff_mc_" + staffs, staffDepth + staffs, {_x:_local3, _y:_local2});
} else if (mcAll.mcMain[temp3].staffType == "lightning") {
mcAll.mcMain.attachMovie("staff_lightning", "staff_mc_" + staffs, staffDepth + staffs, {_x:_local3, _y:_local2});
}
_local1["staff_" + staffs] = new staff(mcAll.mcMain["staff_mc_" + staffs], staffDepth + staffs, mcAll.mcMain[temp3].staffType);
_local1["staff_" + staffs].selfName = "staff_" + staffs;
_local1["staff_" + staffs].grabbedName = _local1["enemy1_" + enemies];
_local1["staff_" + staffs].state = "grabbed";
_local1["enemy1_" + enemies].holdName = _local1["staff_" + staffs];
_local1["staff_" + staffs].mc.swapDepths(_local1["enemy1_" + enemies].depth0 + 1);
}
} else if (mcAll.mcMain[temp3].objType == "torch") {
torches++;
_local1["torch_" + torches] = new torch(mcAll.mcMain[temp3], torchDepth + torches);
}
}
}
soundArray[0] = "ambient_A";
soundMusic.attachSound("ambient_A");
soundMusic.start(0, 0);
loaded = true;
}
stop();
_quality = "MEDIUM";
loaded = false;
time0 = getTimer();
timeLast = time0;
timeNow = time0;
fps = 0;
gravity = 1.3;
friction = 1.2;
frictionAir = 1.07;
count = 0;
lastCount = 0;
paused = false;
mapHit = mcAll.mcMain.mcMap.mcHit;
mapHitShadow = mcAll.mcMain.mcMap.mcHitShadow;
enemies = 0;
temp = 0;
temp2 = 0;
temp3 = 0;
temp4 = 0;
prop = "";
xThrowMax = 22;
yThrowMax = 22;
pulseCount = 0;
xCutoff = 490;
yCutoff = 230;
thrownName = null;
xZoom = 0;
yZoom = 0;
shakeCam = 0;
fireNum = 0;
fireMax = 100;
torches = 0;
staffs = 0;
projectiles = 12;
_root.attachMovie("menu", "mcMenu", 888888, {_x:350, _y:200});
bossCount = 0;
keySaveGame = 53;
keyLoadGame = 57;
savePressed = false;
loadPressed = false;
mcCam.mcBoss._visible = false;
mcCam.mcEnding._visible = false;
soundFX = new Sound(mcAll.mcMain);
soundHoodleyFire = new Sound(mcAll.mcMain.mcMap);
soundWink = new Sound(mcAll.mcMain.mcMap.mcHitShadow);
soundStuckDone = false;
soundArray = new Array(null, null);
soundHuntCount = 0;
soundMusic = new Sound(this);
soundAmbientA = true;
soundSneakA = true;
soundHuntA = true;
p1Depth = 100000 /* 0x0186A0 */;
enemyDepth = 200000 /* 0x030D40 */;
torchDepth = 10000;
staffDepth = 300000 /* 0x0493E0 */;
grabbedDepth = p1Depth + 2000;
enemyDeadOffset = 300000 /* 0x0493E0 */;
projectileDepth = 900000 /* 0x0DBBA0 */;
topDepth = 9999999 /* 0x98967F */;
this.onEnterFrame = function () {
var _local1 = this;
if (loaded) {
if (!paused) {
if ((count % 60) == 0) {
mcCam.textMsg.text = "";
}
playerControl(1);
temp3 = 1;
while (temp3 <= enemies) {
temp4 = "enemy1_" + temp3;
enemy1Control(temp4);
temp3++;
}
temp3 = 1;
while (temp3 <= torches) {
temp4 = "torch_" + temp3;
torchControl(temp4);
temp3++;
}
temp3 = 1;
while (temp3 <= staffs) {
temp4 = "staff_" + temp3;
staffControl(temp4);
temp3++;
}
temp3 = 1;
while (temp3 <= projectiles) {
temp4 = "proj_" + temp3;
if (_local1[temp4].mc._x != undefined) {
projControl(temp4);
}
temp3++;
}
vcam();
updateMusic();
soundHuntCount = 0;
if (Key.isDown(keySaveGame)) {
if (!savePressed) {
savePressed = true;
saveGame();
}
} else {
savePressed = false;
}
if (Key.isDown(keyLoadGame)) {
if (!loadPressed) {
loadPressed = true;
loadSavedGame();
}
} else {
loadPressed = false;
}
}
if (Key.isDown(p1.keyPause)) {
if (!p1.pausePressed) {
paused = !paused;
p1.pausePressed = true;
if (paused) {
mcCam.mcPaused._visible = true;
} else {
mcCam.mcPaused._visible = false;
}
}
} else {
p1.pausePressed = false;
}
}
count++;
timeNow = getTimer();
if ((count - lastCount) == 5) {
lastCount = count;
fps = Math.round(5 / ((timeNow - timeLast) / 1000));
mcCam.textFPS.text = "fps: " + fps;
timeLast = timeNow;
}
if (Key.isDown(keyPulse)) {
pulse();
}
pulseCount--;
if (pulseCount == -1) {
mcMap1._visible = false;
mcMap2._visible = false;
}
};
Instance of Symbol 794 MovieClip [enemy1] in Frame 2
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "none";
}
onClipEvent (load) {
this._visible = false;
}
Instance of Symbol 1563 MovieClip [player_wink] in Frame 2
onClipEvent (load) {
this._visible = false;
}
Instance of Symbol 1601 MovieClip in Frame 2
onClipEvent (load) {
this._visible = false;
}
Instance of Symbol 1707 MovieClip [boss] in Frame 2
onClipEvent (load) {
this._visible = false;
}
Instance of Symbol 1758 MovieClip "mcCam" in Frame 2
/* no clip actions */
Symbol 47 MovieClip Frame 10
_parent.gotoAndStop("thrown");
Symbol 53 MovieClip [enemy0] Frame 1
stop();
Symbol 53 MovieClip [enemy0] Frame 5
stop();
Symbol 53 MovieClip [enemy0] Frame 10
stop();
Symbol 53 MovieClip [enemy0] Frame 20
stop();
Symbol 53 MovieClip [enemy0] Frame 30
stop();
Symbol 53 MovieClip [enemy0] Frame 40
stop();
Symbol 53 MovieClip [enemy0] Frame 50
stop();
Symbol 61 MovieClip Frame 13
_parent.gotoAndStop("idle");
Symbol 62 MovieClip Frame 1
stop();
Symbol 67 MovieClip Frame 1
stop();
Symbol 67 MovieClip Frame 10
stop();
Symbol 71 MovieClip Frame 16
stop();
Symbol 72 MovieClip Frame 1
stop();
Symbol 78 MovieClip Frame 16
stop();
Symbol 79 MovieClip Frame 1
stop();
Symbol 85 MovieClip Frame 16
stop();
Symbol 86 MovieClip Frame 1
stop();
Symbol 89 MovieClip Frame 2
stop();
Symbol 98 MovieClip Frame 7
stop();
Symbol 110 MovieClip Frame 14
stop();
Symbol 116 MovieClip Frame 11
stop();
Symbol 117 MovieClip [lightning] Frame 1
stop();
Symbol 128 MovieClip Frame 12
stop();
Symbol 133 MovieClip Frame 8
stop();
Symbol 134 MovieClip [wind] Frame 1
stop();
Symbol 155 MovieClip Frame 13
stop();
Symbol 156 MovieClip [fireball] Frame 1
stop();
Symbol 161 MovieClip [lightning_bolt2] Frame 20
stop();
this.removeMovieClip();
Symbol 168 MovieClip [lightning_bolt1] Frame 20
stop();
this.removeMovieClip();
Symbol 174 Button
on (release) {
_root.mcMenu._visible = false;
_root.mcCam.mcIntro.gotoAndPlay(2);
_root.mcCam.mcIntro.play();
_root._x = ((-(_root.mcCam._x - (_root.mcCam.mcFrame._width / 2))) * Stage.width) / _root.mcCam.mcFrame._width;
_root._y = ((-(_root.mcCam._y - (_root.mcCam.mcFrame._height / 2))) * Stage.height) / _root.mcCam.mcFrame._height;
_root._xscale = (Stage.width / _root.mcCam.mcFrame._width) * 100;
_root._yscale = (Stage.height / _root.mcCam.mcFrame._height) * 100;
_root.mcMenu.removeMovieClip();
}
Symbol 177 Button
on (release) {
mcControls._visible = false;
}
Symbol 180 Button
on (release) {
mcControls._visible = true;
}
Symbol 183 Button
on (release) {
mcControls._visible = false;
}
Symbol 223 MovieClip [menu] Frame 1
mcControls._visible = false;
Instance of Symbol 238 MovieClip in Symbol 239 MovieClip Frame 1
onClipEvent (enterFrame) {
this._x = 0.6;
_width = ((_root.getBytesLoaded() / _root.getBytesTotal()) * 275);
}
Symbol 242 MovieClip Frame 1
this.onRelease = function () {
getURL ("http://www.gamesofgondor.com", "_blank");
};
Instance of Symbol 239 MovieClip in Symbol 244 MovieClip Frame 1
on (release) {
if ((_root.getBytesLoaded() / _root.getBytesTotal()) == 1) {
_root.play();
}
}
Symbol 263 MovieClip [doorhit] Frame 1
#initclip 3
function DoorHitClass() {
}
DoorHitClass.prototype = new MovieClip();
DoorHitClass.prototype.onEnterFrame = function () {
var _local1 = this;
var _local3 = _root;
var _local2 = null;
var i = 1;
if (!_local3.paused) {
i = 1;
while (i <= _local3.staffs) {
_local2 = _local3["staff_" + i];
if (_local2.element == _local1.element) {
if (_local1.bVertical) {
if ((Math.abs((_local2.mc._x + 1850) - _local1._x) < 100) && (Math.abs((_local2.mc._y + 610) - _local1._y) < 200)) {
_local1.nextFrame();
_local3.mcAll.mcMain.mcMap["door" + _local1.doorNum].nextFrame();
break;
}
} else if ((Math.abs((_local2.mc._x + 1850) - _local1._x) < 150) && (Math.abs((_local2.mc._y + 700) - _local1._y) < 200)) {
_local1.nextFrame();
_local3.mcAll.mcMain.mcMap["door" + _local1.doorNum].nextFrame();
break;
}
}
i++;
}
if (i > _local3.staffs) {
_local1.prevFrame();
_local3.mcAll.mcMain.mcMap["door" + _local1.doorNum].prevFrame();
}
if ((Math.abs((p1.mc._x + 1850) - _local1._x) < 130) && (Math.abs((p1.mc._y + 610) - _local1._y) < 150)) {
if (p1.holdName.element != _local1.element) {
_local3.mcCam.textMsg.text = ("You need a " + _local1.element) + " staff to open this door.";
}
}
}
};
Object.registerClass("doorhit", DoorHitClass);
#endinitclip
Instance of Symbol 263 MovieClip [doorhit] in Symbol 265 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
element = "fire";
doorNum = 1;
bVertical = true;
}
Instance of Symbol 263 MovieClip [doorhit] in Symbol 265 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
element = "fire";
doorNum = 2;
bVertical = false;
}
Instance of Symbol 263 MovieClip [doorhit] in Symbol 265 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
element = "fire";
doorNum = 3;
bVertical = false;
}
Instance of Symbol 263 MovieClip [doorhit] in Symbol 265 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
element = "wind";
doorNum = 4;
bVertical = true;
}
Instance of Symbol 263 MovieClip [doorhit] in Symbol 265 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
element = "wind";
doorNum = 5;
bVertical = false;
}
Instance of Symbol 263 MovieClip [doorhit] in Symbol 265 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
element = "lightning";
doorNum = 6;
bVertical = false;
}
Instance of Symbol 263 MovieClip [doorhit] in Symbol 265 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
element = "fire";
doorNum = 7;
bVertical = false;
}
Instance of Symbol 263 MovieClip [doorhit] in Symbol 265 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
element = "lightning";
doorNum = 8;
bVertical = true;
}
Instance of Symbol 263 MovieClip [doorhit] in Symbol 265 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
element = "lightning";
doorNum = 9;
bVertical = false;
}
Instance of Symbol 2 MovieClip "mcBossBlock" in Symbol 265 MovieClip Frame 1
onClipEvent (load) {
this._x = this._x + 1000;
}
Symbol 331 MovieClip Frame 25
gotoAndPlay ("loop");
Symbol 365 MovieClip Frame 30
stop();
this.done = true;
Instance of Symbol 365 MovieClip in Symbol 366 MovieClip Frame 1
onClipEvent (load) {
this.done = false;
}
onClipEvent (enterFrame) {
if (this.done && (Math.random() > 0.6)) {
this.done = false;
this.play();
this._x = (Math.random() * 80) - 40;
this._y = (Math.random() * 100) - 50;
}
}
Instance of Symbol 365 MovieClip in Symbol 366 MovieClip Frame 1
onClipEvent (load) {
this.done = false;
}
onClipEvent (enterFrame) {
if (this.done && (Math.random() > 0.6)) {
this.done = false;
this.play();
this._x = (Math.random() * 80) - 40;
this._y = (Math.random() * 100) - 50;
}
}
Instance of Symbol 366 MovieClip in Symbol 368 MovieClip Frame 1
onClipEvent (enterFrame) {
if ((Math.abs((this._x - 1835) - _root.p1.mc._x) <= (_root.xCutoff - 30)) && (Math.abs((this._y - 50) - _root.p1.mc._y) <= _root.yCutoff)) {
this._visible = true;
} else {
this._visible = false;
}
}
Symbol 410 MovieClip Frame 12
gotoAndPlay ("loop");
Symbol 440 MovieClip Frame 9
_parent.gotoAndStop("idle2");
Symbol 453 MovieClip Frame 12
_parent.gotoAndStop("idle2");
Symbol 485 MovieClip Frame 24
stop();
Symbol 506 MovieClip Frame 24
stop();
Symbol 524 MovieClip Frame 25
stop();
Symbol 558 MovieClip Frame 30
gotoAndPlay ("loop");
Symbol 572 MovieClip Frame 21
gotoAndPlay ("loop");
Symbol 633 MovieClip Frame 86
_parent.gotoAndStop("dead");
Symbol 645 MovieClip Frame 5
stop();
Symbol 663 MovieClip Frame 22
stop();
Symbol 694 MovieClip Frame 3
stop();
Instance of Symbol 693 MovieClip in Symbol 694 MovieClip Frame 3
onClipEvent (load) {
this.gotoAndPlay(9);
}
Symbol 706 MovieClip Frame 16
stop();
Symbol 710 MovieClip Frame 11
stop();
Symbol 726 MovieClip Frame 24
stop();
Instance of Symbol 734 MovieClip in Symbol 746 MovieClip Frame 1
onClipEvent (load) {
this.gotoAndPlay(6);
}
Instance of Symbol 734 MovieClip in Symbol 746 MovieClip Frame 1
onClipEvent (load) {
this.gotoAndPlay(1);
}
Instance of Symbol 734 MovieClip in Symbol 746 MovieClip Frame 1
onClipEvent (load) {
this.gotoAndPlay(3);
}
Instance of Symbol 734 MovieClip in Symbol 746 MovieClip Frame 1
onClipEvent (load) {
this.gotoAndPlay(8);
}
Instance of Symbol 734 MovieClip in Symbol 746 MovieClip Frame 3
onClipEvent (load) {
this.gotoAndPlay(8);
}
Instance of Symbol 734 MovieClip in Symbol 746 MovieClip Frame 3
onClipEvent (load) {
this.gotoAndPlay(3);
}
Instance of Symbol 734 MovieClip in Symbol 746 MovieClip Frame 3
onClipEvent (load) {
this.gotoAndPlay(5);
}
Instance of Symbol 734 MovieClip in Symbol 746 MovieClip Frame 3
onClipEvent (load) {
this.gotoAndPlay(10);
}
Symbol 746 MovieClip Frame 11
gotoAndPlay ("loop");
Symbol 775 MovieClip Frame 33
stop();
Symbol 792 MovieClip Frame 17
stop();
Symbol 794 MovieClip [enemy1] Frame 1
#initclip 1
function Enemy1Class() {
}
Enemy1Class.prototype = new MovieClip();
Object.registerClass("enemy1", Enemy1Class);
#endinitclip
stop();
Symbol 794 MovieClip [enemy1] Frame 19
stop();
Symbol 794 MovieClip [enemy1] Frame 105
stop();
Symbol 794 MovieClip [enemy1] Frame 145
stop();
Symbol 794 MovieClip [enemy1] Frame 165
stop();
Symbol 794 MovieClip [enemy1] Frame 175
stop();
Symbol 794 MovieClip [enemy1] Frame 217
stop();
Symbol 794 MovieClip [enemy1] Frame 227
stop();
Symbol 794 MovieClip [enemy1] Frame 238
stop();
Symbol 794 MovieClip [enemy1] Frame 252
stop();
Instance of Symbol 797 MovieClip in Symbol 798 MovieClip Frame 1
onClipEvent (load) {
gotoAndPlay(Math.ceil(Math.random() * 20));
}
Symbol 801 MovieClip Frame 16
stop();
Instance of Symbol 797 MovieClip in Symbol 802 MovieClip Frame 1
onClipEvent (load) {
gotoAndPlay(Math.ceil(Math.random() * 20));
}
Symbol 804 MovieClip Frame 25
stop();
Symbol 805 MovieClip [torch] Frame 1
#initclip 2
function TorchClass() {
}
TorchClass.prototype = new MovieClip();
Object.registerClass("torch", TorchClass);
#endinitclip
stop();
Instance of Symbol 256 MovieClip "mcSky" in Symbol 806 MovieClip Frame 1
/* no clip actions */
Instance of Symbol 2 MovieClip in Symbol 806 MovieClip Frame 1
onClipEvent (enterFrame) {
if (this.hitTest(_root.p1.mc._x, _root.p1.mc._y, true)) {
if (_root.bossCount == 0) {
_root.bossCount = 1;
_root.loadBoss();
}
}
}
Instance of Symbol 229 MovieClip [fire back] "firePartBack" in Symbol 806 MovieClip Frame 1
onClipEvent (load) {
name1 = this._name.substring(12, this._name.length);
name1 = _parent["firePart" + name1];
}
onClipEvent (enterFrame) {
if (this._name != "firePartBack") {
if (!_root.paused) {
this._x = name1._x + name1.xVel;
this._y = name1._y + name1.yVel;
this._rotation = name1._rotation;
if (name1._alpha != undefined) {
this._alpha = name1._alpha;
} else {
this._alpha = 0;
this.removeMovieClip();
}
}
}
}
Instance of Symbol 227 MovieClip [fire] "firePart" in Symbol 806 MovieClip Frame 1
onClipEvent (load) {
this._alpha = 100;
this.yVel = (-(Math.random() / 4)) - 0.3;
if (Math.random() > 0.5) {
this.xVel = Math.random() * 0.3;
this.xAccel = Math.random() * -0.01;
} else {
this.xVel = (-Math.random()) * 0.12;
this.xAccel = Math.random() * 0.01;
}
if (Math.random() > 0.5) {
this.rotVel = (Math.random() * 10) + 5;
} else {
this.rotVel = ((-Math.random()) * 10) - 5;
}
this.life = Math.random() + 1.5;
}
onClipEvent (enterFrame) {
if (this._name != "firePart") {
if (!_root.paused) {
if (this.life > 0) {
this.xVel = this.xVel + this.xAccel;
}
this._x = this._x + this.xVel;
this._y = this._y + this.yVel;
this._rotation = this._rotation + this.rotVel;
this.life = this.life - 0.1;
if (this.life < 0) {
this._alpha = 0;
this.removeMovieClip();
} else if (this.life < 0.25) {
this._alpha = 50;
}
}
}
}
Instance of Symbol 225 MovieClip [fire white] "firePartWhite" in Symbol 806 MovieClip Frame 1
onClipEvent (load) {
_alpha = 100;
yVel = (-(Math.random() / 4)) - 0.2;
if (Math.random() > 0.5) {
xVel = Math.random() / 6;
xAccel = Math.random() * -0.025;
} else {
xVel = (-Math.random()) / 6;
xAccel = Math.random() * 0.025;
}
life = Math.random() + 1.2;
}
onClipEvent (enterFrame) {
if (this._name != "firePartWhite") {
if (!_root.paused) {
if (life > 0) {
xVel = xVel + xAccel;
}
_x = (_x + xVel);
_y = (_y + yVel);
life = life - 0.2;
if (this.life < 0) {
this._alpha = 0;
this.removeMovieClip();
} else if (this.life < 0.25) {
this._alpha = 50;
}
}
}
}
Instance of Symbol 794 MovieClip [enemy1] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "none";
}
Instance of Symbol 794 MovieClip [enemy1] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "fire";
}
Instance of Symbol 794 MovieClip [enemy1] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "none";
}
Instance of Symbol 794 MovieClip [enemy1] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "none";
}
Instance of Symbol 794 MovieClip [enemy1] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "fire";
}
Instance of Symbol 794 MovieClip [enemy1] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "fire";
}
Instance of Symbol 794 MovieClip [enemy1] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "lightning";
}
Instance of Symbol 794 MovieClip [enemy1] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "none";
}
Instance of Symbol 794 MovieClip [enemy1] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "fire";
}
Instance of Symbol 794 MovieClip [enemy1] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "fire";
}
Instance of Symbol 794 MovieClip [enemy1] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "fire";
}
Instance of Symbol 794 MovieClip [enemy1] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "none";
}
Instance of Symbol 794 MovieClip [enemy1] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "none";
}
Instance of Symbol 794 MovieClip [enemy1] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "none";
}
Instance of Symbol 794 MovieClip [enemy1] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "fire";
}
Instance of Symbol 794 MovieClip [enemy1] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "none";
}
Instance of Symbol 794 MovieClip [enemy1] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "fire";
}
Instance of Symbol 794 MovieClip [enemy1] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "fire";
}
Instance of Symbol 794 MovieClip [enemy1] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "wind";
}
Instance of Symbol 794 MovieClip [enemy1] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "none";
}
Instance of Symbol 794 MovieClip [enemy1] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "fire";
}
Instance of Symbol 794 MovieClip [enemy1] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "wind";
}
Instance of Symbol 794 MovieClip [enemy1] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "fire";
}
Instance of Symbol 794 MovieClip [enemy1] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "none";
}
Instance of Symbol 794 MovieClip [enemy1] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "none";
}
Instance of Symbol 794 MovieClip [enemy1] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "wind";
}
Instance of Symbol 794 MovieClip [enemy1] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "fire";
}
Instance of Symbol 794 MovieClip [enemy1] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "wind";
}
Instance of Symbol 794 MovieClip [enemy1] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "fire";
}
Instance of Symbol 794 MovieClip [enemy1] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "wind";
}
Instance of Symbol 794 MovieClip [enemy1] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "lightning";
}
Instance of Symbol 794 MovieClip [enemy1] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "fire";
}
Instance of Symbol 794 MovieClip [enemy1] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "wind";
}
Instance of Symbol 794 MovieClip [enemy1] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "lightning";
}
Instance of Symbol 794 MovieClip [enemy1] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "none";
}
Instance of Symbol 794 MovieClip [enemy1] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "fire";
}
Instance of Symbol 794 MovieClip [enemy1] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "fire";
}
Instance of Symbol 794 MovieClip [enemy1] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "fire";
}
Instance of Symbol 794 MovieClip [enemy1] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "fire";
}
Instance of Symbol 794 MovieClip [enemy1] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "wind";
}
Instance of Symbol 794 MovieClip [enemy1] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "none";
}
Instance of Symbol 805 MovieClip [torch] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
objType = "torch";
}
Instance of Symbol 805 MovieClip [torch] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
objType = "torch";
}
Instance of Symbol 805 MovieClip [torch] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
objType = "torch";
}
Instance of Symbol 805 MovieClip [torch] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
objType = "torch";
}
Instance of Symbol 805 MovieClip [torch] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
objType = "torch";
}
Instance of Symbol 805 MovieClip [torch] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
objType = "torch";
}
Instance of Symbol 805 MovieClip [torch] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
objType = "torch";
}
Instance of Symbol 805 MovieClip [torch] in Symbol 806 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
objType = "torch";
}
Symbol 809 MovieClip Frame 9
if (Math.random() > 0.8) {
gotoAndPlay ("blink");
} else {
gotoAndPlay ("idle");
}
Symbol 809 MovieClip Frame 19
gotoAndPlay ("idle");
Symbol 810 MovieClip Frame 9
Symbol 814 MovieClip Frame 3
_parent.gotoAndStop("walk");
Symbol 818 MovieClip Frame 3
Symbol 848 MovieClip Frame 30
gotoAndPlay ("loop");
Symbol 853 MovieClip Frame 19
if (Math.random() > 0.5) {
gotoAndPlay ("moveDown");
} else {
gotoAndPlay ("up");
}
Symbol 853 MovieClip Frame 49
if (Math.random() > 0.5) {
gotoAndPlay ("moveUp");
} else {
gotoAndPlay ("down");
}
Symbol 862 MovieClip Frame 8
_parent.gotoAndStop("crouched");
Symbol 865 MovieClip Frame 5
_parent.gotoAndStop("crouched");
Symbol 884 MovieClip Frame 37
gotoAndPlay ("loop");
Symbol 894 MovieClip Frame 9
_parent.gotoAndStop("fall");
Symbol 906 MovieClip Frame 17
_parent.gotoAndStop("fall");
Symbol 928 MovieClip Frame 11
stop();
Symbol 940 MovieClip Frame 11
_parent.gotoAndStop("stuck");
Symbol 966 MovieClip Frame 38
if (Math.random() > 0.6) {
gotoAndPlay ("move");
} else {
gotoAndPlay ("idle");
}
Symbol 966 MovieClip Frame 64
if (Math.random() > 0.8) {
gotoAndPlay ("moveBack");
} else {
gotoAndPlay ("moved");
}
Symbol 966 MovieClip Frame 78
gotoAndPlay ("idle");
Symbol 970 MovieClip Frame 5
_parent.gotoAndStop("stuck");
Symbol 982 MovieClip Frame 25
gotoAndPlay ("loop");
Symbol 995 MovieClip Frame 25
gotoAndPlay ("loop");
Symbol 998 MovieClip Frame 5
_parent.gotoAndStop("fall");
Symbol 1013 MovieClip Frame 17
_parent.gotoAndStop("shadowIdle");
Symbol 1026 MovieClip Frame 17
_parent.gotoAndStop("shadowIdle");
Symbol 1028 MovieClip Frame 9
if (Math.random() > 0.8) {
gotoAndPlay ("blink");
} else {
gotoAndPlay ("idle");
}
Symbol 1028 MovieClip Frame 19
gotoAndPlay ("idle");
Symbol 1033 MovieClip Frame 2
_parent.gotoAndStop("shadowIdle");
Symbol 1037 MovieClip Frame 3
_parent.gotoAndStop("shadowIdle");
Symbol 1046 MovieClip Frame 10
gotoAndPlay ("loop");
Symbol 1053 MovieClip Frame 11
_parent.gotoAndStop("wallsliding");
Symbol 1064 MovieClip Frame 14
_parent.gotoAndStop("fall");
Symbol 1068 MovieClip Frame 4
_parent.gotoAndStop("dashLoop");
Symbol 1079 MovieClip Frame 10
stop();
Symbol 1095 MovieClip Frame 27
_parent.gotoAndStop("fall");
Symbol 1177 MovieClip Frame 21
gotoAndPlay ("loop");
Symbol 1202 MovieClip Frame 24
_parent.gotoAndStop("idle");
Symbol 1212 MovieClip Frame 11
_parent.gotoAndStop("grabbingIdle");
Symbol 1228 MovieClip Frame 24
_parent.gotoAndStop("idle");
Symbol 1243 MovieClip Frame 16
_parent.gotoAndStop("fall");
Symbol 1257 MovieClip Frame 15
_parent.gotoAndStop("crouched");
Symbol 1263 MovieClip Frame 20
stop();
Symbol 1317 MovieClip Frame 17
_parent.gotoAndStop("walk");
Symbol 1327 MovieClip Frame 30
stop();
Symbol 1328 MovieClip Frame 30
stop();
Symbol 1329 MovieClip Frame 30
stop();
Symbol 1330 MovieClip Frame 30
stop();
Symbol 1337 MovieClip Frame 12
stop();
Symbol 1346 MovieClip Frame 14
stop();
Symbol 1354 MovieClip Frame 20
stop();
Symbol 1365 MovieClip Frame 11
_parent.gotoAndStop("crouched");
Symbol 1368 MovieClip Frame 30
stop();
Symbol 1372 MovieClip Frame 7
_parent.gotoAndStop("wallsliding");
Symbol 1392 MovieClip Frame 20
gotoAndStop ("loop");
Symbol 1403 MovieClip Frame 10
stop();
Symbol 1413 MovieClip Frame 12
_parent.gotoAndStop("idle");
Symbol 1419 MovieClip Frame 10
stop();
Symbol 1429 MovieClip Frame 16
_parent.gotoAndStop("fall");
Symbol 1457 MovieClip Frame 7
_parent.gotoAndStop("crouched");
Symbol 1465 MovieClip Frame 10
_parent.gotoAndStop("crouched");
Symbol 1482 MovieClip Frame 10
_parent.gotoAndStop("idle");
Symbol 1494 MovieClip Frame 11
_parent.gotoAndStop("idle");
Symbol 1506 MovieClip Frame 14
_parent.gotoAndStop("fall");
Symbol 1517 MovieClip Frame 14
_parent.gotoAndStop("fall");
Symbol 1527 MovieClip Frame 10
_parent.gotoAndStop("fall");
Symbol 1547 MovieClip Frame 19
stop();
Symbol 1562 MovieClip Frame 14
stop();
Symbol 1563 MovieClip [player_wink] Frame 1
stop();
Symbol 1563 MovieClip [player_wink] Frame 7
stop();
Symbol 1563 MovieClip [player_wink] Frame 19
stop();
Symbol 1563 MovieClip [player_wink] Frame 25
stop();
Symbol 1563 MovieClip [player_wink] Frame 34
stop();
Symbol 1563 MovieClip [player_wink] Frame 42
stop();
Symbol 1563 MovieClip [player_wink] Frame 50
stop();
Symbol 1563 MovieClip [player_wink] Frame 60
stop();
Symbol 1563 MovieClip [player_wink] Frame 68
stop();
Symbol 1563 MovieClip [player_wink] Frame 78
stop();
Symbol 1563 MovieClip [player_wink] Frame 84
stop();
Symbol 1563 MovieClip [player_wink] Frame 137
stop();
Symbol 1563 MovieClip [player_wink] Frame 164
stop();
Symbol 1563 MovieClip [player_wink] Frame 174
stop();
Symbol 1563 MovieClip [player_wink] Frame 196
stop();
Symbol 1563 MovieClip [player_wink] Frame 207
stop();
Symbol 1563 MovieClip [player_wink] Frame 217
stop();
Symbol 1563 MovieClip [player_wink] Frame 227
stop();
Symbol 1563 MovieClip [player_wink] Frame 237
stop();
Symbol 1563 MovieClip [player_wink] Frame 247
stop();
Symbol 1563 MovieClip [player_wink] Frame 257
stop();
Symbol 1563 MovieClip [player_wink] Frame 266
stop();
Symbol 1563 MovieClip [player_wink] Frame 275
stop();
Symbol 1563 MovieClip [player_wink] Frame 297
stop();
Symbol 1563 MovieClip [player_wink] Frame 309
stop();
Symbol 1563 MovieClip [player_wink] Frame 321
stop();
Symbol 1563 MovieClip [player_wink] Frame 329
stop();
Symbol 1563 MovieClip [player_wink] Frame 341
stop();
Symbol 1563 MovieClip [player_wink] Frame 350
stop();
Symbol 1563 MovieClip [player_wink] Frame 358
stop();
Symbol 1563 MovieClip [player_wink] Frame 368
stop();
Symbol 1563 MovieClip [player_wink] Frame 381
stop();
Symbol 1563 MovieClip [player_wink] Frame 391
stop();
Symbol 1563 MovieClip [player_wink] Frame 411
stop();
Symbol 1563 MovieClip [player_wink] Frame 425
stop();
Symbol 1563 MovieClip [player_wink] Frame 436
stop();
Symbol 1563 MovieClip [player_wink] Frame 447
stop();
Symbol 1563 MovieClip [player_wink] Frame 462
stop();
Symbol 1563 MovieClip [player_wink] Frame 475
stop();
Symbol 1563 MovieClip [player_wink] Frame 490
stop();
Symbol 1563 MovieClip [player_wink] Frame 505
stop();
Symbol 1563 MovieClip [player_wink] Frame 515
stop();
Symbol 1563 MovieClip [player_wink] Frame 525
stop();
Symbol 1563 MovieClip [player_wink] Frame 535
stop();
Symbol 1563 MovieClip [player_wink] Frame 545
stop();
Symbol 1563 MovieClip [player_wink] Frame 555
stop();
Symbol 1563 MovieClip [player_wink] Frame 571
stop();
Symbol 1563 MovieClip [player_wink] Frame 582
stop();
Symbol 1563 MovieClip [player_wink] Frame 599
stop();
Symbol 1563 MovieClip [player_wink] Frame 642
stop();
Symbol 1563 MovieClip [player_wink] Frame 673
stop();
Symbol 1563 MovieClip [player_wink] Frame 682
stop();
Symbol 1563 MovieClip [player_wink] Frame 688
stop();
Symbol 1563 MovieClip [player_wink] Frame 698
stop();
Symbol 1563 MovieClip [player_wink] Frame 704
stop();
Symbol 1601 MovieClip Frame 1
stop();
Symbol 1601 MovieClip Frame 2
stop();
Symbol 1627 MovieClip Frame 13
_parent.gotoAndStop("fly");
Symbol 1645 MovieClip Frame 16
gotoAndPlay ("loop");
Symbol 1683 MovieClip Frame 20
_parent.gotoAndStop("down");
Instance of Symbol 693 MovieClip in Symbol 1685 MovieClip Frame 1
onClipEvent (load) {
this.gotoAndPlay(5);
}
Instance of Symbol 693 MovieClip in Symbol 1694 MovieClip Frame 1
onClipEvent (load) {
this.gotoAndPlay(5);
}
Symbol 1694 MovieClip Frame 8
_parent.gotoAndStop("idle");
Symbol 1706 MovieClip Frame 13
_parent.gotoAndStop("idle");
Symbol 1724 MovieClip Frame 1
stop();
Symbol 1724 MovieClip Frame 850
stop();
Symbol 1726 MovieClip Frame 1
stop();
Symbol 1726 MovieClip Frame 106
stop();
_root.bossCount = 2;
this._visible = false;
Symbol 1732 Button
on (release) {
gotoAndPlay ("end");
}
Symbol 1738 MovieClip Frame 1
stop();
Symbol 1738 MovieClip Frame 977
_root.loadGame();
Symbol 1738 MovieClip Frame 1028
stop();
this._visible = false;
Symbol 1748 Button
on (release) {
if (_quality == "LOW") {
_quality = "MEDIUM";
} else if (_quality == "MEDIUM") {
_quality = "HIGH";
} else if (_quality == "HIGH") {
_quality = "LOW";
}
}
Symbol 1757 Button
on (release) {
getURL ("http://www.gamesofgondor.com", "_blank");
}
Symbol 1758 MovieClip Frame 1
mcFrame._visible = false;
Instance of Symbol 1743 MovieClip "mcPaused" in Symbol 1758 MovieClip Frame 1
onClipEvent (load) {
this._visible = false;
}