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 1047 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 = 1;
_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 = 1;
_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.depth = depth;
_local1.state = "grabbed";
_local1.actor = "staff";
_local1.lastState = 1;
_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 = 1;
_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.mode = 1;
_local1.modeCount = 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;
_local1.xDest = _local2._x + 1;
_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.modeCount = 0;
_local1.life = 40;
}
function boss(mc) {
var _local1 = this;
var _local2 = mc;
_local1.mc = _local2;
_local1.state = 1;
_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.modeCount = 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(torchName) {
name = this[torchName];
var _local2 = name.mc._x;
var _local1 = name.mc._y;
if (name.state == "inactive") {
if ((Math.abs(_local2 - p1.mc._x) <= xCutoff) && (Math.abs(_local1 - p1.mc._y) <= yCutoff)) {
name.state = 1;
name.mc._visible = true;
}
} else {
if ((name.state == 1) || (name.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 (name.mc.mcHit.hitTest(p1.mc._x + temp, p1.mc._y + p1.mc.mcMC.mcGrab._y, true)) {
name.state = "grabbed";
name.grabbedName = p1;
name.mc.swapDepths(grabbedDepth);
name.depth = grabbedDepth;
p1.holdName = name;
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) && (name.mc.mcHit.hitTest(p1.mc._x + temp, p1.mc._y + p1.mc.mcMC.mcAttack._y, true))) {
if (p1.mc._xscale > 0) {
name.xVel = p1.xForce * 4;
} else {
name.xVel = (-p1.xForce) * 4;
}
if (p1.mc.mcMC.mcAttack._y < -10) {
name.yVel = p1.yForce * 4;
}
name.state = "thrown";
name.mc.mcMC.mcHand.gotoAndStop("none");
}
}
if (name.state == 1) {
name.mc.mcMC.mcHand.gotoAndStop("none");
name._xscale = name.xScale0;
name._yscale = name.yScale0;
if (name.stopCount > 0) {
name.stopCount++;
if (name.stopCount > ((Math.random() * 45) + 15)) {
name.stopCount = 0;
name.mc._xscale = -name.mc._xscale;
}
}
if (name.xSpec > 0) {
name.xSpec--;
}
if (name.xSpec <= 0) {
if (name.xVel > name.xMax) {
name.xVel = name.xMax + ((name.xMax - name.xVel) / 8);
} else if (name.xVel < (-name.xMax)) {
name.xVel = (-name.xMax) + ((name.xVel + name.xMax) / 8);
}
}
if (name.xVel != 0) {
if (name.stopCount > 0) {
(_local1 - gravity);// not popped
(_local2 + name.xVel);// not popped
}
}
name.mc._x = name.mc._x + name.xVel;
if (((name.xVel != 0) && (!Key.isDown(name.keyLeft))) && (!Key.isDown(name.keyRight))) {
if ((!mapHit.hitTest(_local2, _local1, true)) && (mapHit.hitTest(_local2, _local1 + (gravity * 8), true))) {
temp = 0;
while ((temp < (gravity * 8)) && (!mapHit.hitTest(_local2, _local1 + temp, true))) {
temp = temp + gravity;
}
name.mc._y = name.mc._y + temp;
}
}
if (name.ySpec > 0) {
name.ySpec--;
}
if (name.ySpec <= 0) {
if (name.yVel > name.yMax) {
name.yVel = name.yMax;
} else if (name.yVel < (-name.yMax)) {
name.yVel = -name.yMax;
}
}
name.mc._y = name.mc._y + name.yVel;
if ((Math.abs(_local2 - p1.mc._x) > xCutoff) || (Math.abs(_local1 - p1.mc._y) > yCutoff)) {
name.state = "inactive";
name.mc._visible = false;
}
if (name.mc._xscale > 0) {
makeFire(name, name.mc.mcMC.mcMC._rotation);
} else {
makeFire(name, -name.mc.mcMC.mcMC._rotation);
}
} else if (name.state == "grabbed") {
name.mc.gotoAndStop("grabbed");
name.mc.mcMC.mcHand.gotoAndStop("Wink");
if (name.grabbedName.mc._xscale > 0) {
name.mc._x = name.grabbedName.mc._x + name.grabbedName.mc.mcMC.mcHand._x;
name.mc._xscale = name.grabbedName.mc.mcMC.mcHand._xscale;
name.mc._rotation = name.grabbedName.mc.mcMC.mcHand._rotation;
} else {
name.mc._x = name.grabbedName.mc._x - name.grabbedName.mc.mcMC.mcHand._x;
name.mc._xscale = -name.grabbedName.mc.mcMC.mcHand._xscale;
name.mc._rotation = -name.grabbedName.mc.mcMC.mcHand._rotation;
}
name.mc._y = name.grabbedName.mc._y + name.grabbedName.mc.mcMC.mcHand._y;
name.mc._yscale = name.grabbedName.mc.mcMC.mcHand._yscale;
makeFire(name, name.mc._rotation);
} else if (name.state == "thrown") {
name.mc.mcMC.mcHand.gotoAndStop("none");
name._xscale = name.xScale0;
name._yscale = name.yScale0;
if (name.xVel > 0) {
if (name.yVel != 0) {
name.xVel = name.xVel / frictionAir;
} else {
name.xVel = name.xVel / friction;
}
if (name.xVel <= 0.3) {
name.xVel = 0;
}
} else if (name.xVel < 0) {
if (name.yVel != 0) {
name.xVel = name.xVel / frictionAir;
} else {
name.xVel = name.xVel / friction;
}
if (name.xVel >= -0.3) {
name.xVel = 0;
}
}
if (name.xVel != 0) {
if (mapHit.hitTest(_local2 + name.xVel, _local1 - (gravity * 2), true)) {
if (name.xVel > 0) {
temp = name.xVel - name.xAcc;
enemyBounceRight(name, temp);
} else {
temp = name.xVel + name.xAcc;
enemyBounceLeft(name, temp);
}
if (Math.abs(name.xVel) <= 0.3) {
name.xVel = 0;
}
} else if (name.xVel > name.xMax) {
if (mapHit.hitTest(_local2 + (name.xVel / 2), _local1 - (gravity * 2), true)) {
temp = (name.xVel / 2) - name.xAcc;
enemyBounceRight(name, temp);
} else if (mapHit.hitTest(_local2, _local1 - (gravity * 2), true)) {
temp = -name.xAcc;
enemyBounceRight(name, temp);
}
} else if (name.xVel < (-name.xMax)) {
if (mapHit.hitTest(_local2 + (name.xVel / 2), _local1 - (gravity * 2), true)) {
temp = (name.xVel / 2) + name.xAcc;
enemyBounceLeft(name, temp);
} else if (mapHit.hitTest(_local2, _local1 - (gravity * 2), true)) {
temp = name.xAcc;
enemyBounceLeft(name, temp);
}
}
}
name.mc._x = name.mc._x + name.xVel;
if (((name.xVel != 0) && (!Key.isDown(name.keyLeft))) && (!Key.isDown(name.keyRight))) {
if ((!mapHit.hitTest(_local2, _local1, true)) && (mapHit.hitTest(_local2, _local1 + (gravity * 8), true))) {
temp = 0;
while ((temp < (gravity * 8)) && (!mapHit.hitTest(_local2, _local1 + temp, true))) {
temp = temp + gravity;
}
name.mc._y = name.mc._y + temp;
}
}
if (name.yVel > name.yMax) {
name.yVel = name.yMax;
}
if (!mapHit.hitTest(name.mc._x, (name.mc._y + gravity) + name.yVel, true)) {
if ((Math.abs(name.xVel) > 20) || (Math.abs(name.yVel) > 12)) {
name.mc.gotoAndStop("thrownBlur");
} else {
name.mc.gotoAndStop("thrown");
}
if (name.yVel > 20) {
if (!mapHit.hitTest(name.mc._x, (name.mc._y + gravity) + (name.yVel / 2), true)) {
name.yVel = name.yVel + gravity;
if (name.yVel > gravity) {
name.jumping = false;
}
if (!name.jumping) {
name.mc.gotoAndStop("fall");
}
} else {
enemy0HitGround(name);
name._y = name._y + (-gravity);
}
} else {
name.yVel = name.yVel + gravity;
if (name.yVel > gravity) {
name.jumping = false;
}
if (!name.jumping) {
name.mc.gotoAndStop("fall");
}
}
} else {
enemy0HitGround(name);
name.mc.gotoAndStop("bouncing");
if (name.xVel == 0) {
if (!mapHit.hitTest(name.mc._x - 10, name.mc._y + 3, true)) {
name.xVel = name.yVel * 2;
} else if (!mapHit.hitTest(name.mc._x - 20, name.mc._y + 3, true)) {
name.xVel = name.yVel;
} else if (!mapHit.hitTest(name.mc._x - 40, name.mc._y + 3, true)) {
name.xVel = name.yVel / 2;
} else if (!mapHit.hitTest(name.mc._x + 10, name.mc._y + 3, true)) {
name.xVel = (-name.yVel) * 2;
} else if (!mapHit.hitTest(name.mc._x + 20, name.mc._y + 3, true)) {
name.xVel = -name.yVel;
} else if (!mapHit.hitTest(name.mc._x + 40, name.mc._y + 3, true)) {
name.xVel = (-name.yVel) / 2;
}
}
}
if (name.yVel < 0) {
if (mapHit.hitTest(name.mc._x, (name.mc._y - name.head) + name.yVel, true)) {
temp = name.yVel + gravity;
name.mc._y = name.mc._y + temp;
name.yVel = 0.001;
while (mapHit.hitTest(name.mc._x, (name.mc._y - name.head) + temp, true)) {
name.mc._y = name.mc._y + gravity;
temp = temp + gravity;
}
}
}
name.mc._y = name.mc._y + name.yVel;
if ((name.xVel == 0) && (name.yVel == 0)) {
name.state = 1;
name.mc.gotoAndStop("down");
if (thrownName == name) {
thrownName = null;
}
}
if (name.mc._xscale > 0) {
makeFire(name, name.mc.mcMC.mcMC._rotation);
} else {
makeFire(name, -name.mc.mcMC.mcMC._rotation);
}
}
}
}
function playerControl(playerNum) {
name = this["p" + playerNum];
with (name) {
animHoldIdle--;
animHoldWalk--;
animHoldAir--;
animHoldCrouch--;
animHoldWallSlide--;
attackHold--;
grabCount--;
xSpec--;
ySpec--;
dashCount--;
dashHold--;
deflecting--;
}
if (Key.isDown(name.keyHide)) {
if (!name.hidePressed) {
name.hidePressed = true;
if (((name.xVel == 0) && (name.yVel == 0)) && (name.attackHold <= 0)) {
if (name.plane == "ground") {
if ((name.attackHold < 10) && (!mapHitShadow.hitTest(name.mc._x, name.mc._y, true))) {
if (name.state == 1) {
name.plane = "shadow";
name.mc.gotoAndStop("shadowTransIn");
name.animHoldIdle = 16;
name.attackHold = 14;
}
}
} else {
name.plane = "ground";
name.mc.gotoAndStop("shadowTransOut");
name.animHoldIdle = 16;
name.attackHold = 14;
}
}
}
} else {
name.hidePressed = false;
}
soundWink.onSoundComplete = function () {
soundWinkDone = true;
};
if (name.state == 1) {
if ((name.attackHold <= 0) && (name.xSpec <= 0)) {
if (Key.isDown(name.keyLeft)) {
if (mapHit.hitTest(name.mc._x, name.mc._y + (gravity * 2), true)) {
if (((name.grabCount <= 0) && (name.windup <= 0)) && (name.animHoldWalk <= 0)) {
if (name.mc._xscale > 0) {
name.mc.gotoAndStop("shadowTurn");
name.animHoldIdle = 2;
name.animHoldWalk = 2;
name.trans = null;
} else {
name.mc.gotoAndStop("shadowWalk");
name.trans = "walk";
}
}
name.mc._xscale = -100;
temp = name.xVel - name.xAcc;
if (temp < (-name.xShadowMax)) {
temp = -name.xShadowMax;
}
if (!mapHitShadow.hitTest(name.mc._x + temp, name.mc._y - gravity, true)) {
if ((!mapHit.hitTest(name.mc._x + temp, name.mc._y, true)) && (mapHit.hitTest(name.mc._x + temp, name.mc._y + (gravity * 8), true))) {
name.xVel = temp;
name.mc._y = name.mc._y + gravity;
temp = 0;
while ((temp < (gravity * 8)) && (!mapHit.hitTest(name.mc._x + name.xVel, name.mc._y + temp, true))) {
temp = temp + gravity;
}
name.mc._y = name.mc._y + temp;
} else if ((!mapHit.hitTest(name.mc._x + temp, name.mc._y - gravity, true)) && (mapHit.hitTest((name.mc._x - name.xAcc) + temp, name.mc._y + gravity, true))) {
name.xVel = temp;
} else if ((!mapHit.hitTest(name.mc._x + temp, name.mc._y - 9, true)) && (mapHit.hitTest((name.mc._x - name.xAcc) + temp, name.mc._y + gravity, true))) {
name.xVel = temp;
temp = gravity * 2;
while (mapHit.hitTest(name.mc._x + name.xVel, name.mc._y - temp, true)) {
temp = temp + gravity;
}
if (name.xVel > (-name.xAcc)) {
name.xVel = -name.xAcc;
}
name.mc._y = name.mc._y + ((-temp) + gravity);
name.yVel = 0;
} else {
if (name.xVel > 0) {
if (mapHit.hitTest(name.mc._x + name.xVel, name.mc._y - gravity, true)) {
temp = name.xVel - name.xAcc;
do {
if (!mapHit.hitTest(name.mc._x + temp, name.mc._y - gravity, true)) {
break;
}
temp = temp + (-name.xAcc);
} while (temp >= 0);
name.mc._x = name.mc._x + temp;
}
} else if (mapHit.hitTest(name.mc._x + name.xVel, name.mc._y - gravity, true)) {
temp = name.xVel + name.xAcc;
do {
if (!mapHit.hitTest(name.mc._x + temp, name.mc._y - gravity, true)) {
break;
}
temp = temp + name.xAcc;
} while (temp <= 0);
name.mc._x = name.mc._x + temp;
}
name.xVel = 0;
}
} else {
name.xVel = 0;
}
} else {
temp = name.xVel - name.xAirAcc;
if (temp < (-name.xShadowMax)) {
temp = -name.xShadowMax;
}
if (((!mapHit.hitTest(name.mc._x + temp, name.mc._y, true)) && (!mapHit.hitTest(name.mc._x + temp, name.mc._y - (name.head / 2), true))) && (!mapHit.hitTest(name.mc._x + temp, (name.mc._y - name.head) + 6, true))) {
if (name.xVel < (-name.xShadowMax)) {
if (((!mapHit.hitTest(name.mc._x + (temp / 2), name.mc._y, true)) && (!mapHit.hitTest(name.mc._x + (temp / 2), name.mc._y - (name.head / 2), true))) && (!mapHit.hitTest(name.mc._x + (temp / 2), (name.mc._y - name.head) + 6, true))) {
name.xVel = name.xVel + (-name.xAirAcc);
}
} else {
name.xVel = name.xVel + (-name.xAirAcc);
}
} else {
name.xVel = 0;
}
name.mc._xscale = -100;
}
if (soundWinkDone) {
soundWink.attachSound("s_sneak");
soundWink.start(0, 0);
soundWink.setPan(Math.ceil(((name.mc._x - mcCam._x) / 400) * 100));
soundWink.setVolume(70);
soundWinkDone = false;
}
} else if (Key.isDown(name.keyRight)) {
if (mapHit.hitTest(name.mc._x, name.mc._y + (gravity * 2), true)) {
if (((name.grabCount <= 0) && (name.windup <= 0)) && (name.animHoldWalk <= 0)) {
if (name.mc._xscale < 0) {
name.mc.gotoAndStop("shadowTurn");
name.animHoldIdle = 2;
name.animHoldWalk = 2;
name.trans = null;
} else {
name.mc.gotoAndStop("shadowWalk");
name.trans = "walk";
}
}
name.mc._xscale = 100;
temp = name.xVel + name.xAcc;
if (temp > name.xShadowMax) {
temp = name.xShadowMax;
}
if (!mapHitShadow.hitTest(name.mc._x + temp, name.mc._y - gravity, true)) {
if ((!mapHit.hitTest(name.mc._x + temp, name.mc._y, true)) && (mapHit.hitTest(name.mc._x + temp, name.mc._y + (gravity * 8), true))) {
name.xVel = temp;
name.mc._y = name.mc._y + gravity;
temp = 0;
while ((temp < (gravity * 8)) && (!mapHit.hitTest(name.mc._x + name.xVel, name.mc._y + temp, true))) {
temp = temp + gravity;
}
name.mc._y = name.mc._y + temp;
} else if ((!mapHit.hitTest(name.mc._x + temp, name.mc._y - gravity, true)) && (mapHit.hitTest((name.mc._x + name.xAcc) + temp, name.mc._y + gravity, true))) {
name.xVel = temp;
} else if ((!mapHit.hitTest(name.mc._x + temp, name.mc._y - 9, true)) && mapHit.hitTest((name.mc._x + name.xAcc) + temp, name.mc._y + gravity, true)) {
name.xVel = temp;
temp = gravity * 2;
while (mapHit.hitTest(name.mc._x + name.xVel, name.mc._y - temp, true)) {
temp = temp + gravity;
}
if (name.xVel < name.xAcc) {
name.xVel = name.xAcc;
}
name.mc._y = name.mc._y + ((-temp) + gravity);
name.yVel = 0;
} else {
if (name.xVel > 0) {
if (mapHit.hitTest(name.mc._x + name.xVel, name.mc._y - gravity, true)) {
temp = name.xVel - name.xAcc;
do {
if (!mapHit.hitTest(name.mc._x + temp, name.mc._y - gravity, true)) {
break;
}
temp = temp + (-name.xAcc);
} while (temp >= 0);
name.mc._x = name.mc._x + temp;
}
} else if (mapHit.hitTest(name.mc._x + name.xVel, name.mc._y - gravity, true)) {
temp = name.xVel + name.xAcc;
do {
if (!mapHit.hitTest(name.mc._x + temp, name.mc._y - gravity, true)) {
break;
}
temp = temp + name.xAcc;
} while (temp <= 0);
name.mc._x = name.mc._x + temp;
}
name.xVel = 0;
}
} else {
name.xVel = 0;
}
} else {
temp = name.xVel + name.xAirAcc;
if (temp > name.xShadowMax) {
temp = name.xShadowMax;
}
if (((!mapHit.hitTest(name.mc._x + temp, name.mc._y, true)) && (!mapHit.hitTest(name.mc._x + temp, name.mc._y - (name.head / 2), true))) && (!mapHit.hitTest(name.mc._x + temp, (name.mc._y - name.head) + 6, true))) {
if (name.xVel > name.xShadowMax) {
if (((!mapHit.hitTest(name.mc._x + (temp / 2), name.mc._y, true)) && (!mapHit.hitTest(name.mc._x + (temp / 2), name.mc._y - (name.head / 2), true))) && (!mapHit.hitTest(name.mc._x + (temp / 2), (name.mc._y - name.head) + 6, true))) {
name.xVel = name.xVel + name.xAirAcc;
}
} else {
name.xVel = name.xVel + name.xAirAcc;
}
} else {
name.xVel = 0;
}
name.mc._xscale = 100;
}
if (soundWinkDone) {
soundWink.attachSound("s_sneak");
soundWink.start(0, 0);
soundWink.setPan(Math.ceil(((name.mc._x - mcCam._x) / 400) * 100));
soundWinkDone = false;
}
} else if (name.xSpec <= 0) {
if (mapHit.hitTest(name.mc._x, name.mc._y + gravity, true)) {
if ((name.animHoldIdle <= 0) && (name.yVel == 0)) {
if ((name.grabCount <= 0) && (name.windup <= 0)) {
if (name.trans != null) {
name.trans = null;
name.mc.gotoAndStop("shadowIdle1");
name.animHoldIdle = 1;
} else {
name.mc.gotoAndStop("shadowIdle");
}
}
}
if (name.xVel > 0) {
name.xVel = name.xVel + ((-name.xAcc) * 2);
if (name.xVel <= 0.7) {
name.xVel = 0;
soundWink.stop();
soundWinkDone = true;
}
} else if (name.xVel < 0) {
name.xVel = name.xVel + (name.xAcc * 2);
if (name.xVel >= -0.7) {
name.xVel = 0;
soundWink.stop();
soundWinkDone = true;
}
}
}
}
}
if (name.xSpec <= 0) {
if (name.xVel > name.xMax) {
name.xVel = name.xMax + ((name.xMax - name.xVel) / 8);
} else if (name.xVel < (-name.xMax)) {
name.xVel = (-name.xMax) + ((name.xVel + name.xMax) / 8);
}
}
if (name.xVel != 0) {
if (mapHit.hitTest(name.mc._x + name.xVel, name.mc._y - gravity, true)) {
if (name.xVel > 0) {
temp = name.xVel - name.xAcc;
do {
if (!mapHit.hitTest(name.mc._x + temp, name.mc._y - gravity, true)) {
break;
}
temp = temp + (-name.xAcc);
} while (temp >= 0);
name.mc._x = name.mc._x + temp;
} else {
temp = name.xVel + name.xAcc;
do {
if (!mapHit.hitTest(name.mc._x + temp, name.mc._y - gravity, true)) {
break;
}
temp = temp + name.xAcc;
} while (temp <= 0);
name.mc._x = name.mc._x + temp;
}
name.xVel = 0;
}
}
name.mc._x = name.mc._x + name.xVel;
if ((name.xVel != 0) && (((!Key.isDown(name.keyLeft)) && (!Key.isDown(name.keyRight))) || (name.attackHold > 0))) {
if ((!mapHit.hitTest(name.mc._x, name.mc._y, true)) && (mapHit.hitTest(name.mc._x, name.mc._y + (gravity * 8), true))) {
temp = 0;
while ((temp < (gravity * 8)) && (!mapHit.hitTest(name.mc._x, name.mc._y + temp, true))) {
temp = temp + gravity;
}
name.mc._y = name.mc._y + temp;
}
}
}
// unexpected jump
if (name.plane == "ground") {
if (name.state == 1) {
if (!Key.isDown(name.keyDown1)) {
name.crouchMoved = false;
name.crouched = false;
name.headbouncing = 0;
}
temp = 1;
while (temp <= projectiles) {
temp2 = "proj_" + temp;
temp2 = this[temp2];
if (((temp2.mc._x != undefined) && (temp2.state == "thrown")) && ((temp2.hitTarget == 1) || (temp2.hitTarget == 3))) {
if (Math.abs(temp2.mc._x - name.mc._x) < 200) {
if (name.deflecting > 0) {
if (name.mc.mcMC.mcHit.hitTest(temp2.mc._x, temp2.mc._y, true)) {
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.modeCount = 14;
temp2.mc._rotation = 0;
var projectileNum = projectiles;
i = 1;
while (i <= projectiles) {
j = "proj_" + i;
if ((!this[j].mc._visible) || (this[j].mc == undefined)) {
projectileNum = i;
break;
}
i++;
}
mcAll.mcMain.attachMovie("lightning", "proj_mc_" + projectileNum, projectileDepth + projectileNum, {_x:x, _y:y});
this["proj_" + projectileNum] = new projectile(mcAll.mcMain["proj_mc_" + projectileNum], "lightning", 2);
temp2 = this["proj_" + projectileNum];
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 ((!this[j].mc._visible) || (this[j].mc == undefined)) {
projectileNum = i;
break;
}
i++;
}
mcAll.mcMain.attachMovie("lightning", "proj_mc_" + projectileNum, projectileDepth + projectileNum, {_x:x, _y:y});
this["proj_" + projectileNum] = new projectile(mcAll.mcMain["proj_mc_" + projectileNum], "lightning", 2);
temp2 = this["proj_" + projectileNum];
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 ((!this[j].mc._visible) || (this[j].mc == undefined)) {
projectileNum = i;
break;
}
i++;
}
mcAll.mcMain.attachMovie("lightning", "proj_mc_" + projectileNum, projectileDepth + projectileNum, {_x:x, _y:y});
this["proj_" + projectileNum] = new projectile(mcAll.mcMain["proj_mc_" + projectileNum], "lightning", 2);
temp2 = this["proj_" + projectileNum];
temp2.life = 7;
if (name.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");
}
}
} else if (name.mc.mcHit.hitTest(temp2.mc._x, temp2.mc._y, true)) {
name.xVel = temp2.xVel;
if (name.xVel > 0) {
name.xVel = name.xVel + (Math.random() * 4);
} else {
name.xVel = name.xVel + (Math.random() * -4);
}
name.yVel = (Math.random() * -6) - 8;
name.state = "thrown";
name.mc.gotoAndStop("thrown");
name.trans = null;
if (name.holdName != null) {
name.holdName.state = "thrown";
name.holdName.mc._rotation = 0;
name.holdName.xVel = (Math.random() * 10) + name.xVel;
name.holdName.yVel = (Math.random() * -6) - 10;
name.holdName.grabbedName = null;
name.holdName = null;
name.grabCount = 0;
}
if (temp2.projType == "fireball") {
temp2.state = "hit";
temp2.mc.gotoAndStop("hit");
temp2.modeCount = -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(((name.mc._x - mcCam._x) / 400) * 100));
soundWinkDone = true;
} else if (temp2.projType == "wind") {
temp2.state = "hit";
temp2.mc.gotoAndStop("hit");
temp2.modeCount = -123;
soundWink.attachSound("s_winkhit2");
soundWink.start(0, 0);
soundWink.setPan(Math.ceil(((name.mc._x - mcCam._x) / 400) * 100));
soundWinkDone = true;
} else if (temp2.projType == "lightning") {
temp2.state = "hit";
temp2.mc.gotoAndStop("hit");
temp2.modeCount = -123;
soundFX.attachSound("s_lightninghit");
soundFX.start(0, 0);
soundFX.setPan(Math.ceil(((name.mc._x - mcCam._x) / 400) * 100));
}
}
}
}
temp++;
}
if (name.whacking == 2) {
name.whacking = 3;
name.trans = null;
name.mc.gotoAndStop("staffMelee");
name.animholdIdle = 20;
name.attackHold = 18;
} else if (name.whacking == 1) {
name.whacking = 0;
name.trans = null;
name.mc.gotoAndStop("staffAttack3");
name.animholdIdle = 14;
name.attackHold = 13;
staffAttack(name.holdName, 3, 2, -123);
} else if ((name.whacking == 3) && (name.attackHold <= 0)) {
name.whacking = 0;
}
if ((Key.isDown(name.keyFast) && (name.yVel == 0)) && (name.attackHold <= 0)) {
name.fastPressed = true;
name.trans = null;
if (name.mc._xscale > 0) {
if (Key.isDown(name.keyRight)) {
if ((!name.rightPressed) || (name.xSpec <= 0)) {
with (name) {
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(((name.mc._x - mcCam._x) / 400) * 100));
soundWink.setVolume(80);
soundWinkDone = false;
}
}
name.rightPressed = true;
} else {
name.rightPressed = false;
}
} else if (name.mc._xscale < 0) {
if (Key.isDown(name.keyLeft)) {
if ((!name.leftPressed) || (name.xSpec <= 0)) {
with (name) {
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(((name.mc._x - mcCam._x) / 400) * 100));
soundWink.setVolume(80);
soundWinkDone = false;
}
}
name.leftPressed = true;
} else {
name.leftPressed = false;
}
}
} else {
name.fastPressed = false;
}
if (Key.isDown(name.keyAttack)) {
if ((!name.attackPressed) && (name.attackHold <= 0)) {
name.attackPressed = true;
temp = name.holdName.mc._name.substring(0, 5);
if (name.yVel == 0) {
if (temp == "staff") {
if (name.dashHold < 0) {
if (Key.isDown(name.keyUp1)) {
name.xVel = 0;
name.trans = null;
if (Key.isDown(name.keyLeft) || Key.isDown(name.keyRight)) {
name.mc.gotoAndStop("staffAttack3");
name.attackHold = 14;
staffAttack(name.holdName, 2, 2, -123);
} else {
name.mc.gotoAndStop("staffAttack1");
name.attackHold = 14;
staffAttack(name.holdName, 1, 2, -123);
}
} else if (((name.mc._xscale > 0) && Key.isDown(name.keyRight)) || (((name.mc._xscale < 0) && Key.isDown(name.keyLeft)) && (!Key.isDown(name.keyDown1)))) {
name.xVel = 0;
name.mc.gotoAndStop("staffDeflect");
name.animHoldIdle = 13;
name.attackHold = 12;
name.deflecting = 12;
name.trans = null;
soundWink.attachSound("s_deflect");
soundWink.start(0, 0);
soundWink.setPan(Math.ceil(((name.mc._x - mcCam._x) / 400) * 100));
} else {
name.xVel = 0;
name.whacking = 1;
}
}
}
} else if (temp == "staff") {
if (Key.isDown(name.keyDown1)) {
if (Key.isDown(name.keyLeft) || (Key.isDown(name.keyRight))) {
name.mc.gotoAndStop("staffAttackAir3");
name.attackHold = 14;
name.animHoldAir = 14;
staffAttack(name.holdName, 4, 2, -123);
} else {
name.mc.gotoAndStop("staffAttackAir5");
name.attackHold = 14;
name.animHoldAir = 14;
staffAttack(name.holdName, 5, 2, -123);
}
} else if (Key.isDown(name.keyUp1)) {
if (Key.isDown(name.keyLeft) || Key.isDown(name.keyRight)) {
name.mc.gotoAndStop("staffAttackAir3");
name.attackHold = 14;
name.animHoldAir = 14;
staffAttack(name.holdName, 2, 2, -123);
} else {
name.mc.gotoAndStop("staffAttackAir1");
name.attackHold = 14;
name.animHoldAir = 14;
staffAttack(name.holdName, 1, 2, -123);
}
} else {
name.mc.gotoAndStop("staffAttackAir3");
name.attackHold = 14;
name.animHoldAir = 14;
staffAttack(name.holdName, 3, 2, -123);
}
}
}
} else {
name.attackPressed = false;
}
if ((Key.isDown(name.keyGrab) && (name.attackHold <= 0)) && (name.xSpec <= 0)) {
if ((!name.grabPressed) && (name.holdName != null)) {
if (name.windup < xThrowMax) {
name.windup++;
}
if (name.yVel == 0) {
if (Key.isDown(name.keyDown1)) {
} else if (Key.isDown(name.keyRight) || (Key.isDown(name.keyLeft))) {
if (name.xVel == 0) {
name.mc.gotoAndStop("throwWalkWindup");
}
} else if (name.animHoldIdle <= 0) {
name.mc.gotoAndStop("throwIdleWindup");
name.mc.mcMC.gotoAndStop(name.windup);
}
}
} else if ((!name.grabPressed) && (name.grabCount <= 0)) {
name.grabPressed = true;
name.grabCount = 10;
if (name.yVel != 0) {
name.mc.gotoAndStop("grabAir");
} else if (Key.isDown(name.keyDown1)) {
name.xVel = 0;
name.mc.gotoAndStop("grabCrouch");
} else if (Key.isDown(name.keyRight) || (Key.isDown(name.keyLeft))) {
name.grabCount = 10;
name.xVel = 0;
name.mc.gotoAndStop("grabWalk");
name.attackHold = 14;
name.animHoldIdle = 24;
name.trans = null;
} else {
name.grabCount = 10;
name.xVel = 0;
name.mc.gotoAndStop("grabIdle");
name.attackHold = 14;
name.animHoldIdle = 24;
}
}
} else if (((name.windup > 0) && (name.holdName != null)) && (name.attackHold <= 0)) {
if (name.yVel == 0) {
if (Key.isDown(name.keyUp1)) {
if (Key.isDown(name.keyRight) || (Key.isDown(name.keyLeft))) {
name.holdName.xVel = name.windup + 10;
name.holdName.yVel = (-name.windup) - 10;
if (name.holdName.yVel < (-yThrowMax)) {
name.holdName.yVel = -yThrowMax;
}
name.mc.gotoAndStop("throwWalk2");
name.animHoldWalk = 7;
} else {
name.holdName.xVel = 0;
name.holdName.yVel = (-name.windup) - 15;
if (name.holdName.yVel < (-yThrowMax)) {
name.holdName.yVel = -yThrowMax;
}
name.mc.gotoAndStop("throwIdle1");
name.animHoldIdle = 7;
}
} else if (Key.isDown(name.keyRight) || (Key.isDown(name.keyLeft))) {
if (Key.isDown(name.keyDown1)) {
name.holdName.xVel = name.windup + 10;
name.holdName.yVel = name.windup + 10;
if (name.holdName.yVel > yThrowMax) {
name.holdName.yVel = yThrowMax;
}
name.mc.gotoAndStop("throwCrouch");
name.animHoldCrouch = 11;
} else {
name.xVel = 0;
name.xSpec = 12;
name.holdName.xVel = name.windup + 20;
name.holdName.yVel = (-name.windup) / 4;
name.mc.gotoAndStop("throwWalk3");
name.animHoldWalk = 16;
}
} else if (Key.isDown(name.keyDown1)) {
if (mapHit.hitTest(name.holdName.mc._x, name.holdName.mc._y - gravity, true)) {
name.holdName.mc._x = name.mc._x;
}
name.holdName.xVel = 0;
name.holdName.yVel = name.windup;
name.mc.gotoAndStop("throwCrouch");
name.animHoldCrouch = 11;
} else {
name.holdName.xVel = name.windup + 8;
name.holdName.yVel = (-name.windup) / 4;
if (name.windup > 4) {
name.mc.gotoAndStop("throwIdle3");
name.animHoldIdle = 16;
} else {
name.mc.gotoAndStop("throwIdle3b");
name.animHoldIdle = 10;
}
if (mapHit.hitTest(name.holdName.mc._x, name.holdName.mc._y - gravity, true)) {
name.holdName.mc._x = name.mc._x;
}
}
} else if (Key.isDown(name.keyRight) || (Key.isDown(name.keyLeft))) {
if (Key.isDown(name.keyUp1)) {
name.holdName.xVel = name.windup + 10;
name.holdName.yVel = (-name.windup) - 10;
if (name.holdName.yVel < (-yThrowMax)) {
name.holdName.yVel = -yThrowMax;
name.mc.gotoAndStop("throwAir2");
name.animHoldAir = 12;
}
} else if (Key.isDown(name.keyDown1)) {
name.holdName.xVel = name.windup + 10;
name.holdName.yVel = name.windup + 10;
name.holdName.yVel = yThrowMax;
name.mc.gotoAndStop("throwAir4");
name.animHoldAir = 14;
} else {
name.holdName.xVel = name.windup + 10;
name.holdName.yVel = (-name.windup) / 4;
name.mc.gotoAndStop("throwAir3");
name.animHoldAir = 12;
}
} else if (Key.isDown(name.keyUp1)) {
name.holdName.xVel = 0;
name.holdName.yVel = (-name.windup) - 15;
if (name.holdName.yVel < (-yThrowMax)) {
name.holdName.yVel = -yThrowMax;
}
name.mc.gotoAndStop("throwAir1");
name.animHoldAir = 7;
} else if (Key.isDown(name.keyDown1)) {
name.holdName.xVel = 0;
name.holdName.yVel = name.windup + 10;
if (name.holdName.yVel > yThrowMax) {
name.holdName.yVel = yThrowMax;
}
name.mc.gotoAndStop("throwAir5");
name.animHoldAir = 15;
} else {
name.holdName.xVel = name.windup + 8;
name.holdName.yVel = (-name.windup) / 4;
name.mc.gotoAndStop("throwAir3");
name.animHoldAir = 7;
}
if (name.mc._xscale < 0) {
name.holdName.xVel = -name.holdName.xVel;
}
name.holdName.state = "thrown";
name.holdName.mc._rotation = 0;
name.grabPressed = false;
thrownName = name.holdName;
name.holdName.grabbedName = null;
name.holdName = null;
name.grabCount = 0;
name.windup = 0;
} else {
name.grabPressed = false;
}
if ((name.attackHold <= 0) && (name.xSpec <= 0)) {
if (Key.isDown(name.keyLeft)) {
if (mapHit.hitTest(name.mc._x, name.mc._y + (gravity * 2), true)) {
if (Key.isDown(name.keyDown1)) {
name.crouchMoved = true;
name.crouched = false;
if (((name.grabCount <= 0) && (name.windup <= 0)) && (name.animHoldCrouch <= 0)) {
name.mc.gotoAndStop("crouchWalk");
name.trans = "walk";
}
name.mc._xscale = -100;
temp = name.xVel - name.xAcc;
if (temp < (-name.xCrouchMax)) {
temp = -name.xCrouchMax;
}
if ((!mapHit.hitTest(name.mc._x + temp, name.mc._y, true)) && (mapHit.hitTest(name.mc._x + temp, name.mc._y + (gravity * 8), true))) {
name.xVel = temp;
name.mc._y = name.mc._y + gravity;
temp = 0;
while ((temp < (gravity * 8)) && (!mapHit.hitTest(name.mc._x + name.xVel, name.mc._y + temp, true))) {
temp = temp + gravity;
}
name.mc._y = name.mc._y + temp;
} else if ((!mapHit.hitTest(name.mc._x + temp, name.mc._y - gravity, true)) && (mapHit.hitTest((name.mc._x - name.xAcc) + temp, name.mc._y + gravity, true))) {
name.xVel = temp;
} else if ((!mapHit.hitTest(name.mc._x + temp, name.mc._y - 9, true)) && mapHit.hitTest((name.mc._x - name.xAcc) + temp, name.mc._y + gravity, true)) {
name.xVel = temp;
temp = gravity * 2;
while (mapHit.hitTest(name.mc._x + name.xVel, name.mc._y - temp, true)) {
temp = temp + gravity;
}
if (name.xVel > (-name.xAcc)) {
name.xVel = -name.xAcc;
}
name.mc._y = name.mc._y + ((-temp) + gravity);
name.yVel = 0;
} else {
if (mapHit.hitTest(name.mc._x + name.xVel, name.mc._y - gravity, true)) {
temp = name.xVel + name.xAcc;
do {
if (!mapHit.hitTest(name.mc._x + temp, name.mc._y - gravity, true)) {
break;
}
temp = temp + name.xAcc;
} while (temp <= 0);
name.mc._x = name.mc._x + temp;
}
name.xVel = 0;
}
} else {
if (((name.grabCount <= 0) && (name.windup <= 0)) && (name.animHoldWalk <= 0)) {
if (name.mc._xscale > 0) {
name.mc.gotoAndStop("turn");
name.animHoldIdle = 2;
name.animHoldWalk = 2;
name.trans = null;
} else {
name.mc.gotoAndStop("walk");
name.trans = "walk";
}
}
name.mc._xscale = -100;
temp = name.xVel - name.xAcc;
if (temp < (-name.xWalkMax)) {
temp = -name.xWalkMax;
}
if ((!mapHit.hitTest(name.mc._x + temp, name.mc._y, true)) && (mapHit.hitTest(name.mc._x + temp, name.mc._y + (gravity * 8), true))) {
name.xVel = temp;
name.mc._y = name.mc._y + gravity;
temp = 0;
while ((temp < (gravity * 8)) && (!mapHit.hitTest(name.mc._x + name.xVel, name.mc._y + temp, true))) {
temp = temp + gravity;
}
name.mc._y = name.mc._y + temp;
} else if (!mapHit.hitTest(name.mc._x + temp, name.mc._y - gravity, true)) {
name.xVel = temp;
} else if (!mapHit.hitTest(name.mc._x + temp, name.mc._y - 9, true)) {
name.xVel = temp;
temp = gravity * 2;
while (mapHit.hitTest(name.mc._x + name.xVel, name.mc._y - temp, true)) {
temp = temp + gravity;
}
if (name.xVel > (-name.xAcc)) {
name.xVel = -name.xAcc;
}
name.mc._y = name.mc._y + ((-temp) + gravity);
name.yVel = 0;
} else {
if (name.xVel > 0) {
if (mapHit.hitTest(name.mc._x + name.xVel, name.mc._y - gravity, true)) {
temp = name.xVel - name.xAcc;
do {
if (!mapHit.hitTest(name.mc._x + temp, name.mc._y - gravity, true)) {
break;
}
temp = temp + (-name.xAcc);
} while (temp >= 0);
name.mc._x = name.mc._x + temp;
}
} else if (mapHit.hitTest(name.mc._x + name.xVel, name.mc._y - gravity, true)) {
temp = name.xVel + name.xAcc;
do {
if (!mapHit.hitTest(name.mc._x + temp, name.mc._y - gravity, true)) {
break;
}
temp = temp + name.xAcc;
} while (temp <= 0);
name.mc._x = name.mc._x + temp;
}
name.xVel = 0;
}
}
} else {
temp = name.xVel - name.xAirAcc;
if (temp < (-name.xWalkMax)) {
temp = -name.xWalkMax;
}
if (((!mapHit.hitTest(name.mc._x + temp, name.mc._y, true)) && (!mapHit.hitTest(name.mc._x + temp, name.mc._y - (name.head / 2), true))) && (!mapHit.hitTest(name.mc._x + temp, (name.mc._y - name.head) + 6, true))) {
if (name.xVel < (-name.xWalkMax)) {
if (((!mapHit.hitTest(name.mc._x + (temp / 2), name.mc._y, true)) && (!mapHit.hitTest(name.mc._x + (temp / 2), name.mc._y - (name.head / 2), true))) && (!mapHit.hitTest(name.mc._x + (temp / 2), (name.mc._y - name.head) + 6, true))) {
name.xVel = name.xVel + (-name.xAirAcc);
}
} else {
name.xVel = name.xVel + (-name.xAirAcc);
}
} else {
name.xVel = 0;
}
name.mc._xscale = -100;
}
} else if (Key.isDown(name.keyRight)) {
if (mapHit.hitTest(name.mc._x, name.mc._y + (gravity * 2), true)) {
if (Key.isDown(name.keyDown1)) {
name.crouchMoved = true;
name.crouched = false;
if (((name.grabCount <= 0) && (name.windup <= 0)) && (name.animHoldCrouch <= 0)) {
name.mc.gotoAndStop("crouchWalk");
name.trans = "walk";
}
name.mc._xscale = 100;
temp = name.xVel + name.xAcc;
if (temp > name.xCrouchMax) {
temp = name.xCrouchMax;
}
if ((!mapHit.hitTest(name.mc._x + temp, name.mc._y, true)) && (mapHit.hitTest(name.mc._x + temp, name.mc._y + (gravity * 8), true))) {
name.xVel = temp;
name.mc._y = name.mc._y + gravity;
temp = 0;
while ((temp < (gravity * 8)) && (!mapHit.hitTest(name.mc._x + name.xVel, name.mc._y + temp, true))) {
temp = temp + gravity;
}
name.mc._y = name.mc._y + temp;
} else if ((!mapHit.hitTest(name.mc._x + temp, name.mc._y - gravity, true)) && mapHit.hitTest((name.mc._x + name.xAcc) + temp, name.mc._y + gravity, true)) {
name.xVel = temp;
} else if ((!mapHit.hitTest(name.mc._x + temp, name.mc._y - 9, true)) && mapHit.hitTest((name.mc._x + name.xAcc) + temp, name.mc._y + gravity, true)) {
name.xVel = temp;
temp = gravity * 2;
while (mapHit.hitTest(name.mc._x + name.xVel, name.mc._y - temp, true)) {
temp = temp + gravity;
}
if (name.xVel < name.xAcc) {
name.xVel = name.xAcc;
}
name.mc._y = name.mc._y + ((-temp) + gravity);
name.yVel = 0;
} else {
if (mapHit.hitTest(name.mc._x + name.xVel, name.mc._y - gravity, true)) {
temp = name.xVel - name.xAcc;
do {
if (!mapHit.hitTest(name.mc._x + temp, name.mc._y - gravity, true)) {
break;
}
temp = temp + (-name.xAcc);
} while (temp >= 0);
name.mc._x = name.mc._x + temp;
}
name.xVel = 0;
}
} else {
if (((name.grabCount <= 0) && (name.windup <= 0)) && (name.animHoldWalk <= 0)) {
if (name.mc._xscale < 0) {
name.mc.gotoAndStop("turn");
name.animHoldIdle = 2;
name.animHoldWalk = 2;
name.trans = null;
} else {
name.mc.gotoAndStop("walk");
name.trans = "walk";
}
}
name.mc._xscale = 100;
temp = name.xVel + name.xAcc;
if (temp > name.xWalkMax) {
temp = name.xWalkMax;
}
if ((!mapHit.hitTest(name.mc._x + temp, name.mc._y, true)) && (mapHit.hitTest(name.mc._x + temp, name.mc._y + (gravity * 8), true))) {
name.xVel = temp;
name.mc._y = name.mc._y + gravity;
temp = 0;
while ((temp < (gravity * 8)) && (!mapHit.hitTest(name.mc._x + name.xVel, name.mc._y + temp, true))) {
temp = temp + gravity;
}
name.mc._y = name.mc._y + temp;
} else if (!mapHit.hitTest(name.mc._x + temp, name.mc._y - gravity, true)) {
name.xVel = temp;
} else if (!mapHit.hitTest(name.mc._x + temp, name.mc._y - 9, true)) {
name.xVel = temp;
temp = gravity * 2;
while (mapHit.hitTest(name.mc._x + name.xVel, name.mc._y - temp, true)) {
temp = temp + gravity;
}
if (name.xVel < name.xAcc) {
name.xVel = name.xAcc;
}
name.mc._y = name.mc._y + ((-temp) + gravity);
name.yVel = 0;
} else {
if (name.xVel > 0) {
if (mapHit.hitTest(name.mc._x + name.xVel, name.mc._y - gravity, true)) {
temp = name.xVel - name.xAcc;
do {
if (!mapHit.hitTest(name.mc._x + temp, name.mc._y - gravity, true)) {
break;
}
temp = temp + (-name.xAcc);
} while (temp >= 0);
name.mc._x = name.mc._x + temp;
}
} else if (mapHit.hitTest(name.mc._x + name.xVel, name.mc._y - gravity, true)) {
temp = name.xVel + name.xAcc;
do {
if (!mapHit.hitTest(name.mc._x + temp, name.mc._y - gravity, true)) {
break;
}
temp = temp + name.xAcc;
} while (temp <= 0);
name.mc._x = name.mc._x + temp;
}
name.xVel = 0;
}
}
} else {
temp = name.xVel + name.xAirAcc;
if (temp > name.xWalkMax) {
temp = name.xWalkMax;
}
if (((!mapHit.hitTest(name.mc._x + temp, name.mc._y, true)) && (!mapHit.hitTest(name.mc._x + temp, name.mc._y - (name.head / 2), true))) && (!mapHit.hitTest(name.mc._x + temp, (name.mc._y - name.head) + 6, true))) {
if (name.xVel > name.xWalkMax) {
if (((!mapHit.hitTest(name.mc._x + (temp / 2), name.mc._y, true)) && (!mapHit.hitTest(name.mc._x + (temp / 2), name.mc._y - (name.head / 2), true))) && (!mapHit.hitTest(name.mc._x + (temp / 2), (name.mc._y - name.head) + 6, true))) {
name.xVel = name.xVel + name.xAirAcc;
}
} else {
name.xVel = name.xVel + name.xAirAcc;
}
} else {
name.xVel = 0;
}
name.mc._xscale = 100;
}
} else if (name.xSpec <= 0) {
if (mapHit.hitTest(name.mc._x, name.mc._y + gravity, true)) {
if ((name.animHoldIdle <= 0) && (name.yVel == 0)) {
if (Key.isDown(name.keyDown1)) {
if (name.crouchMoved) {
if (!name.crouched) {
name.crouched = true;
name.mc.gotoAndStop("crouch2");
name.trans = "walk";
}
} else if (!name.crouched) {
name.crouched = true;
name.mc.gotoAndStop("crouch");
name.trans = "walk";
}
} else if ((name.grabCount <= 0) && (name.windup <= 0)) {
if (name.trans != null) {
name.trans = null;
name.mc.gotoAndStop("idle1");
name.animHoldIdle = 3;
} else {
name.mc.gotoAndStop("idle");
}
}
}
if (name.xVel > 0) {
name.xVel = name.xVel + ((-name.xAcc) * 2);
if (name.xVel <= 0.7) {
name.xVel = 0;
}
} else if (name.xVel < 0) {
name.xVel = name.xVel + (name.xAcc * 2);
if (name.xVel >= -0.7) {
name.xVel = 0;
}
}
} else if (name.xVel > 0) {
if ((name.grabCount <= 0) && (name.animHoldAir <= 0)) {
if (name.windup <= 0) {
name.mc.gotoAndStop("fall");
} else {
name.mc.gotoAndStop("throwAirWindup");
name.mc.mcMC.gotoAndStop(name.windup);
}
name.jumpPressed = true;
name.animHoldAir = 16;
}
name.xVel = name.xVel + ((-name.xAcc) / 2);
if (name.xVel <= 0) {
name.xVel = 0;
}
} else if (name.xVel < 0) {
if ((name.grabCount <= 0) && (name.animHoldAir <= 0)) {
if (name.windup <= 0) {
name.mc.gotoAndStop("fall");
} else {
name.mc.gotoAndStop("throwAirWindup");
name.mc.mcMC.gotoAndStop(name.windup);
}
name.jumpPressed = true;
name.animHoldAir = 16;
}
name.xVel = name.xVel + (name.xAcc / 2);
if (name.xVel >= 0) {
name.xVel = 0;
}
}
}
} else if (name.xVel != 0) {
if ((name.dashHold > 0) && (name.dashHold < 4)) {
if ((name.mc._xscale > 0) && (Key.isDown(name.keyRight))) {
if (name.yVel == 0) {
name.mc.gotoAndStop("dashLoop");
} else if (((name.fallTime <= 6) && (!name.jumping)) && (Math.abs(name.yVel) <= gravity)) {
name.mc.gotoAndStop("dashLoop");
} else {
name.mc.gotoAndStop("dashJump");
}
name.dashHold++;
name.xVel = name.dashVel;
name.xSpec++;
if ((!mapHit.hitTest(name.mc._x + name.xVel, name.mc._y - 9, true)) && (mapHit.hitTest(name.mc._x + name.xVel, name.mc._y, true))) {
playerUpHill();
}
} else if ((name.mc._xscale < 0) && (Key.isDown(name.keyLeft))) {
if (name.yVel == 0) {
name.mc.gotoAndStop("dashLoop");
} else if (((name.fallTime <= 6) && (!name.jumping)) && (Math.abs(name.yVel) <= gravity)) {
name.mc.gotoAndStop("dashLoop");
} else {
name.mc.gotoAndStop("dashJump");
}
name.dashHold++;
name.xVel = -name.dashVel;
name.xSpec++;
if ((!mapHit.hitTest(name.mc._x + name.xVel, name.mc._y - 9, true)) && (mapHit.hitTest(name.mc._x + name.xVel, name.mc._y, true))) {
playerUpHill();
}
} else if (name.yVel == 0) {
name.mc.gotoAndStop("dashEnd");
name.animHoldIdle = 6;
}
} else if (name.dashHold > 0) {
if ((!mapHit.hitTest(name.mc._x + name.xVel, name.mc._y - 9, true)) && (mapHit.hitTest(name.mc._x + name.xVel, name.mc._y, true))) {
playerUpHill();
}
}
}
if (name.xSpec <= 0) {
if (name.yVel != 0) {
if (name.xVel > name.xAirMax) {
name.xVel = name.xAirMax + ((name.xAirMax - name.xVel) / 8);
} else if (name.xVel < (-name.xAirMax)) {
name.xVel = (-name.xAirMax) + ((name.xVel + name.xAirMax) / 8);
}
} else if (Key.isDown(name.keyDown1) && (name.yVel == 0)) {
if (name.xVel > name.xCrouchMax) {
name.xVel = name.xCrouchMax + ((name.xCrouchMax - name.xVel) / 8);
} else if (name.xVel < (-name.xCrouchMax)) {
name.xVel = (-name.xCrouchMax) + ((name.xVel + name.xCrouchMax) / 8);
}
} else if (name.xVel > name.xMax) {
name.xVel = name.xMax + ((name.xMax - name.xVel) / 8);
} else if (name.xVel < (-name.xMax)) {
name.xVel = (-name.xMax) + ((name.xVel + name.xMax) / 8);
}
}
if (name.xVel != 0) {
if (mapHit.hitTest(name.mc._x + name.xVel, name.mc._y - gravity, true)) {
if (name.xVel > 0) {
temp = name.xVel - name.xAcc;
do {
if (!mapHit.hitTest(name.mc._x + temp, name.mc._y - gravity, true)) {
break;
}
temp = temp + (-name.xAcc);
} while (temp >= 0);
name.mc._x = name.mc._x + temp;
} else {
temp = name.xVel + name.xAcc;
do {
if (!mapHit.hitTest(name.mc._x + temp, name.mc._y - gravity, true)) {
break;
}
temp = temp + name.xAcc;
} while (temp <= 0);
name.mc._x = name.mc._x + temp;
}
name.xVel = 0;
}
}
name.mc._x = name.mc._x + name.xVel;
if ((name.xVel != 0) && (((!Key.isDown(name.keyLeft)) && (!Key.isDown(name.keyRight))) || (name.attackHold > 0))) {
if ((!mapHit.hitTest(name.mc._x, name.mc._y, true)) && (mapHit.hitTest(name.mc._x, name.mc._y + (gravity * 8), true))) {
temp = 0;
while ((temp < (gravity * 8)) && (!mapHit.hitTest(name.mc._x, name.mc._y + temp, true))) {
temp = temp + gravity;
}
name.mc._y = name.mc._y + temp;
}
}
if (!mapHit.hitTest(name.mc._x, (name.mc._y + gravity) + name.yVel, true)) {
if (name.ySpec <= 0) {
name.yVel = name.yVel + gravity;
if (name.yVel > gravity) {
name.jumping = false;
}
name.trans = null;
}
if ((name.grabCount <= 0) && (name.animHoldAir <= 0)) {
if (name.windup <= 0) {
name.mc.gotoAndStop("fall");
} else {
name.mc.gotoAndStop("throwAirWindup");
name.mc.mcMC.gotoAndStop(name.windup);
}
name.jumpPressed = true;
name.animHoldAir = 16;
}
if (name.yVel > 0) {
name.fallTime++;
}
} else {
name.yVel = name.yVel + (-gravity);
temp = name.yMax;
if (!mapHit.hitTest(name.mc._x, name.mc._y - name.head, true)) {
while (mapHit.hitTest(name.mc._x, name.mc._y + name.yVel, true)) {
name.yVel = name.yVel + (-gravity);
temp = temp + (-gravity);
if (temp < gravity) {
if (mapHit.hitTest(name.mc._x - 50, name.mc._y + 10, true)) {
name.mc._x = name.mc._x + 50;
} else {
name.mc._x = name.mc._x + -50;
}
name.yVel = (-gravity) - 0.001;
break;
}
}
name.yVel = name.yVel + gravity;
name.mc._y = name.mc._y + name.yVel;
} else if (!mapHit.hitTest(name.mc._x - 50, name.mc._y - gravity, true)) {
name.mc._x = name.mc._x + -5;
} else if (!mapHit.hitTest(name.mc._x + 50, name.mc._y - gravity, true)) {
name.mc._x = name.mc._x + 5;
}
if ((name.fallTime > 2) && (name.yVel != 0)) {
if (!Key.isDown(name.keyDown1)) {
if ((!Key.isDown(name.keyLeft)) && (!Key.isDown(name.keyRight))) {
if (name.windup <= 0) {
name.mc.gotoAndStop("land");
} else {
name.mc.gotoAndStop("throwLandWindup");
}
name.animHoldIdle = 12;
soundWink.attachSound("s_winkland");
soundWink.start(0, 0);
soundWink.setPan(Math.ceil(((name.mc._x - mcCam._x) / 400) * 100));
soundWink.setVolume(60);
}
} else {
name.mc.gotoAndStop("crouched");
name.trans = "walk";
name.crouched = true;
}
name.fallTime = 0;
}
with (name) {
yVel = 0;
jumping = false;
headbouncing = 0;
bounced = false;
}
}
if ((Key.isDown(name.keyJump) && (name.state == 1)) && (name.attackHold <= 0)) {
if ((Key.isDown(name.keyDown1) && (name.dJumpOK)) && (name.yVel > 0)) {
name.headbouncing = 1;
name.yVel = 14;
name.mc.gotoAndStop("headBounceDown");
} else if (!name.jumpPressed) {
if (!mapHit.hitTest(name.mc._x, (name.mc._y - name.head) - 21, true)) {
with (name) {
jumping = true;
crouched = false;
jumpPressed = true;
yVel = -16;
}
if (name.windup <= 0) {
if (name.dashHold > 0) {
name.mc.gotoAndStop("dashJump");
name.animHoldAir = 26;
} else {
name.mc.gotoAndStop("jump");
name.trans = null;
name.animHoldAir = 10;
}
} else {
name.mc.gotoAndStop("throwJumpWindup");
name.animHoldAir = 10;
}
}
} else if (((name.dJumpOK && (!name.doubleJumped)) && (name.yVel < 3)) && (!Key.isDown(name.keyDown1))) {
if (mapHit.hitTest(name.mc._x + 10.2, (name.mc._y - name.head) - 20, true) && (mapHit.hitTest(name.mc._x - 10.2, (name.mc._y - name.head) - 20, true))) {
temp = -gravity;
while (!mapHit.hitTest(name.mc._x, (name.mc._y - name.head) + temp, true)) {
name.mc._y = name.mc._y + temp;
temp = temp + (-gravity);
}
name.jumping = true;
name.mc.gotoAndStop("stick");
name.doubleJumped = true;
name.xVel = 0;
name.yVel = 0.001;
name.animHoldIdle = 9;
name.animHoldAir = 9;
name.xSpec = 2;
name.ySpec = 2;
name.state = "stuck";
name.holdName.xVel = (Math.random() * 8) - 4;
name.holdName.yVel = -4;
name.holdName.state = "thrown";
name.holdName.mc._rotation = 0;
name.holdName.grabbedName = null;
name.holdName = null;
name.grabCount = 0;
name.windup = 0;
soundWink.attachSound("s_stickON");
soundWink.start(0, 0);
soundWink.setPan(Math.ceil(((name.mc._x - mcCam._x) / 400) * 100));
}
}
name.dJumpOK = false;
} else if (name.yVel == 0) {
name.jumpPressed = false;
name.doubleJumped = false;
} else {
name.dJumpOK = true;
}
if (name.headbouncing == 2) {
with (name) {
headbouncing = 0;
if (!bounced) {
bounced = true;
yVel = -11;
} else {
yVel = -17;
}
jumping = true;
jumpPressed = true;
mc.gotoAndStop("headbounceUp");
name.animHoldAir = 17;
}
}
if (name.yVel < 0) {
if (mapHit.hitTest(name.mc._x, (name.mc._y - name.head) + name.yVel, true)) {
temp = name.yVel + gravity;
name.mc._y = name.mc._y + temp;
name.yVel = 0.001;
while (mapHit.hitTest(name.mc._x, (name.mc._y - name.head) + temp, true)) {
name.mc._y = name.mc._y + gravity;
temp = temp + gravity;
if (mapHit.hitTest(name.mc._x, name.mc._y + gravity, true)) {
if (mapHit.hitTest(name.mc._x - 50, name.mc._y, true)) {
name.mc._x = name.mc._x + 50;
} else {
name.mc._x = name.mc._x + -50;
}
}
}
if (mapHit.hitTest(name.mc._x + name.xVel, name.mc._y + 20, true)) {
name.mc._x = name.mc._x + (-name.xVel);
name.xVel = 0;
}
}
}
if (name.ySpec <= 0) {
if (name.yVel > name.yMax) {
name.yVel = name.yMax;
} else if (name.yVel < (-name.yMax)) {
name.yVel = -name.yMax;
}
}
name.mc._y = name.mc._y + name.yVel;
return;
}
if (name.state == 2) {
if (!Key.isDown(name.keyDown1)) {
if (Key.isDown(name.keyGrab)) {
if ((!name.grabPressed) && (name.holdName != null)) {
if (name.windup < xThrowMax) {
name.windup++;
}
name.mc.gotoAndStop("throwWallslideWindup");
name.mc.mcMC.gotoAndStop(name.windup);
}
} else if ((name.windup > 0) && (name.holdName != null)) {
if (Key.isDown(name.keyUp1)) {
if (Key.isDown(name.keyRight) || (Key.isDown(name.keyLeft))) {
name.holdName.xVel = name.windup + 10;
name.holdName.yVel = (-name.windup) - 10;
if (name.holdName.yVel < (-yThrowMax)) {
name.holdName.yVel = -yThrowMax;
}
name.mc.gotoAndStop("throwWallslide");
name.animHoldWallSlide = 7;
} else {
name.holdName.xVel = 0;
name.holdName.yVel = (-name.windup) - 15;
if (name.holdName.yVel < (-yThrowMax)) {
name.holdName.yVel = -yThrowMax;
}
name.mc.gotoAndStop("throwWallSlide");
name.animHoldWallSlide = 7;
}
} else if (Key.isDown(name.keyRight) || (Key.isDown(name.keyLeft))) {
if (Key.isDown(name.keyDown1)) {
name.holdName.xVel = name.windup + 10;
name.holdName.yVel = name.windup + 10;
if (name.holdName.yVel > yThrowMax) {
name.holdName.yVel = yThrowMax;
}
name.mc.gotoAndStop("throwWallSlide");
name.animHoldWallSlide = 7;
} else {
name.holdName.xVel = name.windup + 20;
name.holdName.yVel = (-name.windup) / 4;
name.mc.gotoAndStop("throwWallSlide");
name.animHoldWallSlide = 7;
}
} else {
name.holdName.xVel = name.windup + 8;
name.holdName.yVel = (-name.windup) / 4;
name.mc.gotoAndStop("throwWallSlide");
name.animHoldWallSlide = 7;
}
if (name.mc._xscale < 0) {
name.holdName.xVel = -name.holdName.xVel;
}
with (name) {
holdName.state = "thrown";
grabPressed = false;
holdName.grabbedName = null;
holdName = null;
grabCount = 0;
windup = 0;
}
} else {
name.grabPressed = false;
}
if (((Key.isDown(name.keyLeft) && (name.mc._xscale < 0)) && (!name.jumpPressed)) && (mapHit.hitTest(name.mc._x + 10, name.mc._y - name.head, true))) {
name.xVel = -name.xAcc;
} else if (((Key.isDown(name.keyRight) && (name.mc._xscale > 0)) && (!name.jumpPressed)) && (mapHit.hitTest(name.mc._x - 10, name.mc._y - name.head, true))) {
name.xVel = name.xAcc;
} else if ((mapHit.hitTest(name.mc._x - 10, name.mc._y - name.head, true) && (mapHit.hitTest(name.mc._x - 10, name.mc._y, true))) || (mapHit.hitTest(name.mc._x + 10, name.mc._y - name.head, true) && (mapHit.hitTest(name.mc._x + 10, name.mc._y - name.head, true)))) {
if (((name.grabCount <= 0) && (name.windup <= 0)) && (name.animHoldWallSlide <= 0)) {
name.mc.gotoAndStop("wallsliding");
}
name.yVel = 2;
if (Key.isDown(name.keyJump)) {
if (!name.jumpPressed) {
name.jumpPressed = true;
if (name.dJumpOK) {
name.mc.gotoAndStop("walljump");
name.jumping = true;
if (name.mc._xscale > 0) {
name.xVel = 16;
} else {
name.xVel = -16;
}
name.yVel = -18;
name.xSpec = 3;
name.doubleJumped = false;
name.animHoldAir = 14;
name.state = 1;
}
}
} else {
name.jumpPressed = false;
name.dJumpOK = true;
}
} else {
name.doubleJumped = false;
name.state = 1;
}
} else {
name.doubleJumped = false;
name.state = 1;
}
if ((name.state == 2) && (mapHit.hitTest(name.mc._x, name.mc._y + name.yVel, true))) {
name.yVel = name.yVel + (-gravity);
temp = name.yMax;
do {
if (!mapHit.hitTest(name.mc._x, name.mc._y + name.yVel, true)) {
break;
}
name.yVel = name.yVel + (-gravity);
temp = temp + (-gravity);
} while (temp >= gravity);
name.yVel = name.yVel + gravity;
with (name) {
mc._y = mc._y + yVel;
mc.gotoAndStop("idle");
fallTime = 0;
yVel = 0;
jumping = false;
state = 1;
}
}
name.mc._x = name.mc._x + name.xVel;
name.mc._y = name.mc._y + name.yVel;
} else if (name.state == "grabbing") {
if (Key.isDown(name.keyGrab)) {
if (!name.grabPressed) {
name.grabPressed = true;
if ((name.holdName != null) && (name.attackHold <= 0)) {
if (name.yVel == 0) {
if (Key.isDown(name.keyRight)) {
if (name.mc._xscale > 0) {
name.holdName.xVel = 20;
name.holdName.yVel = -15;
name.mc.gotoAndStop("throwWalk3");
do {
do {
tellTarget (7) {
stop();
stop();
// swfAction0x6C // Unknown action
name.animHoldWalk = ;
thrownName = name.holdName;
name.holdName.grabbedName = null;
name.holdName = null;
}
}
}
} else {
name.xVel = 0;
name.mc.gotoAndStop("grabbingChoke");
name.attackHold = 84;
name.trans = null;
name.holdName.mc.gotoAndStop("choke");
name.holdName.state = "choking";
name.holdName.modeCount = 54;
name.holdName.mc.swapDepths(name.holdName.mc.getDepth() + enemyDeadOffset);
soundFX.attachSound("s_choke");
soundFX.start(0, 0);
}
} else if (Key.isDown(name.keyLeft)) {
if (name.mc._xscale < 0) {
name.holdName.xVel = -20;
name.holdName.yVel = -15;
name.mc.gotoAndStop("throwWalk3");
name.animHoldWalk = 7;
name.holdName.state = "thrown";
thrownName = name.holdName;
name.holdName.grabbedName = null;
name.holdName = null;
} else {
name.xVel = 0;
name.mc.gotoAndStop("grabbingChoke");
name.attackHold = 84;
name.trans = null;
name.holdName.mc.gotoAndStop("choke");
name.holdName.state = "choking";
name.holdName.modeCount = 54;
name.holdName.mc.swapDepths(name.holdName.mc.getDepth() + enemyDeadOffset);
soundFX.attachSound("s_choke");
soundFX.start(0, 0);
}
} else {
if (name.mc._xscale < 0) {
name.holdName.xVel = -12;
} else {
name.holdName.xVel = 12;
}
name.holdName.yVel = -10;
name.mc.gotoAndStop("throwIdle3");
name.animHoldIdle = 7;
name.holdName.state = "thrown";
thrownName = name.holdName;
name.holdName.grabbedName = null;
name.holdName = null;
}
}
if (name.mc._xscale < 0) {
name.holdName.xVel = -name.holdName.xVel;
}
name.grabPressed = true;
name.grabCount = 0;
name.windup = 0;
name.state = 1;
}
}
} else {
name.grabPressed = false;
}
if (name.state == "grabbing") {
if (name.grabCount <= 0) {
if ((name.attackHold <= 0) && (name.xSpec <= 0)) {
if (Key.isDown(name.keyLeft)) {
if (mapHit.hitTest(name.mc._x, name.mc._y + (gravity * 2), true)) {
if (((name.grabCount <= 0) && (name.windup <= 0)) && (name.animHoldWalk <= 0)) {
if (name.mc._xscale < 0) {
name.mc.gotoAndStop("grabbingWalkF");
} else {
name.mc.gotoAndStop("grabbingWalkB");
}
}
temp = name.xVel - name.xAcc;
if (temp < (-name.xGrabMax)) {
temp = -name.xGrabMax;
}
if ((!mapHit.hitTest(name.mc._x + temp, name.mc._y, true)) && mapHit.hitTest(name.mc._x + temp, name.mc._y + (gravity * 8), true)) {
name.xVel = temp;
name.mc._y = name.mc._y + gravity;
temp = 0;
while ((temp < (gravity * 8)) && (!mapHit.hitTest(name.mc._x + name.xVel, name.mc._y + temp, true))) {
temp = temp + gravity;
}
name.mc._y = name.mc._y + temp;
} else if (!mapHit.hitTest(name.mc._x + temp, name.mc._y - gravity, true)) {
name.xVel = temp;
} else if (!mapHit.hitTest(name.mc._x + temp, name.mc._y - 9, true)) {
name.xVel = temp;
temp = gravity * 2;
while (mapHit.hitTest(name.mc._x + name.xVel, name.mc._y - temp, true)) {
temp = temp + gravity;
}
if (name.xVel > (-name.xAcc)) {
name.xVel = -name.xAcc;
}
name.mc._y = name.mc._y + ((-temp) + gravity);
name.yVel = 0;
} else {
if (name.xVel > 0) {
if (mapHit.hitTest(name.mc._x + name.xVel, name.mc._y - gravity, true)) {
temp = name.xVel - name.xAcc;
do {
if (!mapHit.hitTest(name.mc._x + temp, name.mc._y - gravity, true)) {
break;
}
temp = temp + (-name.xAcc);
} while (temp >= 0);
name.mc._x = name.mc._x + temp;
}
} else if (mapHit.hitTest(name.mc._x + name.xVel, name.mc._y - gravity, true)) {
temp = name.xVel + name.xAcc;
do {
if (!mapHit.hitTest(name.mc._x + temp, name.mc._y - gravity, true)) {
break;
}
temp = temp + name.xAcc;
} while (temp <= 0);
name.mc._x = name.mc._x + temp;
}
name.xVel = 0;
}
} else {
temp = name.xVel - name.xAirAcc;
if (temp < (-name.xGrabMax)) {
temp = -name.xGrabMax;
}
if (((!mapHit.hitTest(name.mc._x + temp, name.mc._y, true)) && (!mapHit.hitTest(name.mc._x + temp, name.mc._y - (name.head / 2), true))) && (!mapHit.hitTest(name.mc._x + temp, (name.mc._y - name.head) + 6, true))) {
if (name.xVel < (-name.xGrabMax)) {
if (((!mapHit.hitTest(name.mc._x + (temp / 2), name.mc._y, true)) && (!mapHit.hitTest(name.mc._x + (temp / 2), name.mc._y - (name.head / 2), true))) && (!mapHit.hitTest(name.mc._x + (temp / 2), (name.mc._y - name.head) + 6, true))) {
name.xVel = name.xVel + (-name.xAirAcc);
}
} else {
name.xVel = name.xVel + (-name.xAirAcc);
}
} else {
name.xVel = 0;
}
}
} else if (Key.isDown(name.keyRight)) {
if (mapHit.hitTest(name.mc._x, name.mc._y + (gravity * 2), true)) {
if (((name.grabCount <= 0) && (name.windup <= 0)) && (name.animHoldWalk <= 0)) {
if (name.mc._xscale < 0) {
name.mc.gotoAndStop("grabbingWalkB");
} else {
name.mc.gotoAndStop("grabbingWalkF");
}
}
temp = name.xVel + name.xAcc;
if (temp > name.xGrabMax) {
temp = name.xGrabMax;
}
if ((!mapHit.hitTest(name.mc._x + temp, name.mc._y, true)) && mapHit.hitTest(name.mc._x + temp, name.mc._y + (gravity * 8), true)) {
name.xVel = temp;
name.mc._y = name.mc._y + gravity;
temp = 0;
while ((temp < (gravity * 8)) && (!mapHit.hitTest(name.mc._x + name.xVel, name.mc._y + temp, true))) {
temp = temp + gravity;
}
name.mc._y = name.mc._y + temp;
} else if (!mapHit.hitTest(name.mc._x + temp, name.mc._y - gravity, true)) {
name.xVel = temp;
} else if (!mapHit.hitTest(name.mc._x + temp, name.mc._y - 9, true)) {
name.xVel = temp;
temp = gravity * 2;
while (mapHit.hitTest(name.mc._x + name.xVel, name.mc._y - temp, true)) {
temp = temp + gravity;
}
if (name.xVel < name.xAcc) {
name.xVel = name.xAcc;
}
name.mc._y = name.mc._y + ((-temp) + gravity);
name.yVel = 0;
} else {
if (name.xVel > 0) {
if (mapHit.hitTest(name.mc._x + name.xVel, name.mc._y - gravity, true)) {
temp = name.xVel - name.xAcc;
do {
if (!mapHit.hitTest(name.mc._x + temp, name.mc._y - gravity, true)) {
break;
}
temp = temp + (-name.xAcc);
} while (temp >= 0);
name.mc._x = name.mc._x + temp;
}
} else if (mapHit.hitTest(name.mc._x + name.xVel, name.mc._y - gravity, true)) {
temp = name.xVel + name.xAcc;
do {
if (!mapHit.hitTest(name.mc._x + temp, name.mc._y - gravity, true)) {
break;
}
temp = temp + name.xAcc;
} while (temp <= 0);
name.mc._x = name.mc._x + temp;
}
name.xVel = 0;
}
} else {
temp = name.xVel + name.xAirAcc;
if (temp > name.xGrabMax) {
temp = name.xGrabMax;
}
if (((!mapHit.hitTest(name.mc._x + temp, name.mc._y, true)) && (!mapHit.hitTest(name.mc._x + temp, name.mc._y - (name.head / 2), true))) && (!mapHit.hitTest(name.mc._x + temp, (name.mc._y - name.head) + 6, true))) {
if (name.xVel > name.xGrabMax) {
if (((!mapHit.hitTest(name.mc._x + (temp / 2), name.mc._y, true)) && (!mapHit.hitTest(name.mc._x + (temp / 2), name.mc._y - (name.head / 2), true))) && (!mapHit.hitTest(name.mc._x + (temp / 2), (name.mc._y - name.head) + 6, true))) {
name.xVel = name.xVel + name.xAirAcc;
}
} else {
name.xVel = name.xVel + name.xAirAcc;
}
} else {
name.xVel = 0;
}
}
} else if (name.xSpec <= 0) {
if (mapHit.hitTest(name.mc._x, name.mc._y + gravity, true)) {
if ((name.animHoldIdle <= 0) && (name.yVel == 0)) {
if ((name.grabCount <= 0) && (name.windup <= 0)) {
name.mc.gotoAndStop("grabbingIdle");
}
}
if (name.xVel > 0) {
name.xVel = name.xVel + ((-name.xAcc) * 2);
if (name.xVel <= 0.7) {
name.xVel = 0;
}
} else if (name.xVel < 0) {
name.xVel = name.xVel + (name.xAcc * 2);
if (name.xVel >= -0.7) {
name.xVel = 0;
}
}
}
}
}
}
if (name.xVel != 0) {
if (mapHit.hitTest(name.mc._x + name.xVel, name.mc._y - gravity, true)) {
if (name.xVel > 0) {
temp = name.xVel - name.xAcc;
do {
if (!mapHit.hitTest(name.mc._x + temp, name.mc._y - gravity, true)) {
break;
}
temp = temp + (-name.xAcc);
} while (temp >= 0);
name.mc._x = name.mc._x + temp;
} else {
temp = name.xVel + name.xAcc;
do {
if (!mapHit.hitTest(name.mc._x + temp, name.mc._y - gravity, true)) {
break;
}
temp = temp + name.xAcc;
} while (temp <= 0);
name.mc._x = name.mc._x + temp;
}
name.xVel = 0;
}
}
name.mc._x = name.mc._x + name.xVel;
if ((name.xVel != 0) && (((!Key.isDown(name.keyLeft)) && (!Key.isDown(name.keyRight))) || (name.attackHold > 0))) {
if ((!mapHit.hitTest(name.mc._x, name.mc._y, true)) && (mapHit.hitTest(name.mc._x, name.mc._y + (gravity * 8), true))) {
temp = 0;
while ((temp < (gravity * 8)) && (!mapHit.hitTest(name.mc._x, name.mc._y + temp, true))) {
temp = temp + gravity;
}
name.mc._y = name.mc._y + temp;
}
}
if (!mapHit.hitTest(name.mc._x, (name.mc._y + gravity) + name.yVel, true)) {
if (name.ySpec <= 0) {
name.yVel = name.yVel + gravity;
if (name.yVel > gravity) {
name.jumping = false;
}
}
if ((name.grabCount <= 0) && (name.animHoldAir <= 0)) {
name.mc.gotoAndStop("fall");
name.jumpPressed = true;
name.animHoldAir = 16;
}
if (name.yVel > 0) {
name.fallTime++;
}
} else {
name.yVel = name.yVel + (-gravity);
temp = name.yMax;
if (!mapHit.hitTest(name.mc._x, name.mc._y - name.head, true)) {
do {
if (!mapHit.hitTest(name.mc._x, name.mc._y + name.yVel, true)) {
break;
}
name.yVel = name.yVel + (-gravity);
temp = temp + (-gravity);
} while (temp >= gravity);
name.yVel = name.yVel + gravity;
name.mc._y = name.mc._y + name.yVel;
} else if (!mapHit.hitTest(name.mc._x - 10, name.mc._y - gravity, true)) {
temp = -name.xAcc;
while (mapHit.hitTest(name.mc._x + temp, name.mc._y - gravity, true)) {
temp = temp + (-name.xAcc);
}
name.mc._x = name.mc._x + temp;
} else if (!mapHit.hitTest(name.mc._x + 10, name.mc._y - gravity, true)) {
temp = name.xAcc;
while (mapHit.hitTest(name.mc._x + temp, name.mc._y - gravity, true)) {
temp = temp + name.xAcc;
}
name.mc._x = name.mc._x + temp;
}
if ((name.fallTime > 2) && (name.yVel != 0)) {
if ((!Key.isDown(name.keyLeft)) && (!Key.isDown(name.keyRight))) {
if (name.windup <= 0) {
name.mc.gotoAndStop("land");
} else {
name.mc.gotoAndStop("throwLandWindup");
}
name.animHoldIdle = 12;
}
name.fallTime = 0;
}
with (name) {
yVel = 0;
jumping = false;
headbouncing = 0;
bounced = false;
}
}
if (name.ySpec <= 0) {
if (name.yVel > name.yMax) {
name.yVel = name.yMax;
} else if (name.yVel < (-name.yMax)) {
name.yVel = -name.yMax;
}
}
name.mc._y = name.mc._y + name.yVel;
}
} else if (name.state == "stuck") {
if (Key.isDown(name.keyJump)) {
if (!name.jumpPressed) {
name.jumpPressed = true;
if (!mapHit.hitTest(name.mc._x, name.mc._y + 10, true)) {
name.mc.gotoAndStop("stuckDrop");
name.animHoldAir = 4;
name.state = 1;
soundWink.attachSound("s_stickOFF");
soundWink.start(0, 0);
soundWink.setPan(Math.ceil(((name.mc._x - mcCam._x) / 400) * 100));
}
}
} else {
name.jumpPressed = false;
}
temp = gravity;
while (mapHit.hitTest(name.mc._x, (name.mc._y - 40) + temp, true)) {
name.mc._y = name.mc._y + gravity;
temp = temp + gravity;
}
if (mapHit.hitTest(name.mc._x, name.mc._y - 6, true)) {
name.mc.gotoAndStop("thrown");
name.state = "thrown";
if (name.mc._xscale > 0) {
name.xVel = 10;
} else {
name.xVel = -10;
}
}
if (name.state == "stuck") {
soundWink.setVolume(90);
if (Key.isDown(name.keyLeft)) {
if (((name.grabCount <= 0) && (name.windup <= 0)) && (name.animHoldWalk <= 0)) {
}
temp = name.xVel - name.xAcc;
if (temp < (-name.xStuckMax)) {
temp = -name.xStuckMax;
}
if ((!mapHit.hitTest((name.mc._x - 10) + temp, (name.mc._y - name.head) + 10, true)) && (mapHit.hitTest((name.mc._x - 10) + temp, (name.mc._y - name.head) - 10, true))) {
name.xVel = temp;
if (name.mc._xscale < 0) {
name.mc.gotoAndStop("stuckWalkF");
} else {
name.mc.gotoAndStop("stuckWalkB");
}
name.trans = "walk";
} else {
name.xVel = 0;
if (name.trans == "walk") {
name.trans = null;
name.mc.gotoAndStop("stuck1");
name.animHoldIdle = 4;
} else {
name.mc.gotoAndStop("stuck");
}
}
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(((name.mc._x - mcCam._x) / 400) * 100));
} else if (Key.isDown(name.keyRight)) {
if (((name.grabCount <= 0) && (name.windup <= 0)) && (name.animHoldWalk <= 0)) {
}
temp = name.xVel + name.xAcc;
if (temp > name.xStuckMax) {
temp = name.xStuckMax;
}
if ((!mapHit.hitTest((name.mc._x + 10) + temp, (name.mc._y - name.head) + 10, true)) && (mapHit.hitTest((name.mc._x + 10) + temp, (name.mc._y - name.head) - 10, true))) {
name.xVel = temp;
if (name.mc._xscale > 0) {
name.mc.gotoAndStop("stuckWalkF");
} else {
name.mc.gotoAndStop("stuckWalkB");
}
name.trans = "walk";
} else {
name.xVel = 0;
if (name.trans == "walk") {
name.trans = null;
name.mc.gotoAndStop("stuck1");
name.animHoldIdle = 4;
} else {
name.mc.gotoAndStop("stuck");
}
}
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(((name.mc._x - mcCam._x) / 400) * 100));
} else {
if (name.animHoldIdle <= 0) {
if (name.trans != null) {
name.trans = null;
name.mc.gotoAndStop("stuck1");
name.animHoldIdle = 4;
} else {
name.mc.gotoAndStop("stuck");
}
}
if (name.xVel > 0) {
name.xVel = name.xVel + ((-name.xAcc) * 2);
if (name.xVel <= 0.7) {
name.xVel = 0;
soundWink.stop();
soundWinkDone = true;
}
} else if (name.xVel < 0) {
name.xVel = name.xVel + (name.xAcc * 2);
if (name.xVel >= -0.7) {
name.xVel = 0;
soundWink.stop();
soundWinkDone = true;
}
}
}
name.mc._x = name.mc._x + name.xVel;
if (!mapHit.hitTest((name.mc._x + 10) + temp, (name.mc._y - name.head) + 15, true)) {
name.mc._y = name.mc._y + (-gravity);
}
}
} else if (name.state == "thrown") {
if (name.xVel > 0) {
if (name.yVel != 0) {
name.xVel = name.xVel / frictionAir;
} else {
name.xVel = name.xVel / friction;
}
if (name.xVel <= 0.3) {
name.xVel = 0;
}
} else if (name.xVel < 0) {
if (name.yVel != 0) {
name.xVel = name.xVel / frictionAir;
} else {
name.xVel = name.xVel / friction;
}
if (name.xVel >= -0.3) {
name.xVel = 0;
}
}
if (name.xVel != 0) {
if (mapHit.hitTest(name.mc._x + name.xVel, name.mc._y - (gravity * 2), true)) {
if (name.xVel > 0) {
temp = name.xVel - name.xAcc;
enemyBounceRight(name, temp);
} else {
temp = name.xVel + name.xAcc;
enemyBounceLeft(name, temp);
}
if (Math.abs(name.xVel) <= 0.3) {
name.xVel = 0;
}
} else if (name.xVel > name.xMax) {
if (mapHit.hitTest(name.mc._x + (name.xVel / 2), name.mc._y - (gravity * 2), true)) {
temp = (name.xVel / 2) - name.xAcc;
enemyBounceRight(name, temp);
} else if (mapHit.hitTest(name.mc._x, name.mc._y - (gravity * 2), true)) {
temp = -name.xAcc;
enemyBounceRight(name, temp);
}
} else if (name.xVel < (-name.xMax)) {
if (mapHit.hitTest(name.mc._x + (name.xVel / 2), name.mc._y - (gravity * 2), true)) {
temp = (name.xVel / 2) + name.xAcc;
enemyBounceLeft(name, temp);
} else if (mapHit.hitTest(name.mc._x, name.mc._y - (gravity * 2), true)) {
temp = name.xAcc;
enemyBounceLeft(name, temp);
}
}
}
name.mc._x = name.mc._x + name.xVel;
if (name.xVel != 0) {
if ((!mapHit.hitTest(name.mc._x, name.mc._y, true)) && (mapHit.hitTest(name.mc._x, name.mc._y + (gravity * 8), true))) {
temp = 0;
while ((temp < (gravity * 8)) && (!mapHit.hitTest(name.mc._x, name.mc._y + temp, true))) {
temp = temp + gravity;
}
name.mc._y = name.mc._y + temp;
}
}
if (name.yVel > name.yMax) {
name.yVel = name.yMax;
}
if (!mapHit.hitTest(name.mc._x, (name.mc._y + gravity) + name.yVel, true)) {
if ((Math.abs(name.xVel) > 20) || (Math.abs(name.yVel) > 12)) {
name.mc.gotoAndStop("thrownBlur");
} else {
name.mc.gotoAndStop("thrown");
}
if (name.yVel > 20) {
if (!mapHit.hitTest(name.mc._x, (name.mc._y + gravity) + (name.yVel / 2), true)) {
name.yVel = name.yVel + gravity;
if (name.yVel > gravity) {
name.jumping = false;
}
if (!name.jumping) {
}
} else {
actorHitGround(name);
name._y = name._y + (-gravity);
}
} else {
name.yVel = name.yVel + gravity;
if (name.yVel > gravity) {
name.jumping = false;
}
if (!name.jumping) {
}
}
} else {
actorHitGround(name);
name.mc.gotoAndStop("bouncing");
if (name.xVel == 0) {
if (!mapHit.hitTest(name.mc._x - 10, name.mc._y + 3, true)) {
name.xVel = name.yVel * 2;
} else if (!mapHit.hitTest(name.mc._x - 20, name.mc._y + 3, true)) {
name.xVel = name.yVel;
} else if (!mapHit.hitTest(name.mc._x - 40, name.mc._y + 3, true)) {
name.xVel = name.yVel / 2;
} else if (!mapHit.hitTest(name.mc._x + 10, name.mc._y + 3, true)) {
name.xVel = (-name.yVel) * 2;
} else if (!mapHit.hitTest(name.mc._x + 20, name.mc._y + 3, true)) {
name.xVel = -name.yVel;
} else if (!mapHit.hitTest(name.mc._x + 40, name.mc._y + 3, true)) {
name.xVel = (-name.yVel) / 2;
}
if (soundWinkDone) {
soundWink.attachSound("s_winkhit2");
soundWink.start(0, 0);
soundWink.setPan(Math.ceil(((name.mc._x - mcCam._x) / 400) * 100));
soundWinkDone = false;
}
}
}
if (name.yVel < 0) {
if (mapHit.hitTest(name.mc._x, (name.mc._y - name.head) + name.yVel, true)) {
temp = name.yVel + gravity;
name.mc._y = name.mc._y + temp;
name.yVel = 0.001;
while (mapHit.hitTest(name.mc._x, (name.mc._y - name.head) + temp, true)) {
name.mc._y = name.mc._y + gravity;
temp = temp + gravity;
}
}
}
name.mc._y = name.mc._y + name.yVel;
if ((name.xVel == 0) && (name.yVel == 0)) {
if (thrownName == name) {
thrownName = null;
}
name.state = "down";
} else {
name.downCount = 5;
}
} else if (name.state == "down") {
name.downTime--;
name.gotoAndStop("down");
if (name.downTime <= 0) {
name.state = 1;
name.trans = null;
name.mc.gotoAndStop("getup");
name.animHoldIdle = 11;
name.attackHold = 10;
}
}
}
// swfAction0x6C // Unknown action
;
thrownName = name.holdName;
name.holdName.grabbedName = null;
name.holdName = null;
// unexpected jump
name.xVel = 0;
name.mc.gotoAndStop("grabbingChoke");
name.attackHold = 84;
name.trans = null;
name.holdName.mc.gotoAndStop("choke");
name.holdName.state = "choking";
name.holdName.modeCount = 54;
name.holdName.mc.swapDepths(name.holdName.mc.getDepth() + enemyDeadOffset);
soundFX.attachSound("s_choke");
soundFX.start(0, 0);
// unexpected jump
if (Key.isDown(name.keyLeft)) {
if (name.mc._xscale < 0) {
name.holdName.xVel = -20;
name.holdName.yVel = -15;
name.mc.gotoAndStop("throwWalk3");
name.animHoldWalk = 7;
name.holdName.state = "thrown";
thrownName = name.holdName;
name.holdName.grabbedName = null;
name.holdName = null;
} else {
name.xVel = 0;
name.mc.gotoAndStop("grabbingChoke");
name.attackHold = 84;
name.trans = null;
name.holdName.mc.gotoAndStop("choke");
name.holdName.state = "choking";
name.holdName.modeCount = 54;
name.holdName.mc.swapDepths(name.holdName.mc.getDepth() + enemyDeadOffset);
soundFX.attachSound("s_choke");
soundFX.start(0, 0);
}
} else {
if (name.mc._xscale < 0) {
name.holdName.xVel = -12;
} else {
name.holdName.xVel = 12;
}
name.holdName.yVel = -10;
name.mc.gotoAndStop("throwIdle3");
name.animHoldIdle = 7;
name.holdName.state = "thrown";
thrownName = name.holdName;
name.holdName.grabbedName = null;
name.holdName = null;
}
if (name.mc._xscale < 0) {
name.holdName.xVel = -name.holdName.xVel;
}
name.grabPressed = true;
name.grabCount = 0;
name.windup = 0;
name.state = 1;
// unexpected jump
name.grabPressed = false;
if (name.state == "grabbing") {
if (name.grabCount <= 0) {
if ((name.attackHold <= 0) && (name.xSpec <= 0)) {
if (Key.isDown(name.keyLeft)) {
if (mapHit.hitTest(name.mc._x, name.mc._y + (gravity * 2), true)) {
if (((name.grabCount <= 0) && (name.windup <= 0)) && (name.animHoldWalk <= 0)) {
if (name.mc._xscale < 0) {
name.mc.gotoAndStop("grabbingWalkF");
} else {
name.mc.gotoAndStop("grabbingWalkB");
}
}
temp = name.xVel - name.xAcc;
if (temp < (-name.xGrabMax)) {
temp = -name.xGrabMax;
}
if ((!mapHit.hitTest(name.mc._x + temp, name.mc._y, true)) && (mapHit.hitTest(name.mc._x + temp, name.mc._y + (gravity * 8), true))) {
name.xVel = temp;
name.mc._y = name.mc._y + gravity;
temp = 0;
while ((temp < (gravity * 8)) && (!mapHit.hitTest(name.mc._x + name.xVel, name.mc._y + temp, true))) {
temp = temp + gravity;
}
name.mc._y = name.mc._y + temp;
} else if (!mapHit.hitTest(name.mc._x + temp, name.mc._y - gravity, true)) {
name.xVel = temp;
} else if (!mapHit.hitTest(name.mc._x + temp, name.mc._y - 9, true)) {
name.xVel = temp;
temp = gravity * 2;
while (mapHit.hitTest(name.mc._x + name.xVel, name.mc._y - temp, true)) {
temp = temp + gravity;
}
if (name.xVel > (-name.xAcc)) {
name.xVel = -name.xAcc;
}
name.mc._y = name.mc._y + ((-temp) + gravity);
name.yVel = 0;
} else {
if (name.xVel > 0) {
if (mapHit.hitTest(name.mc._x + name.xVel, name.mc._y - gravity, true)) {
temp = name.xVel - name.xAcc;
do {
if (!mapHit.hitTest(name.mc._x + temp, name.mc._y - gravity, true)) {
break;
}
temp = temp + (-name.xAcc);
} while (temp >= 0);
name.mc._x = name.mc._x + temp;
}
} else if (mapHit.hitTest(name.mc._x + name.xVel, name.mc._y - gravity, true)) {
temp = name.xVel + name.xAcc;
do {
if (!mapHit.hitTest(name.mc._x + temp, name.mc._y - gravity, true)) {
break;
}
temp = temp + name.xAcc;
} while (temp <= 0);
name.mc._x = name.mc._x + temp;
}
name.xVel = 0;
}
} else {
temp = name.xVel - name.xAirAcc;
if (temp < (-name.xGrabMax)) {
temp = -name.xGrabMax;
}
if (((!mapHit.hitTest(name.mc._x + temp, name.mc._y, true)) && (!mapHit.hitTest(name.mc._x + temp, name.mc._y - (name.head / 2), true))) && (!mapHit.hitTest(name.mc._x + temp, (name.mc._y - name.head) + 6, true))) {
if (name.xVel < (-name.xGrabMax)) {
if (((!mapHit.hitTest(name.mc._x + (temp / 2), name.mc._y, true)) && (!mapHit.hitTest(name.mc._x + (temp / 2), name.mc._y - (name.head / 2), true))) && (!mapHit.hitTest(name.mc._x + (temp / 2), (name.mc._y - name.head) + 6, true))) {
name.xVel = name.xVel + (-name.xAirAcc);
}
} else {
name.xVel = name.xVel + (-name.xAirAcc);
}
} else {
name.xVel = 0;
}
}
} else if (Key.isDown(name.keyRight)) {
if (mapHit.hitTest(name.mc._x, name.mc._y + (gravity * 2), true)) {
if (((name.grabCount <= 0) && (name.windup <= 0)) && (name.animHoldWalk <= 0)) {
if (name.mc._xscale < 0) {
name.mc.gotoAndStop("grabbingWalkB");
} else {
name.mc.gotoAndStop("grabbingWalkF");
}
}
temp = name.xVel + name.xAcc;
if (temp > name.xGrabMax) {
temp = name.xGrabMax;
}
if ((!mapHit.hitTest(name.mc._x + temp, name.mc._y, true)) && (mapHit.hitTest(name.mc._x + temp, name.mc._y + (gravity * 8), true))) {
name.xVel = temp;
name.mc._y = name.mc._y + gravity;
temp = 0;
while ((temp < (gravity * 8)) && (!mapHit.hitTest(name.mc._x + name.xVel, name.mc._y + temp, true))) {
temp = temp + gravity;
}
name.mc._y = name.mc._y + temp;
} else if (!mapHit.hitTest(name.mc._x + temp, name.mc._y - gravity, true)) {
name.xVel = temp;
} else if (!mapHit.hitTest(name.mc._x + temp, name.mc._y - 9, true)) {
name.xVel = temp;
temp = gravity * 2;
while (mapHit.hitTest(name.mc._x + name.xVel, name.mc._y - temp, true)) {
temp = temp + gravity;
}
if (name.xVel < name.xAcc) {
name.xVel = name.xAcc;
}
name.mc._y = name.mc._y + ((-temp) + gravity);
name.yVel = 0;
} else {
if (name.xVel > 0) {
if (mapHit.hitTest(name.mc._x + name.xVel, name.mc._y - gravity, true)) {
temp = name.xVel - name.xAcc;
do {
if (!mapHit.hitTest(name.mc._x + temp, name.mc._y - gravity, true)) {
break;
}
temp = temp + (-name.xAcc);
} while (temp >= 0);
name.mc._x = name.mc._x + temp;
}
} else if (mapHit.hitTest(name.mc._x + name.xVel, name.mc._y - gravity, true)) {
temp = name.xVel + name.xAcc;
do {
if (!mapHit.hitTest(name.mc._x + temp, name.mc._y - gravity, true)) {
break;
}
temp = temp + name.xAcc;
} while (temp <= 0);
name.mc._x = name.mc._x + temp;
}
name.xVel = 0;
}
} else {
temp = name.xVel + name.xAirAcc;
if (temp > name.xGrabMax) {
temp = name.xGrabMax;
}
if (((!mapHit.hitTest(name.mc._x + temp, name.mc._y, true)) && (!mapHit.hitTest(name.mc._x + temp, name.mc._y - (name.head / 2), true))) && (!mapHit.hitTest(name.mc._x + temp, (name.mc._y - name.head) + 6, true))) {
if (name.xVel > name.xGrabMax) {
if (((!mapHit.hitTest(name.mc._x + (temp / 2), name.mc._y, true)) && (!mapHit.hitTest(name.mc._x + (temp / 2), name.mc._y - (name.head / 2), true))) && (!mapHit.hitTest(name.mc._x + (temp / 2), (name.mc._y - name.head) + 6, true))) {
name.xVel = name.xVel + name.xAirAcc;
}
} else {
name.xVel = name.xVel + name.xAirAcc;
}
} else {
name.xVel = 0;
}
}
} else if (name.xSpec <= 0) {
if (mapHit.hitTest(name.mc._x, name.mc._y + gravity, true)) {
if ((name.animHoldIdle <= 0) && (name.yVel == 0)) {
if ((name.grabCount <= 0) && (name.windup <= 0)) {
name.mc.gotoAndStop("grabbingIdle");
}
}
if (name.xVel > 0) {
name.xVel = name.xVel + ((-name.xAcc) * 2);
if (name.xVel <= 0.7) {
name.xVel = 0;
}
} else if (name.xVel < 0) {
name.xVel = name.xVel + (name.xAcc * 2);
if (name.xVel >= -0.7) {
name.xVel = 0;
}
}
}
}
}
}
if (name.xVel != 0) {
if (mapHit.hitTest(name.mc._x + name.xVel, name.mc._y - gravity, true)) {
if (name.xVel > 0) {
temp = name.xVel - name.xAcc;
do {
if (!mapHit.hitTest(name.mc._x + temp, name.mc._y - gravity, true)) {
break;
}
temp = temp + (-name.xAcc);
} while (temp >= 0);
name.mc._x = name.mc._x + temp;
} else {
temp = name.xVel + name.xAcc;
do {
if (!mapHit.hitTest(name.mc._x + temp, name.mc._y - gravity, true)) {
break;
}
temp = temp + name.xAcc;
} while (temp <= 0);
name.mc._x = name.mc._x + temp;
}
name.xVel = 0;
}
}
name.mc._x = name.mc._x + name.xVel;
if ((name.xVel != 0) && (((!Key.isDown(name.keyLeft)) && (!Key.isDown(name.keyRight))) || (name.attackHold > 0))) {
if ((!mapHit.hitTest(name.mc._x, name.mc._y, true)) && (mapHit.hitTest(name.mc._x, name.mc._y + (gravity * 8), true))) {
temp = 0;
while ((temp < (gravity * 8)) && (!mapHit.hitTest(name.mc._x, name.mc._y + temp, true))) {
temp = temp + gravity;
}
name.mc._y = name.mc._y + temp;
}
}
if (!mapHit.hitTest(name.mc._x, (name.mc._y + gravity) + name.yVel, true)) {
if (name.ySpec <= 0) {
name.yVel = name.yVel + gravity;
if (name.yVel > gravity) {
name.jumping = false;
}
}
if ((name.grabCount <= 0) && (name.animHoldAir <= 0)) {
name.mc.gotoAndStop("fall");
name.jumpPressed = true;
name.animHoldAir = 16;
}
if (name.yVel > 0) {
name.fallTime++;
}
} else {
name.yVel = name.yVel + (-gravity);
temp = name.yMax;
if (!mapHit.hitTest(name.mc._x, name.mc._y - name.head, true)) {
do {
if (!mapHit.hitTest(name.mc._x, name.mc._y + name.yVel, true)) {
break;
}
name.yVel = name.yVel + (-gravity);
temp = temp + (-gravity);
} while (temp >= gravity);
name.yVel = name.yVel + gravity;
name.mc._y = name.mc._y + name.yVel;
} else if (!mapHit.hitTest(name.mc._x - 10, name.mc._y - gravity, true)) {
temp = -name.xAcc;
while (mapHit.hitTest(name.mc._x + temp, name.mc._y - gravity, true)) {
temp = temp + (-name.xAcc);
}
name.mc._x = name.mc._x + temp;
} else if (!mapHit.hitTest(name.mc._x + 10, name.mc._y - gravity, true)) {
temp = name.xAcc;
while (mapHit.hitTest(name.mc._x + temp, name.mc._y - gravity, true)) {
temp = temp + name.xAcc;
}
name.mc._x = name.mc._x + temp;
}
if ((name.fallTime > 2) && (name.yVel != 0)) {
if ((!Key.isDown(name.keyLeft)) && (!Key.isDown(name.keyRight))) {
if (name.windup <= 0) {
name.mc.gotoAndStop("land");
} else {
name.mc.gotoAndStop("throwLandWindup");
}
name.animHoldIdle = 12;
}
name.fallTime = 0;
}
with (name) {
yVel = 0;
jumping = false;
headbouncing = 0;
bounced = false;
}
}
if (name.ySpec <= 0) {
if (name.yVel > name.yMax) {
name.yVel = name.yMax;
} else if (name.yVel < (-name.yMax)) {
name.yVel = -name.yMax;
}
}
name.mc._y = name.mc._y + name.yVel;
}
return;
if (name.state == "stuck") {
if (Key.isDown(name.keyJump)) {
if (!name.jumpPressed) {
name.jumpPressed = true;
if (!mapHit.hitTest(name.mc._x, name.mc._y + 10, true)) {
name.mc.gotoAndStop("stuckDrop");
name.animHoldAir = 4;
name.state = 1;
soundWink.attachSound("s_stickOFF");
soundWink.start(0, 0);
soundWink.setPan(Math.ceil(((name.mc._x - mcCam._x) / 400) * 100));
}
}
} else {
name.jumpPressed = false;
}
temp = gravity;
while (mapHit.hitTest(name.mc._x, (name.mc._y - 40) + temp, true)) {
name.mc._y = name.mc._y + gravity;
temp = temp + gravity;
}
if (mapHit.hitTest(name.mc._x, name.mc._y - 6, true)) {
name.mc.gotoAndStop("thrown");
name.state = "thrown";
if (name.mc._xscale > 0) {
name.xVel = 10;
} else {
name.xVel = -10;
}
}
if (name.state == "stuck") {
soundWink.setVolume(90);
if (Key.isDown(name.keyLeft)) {
if (((name.grabCount <= 0) && (name.windup <= 0)) && (name.animHoldWalk <= 0)) {
}
temp = name.xVel - name.xAcc;
if (temp < (-name.xStuckMax)) {
temp = -name.xStuckMax;
}
if ((!mapHit.hitTest((name.mc._x - 10) + temp, (name.mc._y - name.head) + 10, true)) && (mapHit.hitTest((name.mc._x - 10) + temp, (name.mc._y - name.head) - 10, true))) {
name.xVel = temp;
if (name.mc._xscale < 0) {
name.mc.gotoAndStop("stuckWalkF");
} else {
name.mc.gotoAndStop("stuckWalkB");
}
name.trans = "walk";
} else {
name.xVel = 0;
if (name.trans == "walk") {
name.trans = null;
name.mc.gotoAndStop("stuck1");
name.animHoldIdle = 4;
} else {
name.mc.gotoAndStop("stuck");
}
}
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(((name.mc._x - mcCam._x) / 400) * 100));
} else if (Key.isDown(name.keyRight)) {
if (((name.grabCount <= 0) && (name.windup <= 0)) && (name.animHoldWalk <= 0)) {
}
temp = name.xVel + name.xAcc;
if (temp > name.xStuckMax) {
temp = name.xStuckMax;
}
if ((!mapHit.hitTest((name.mc._x + 10) + temp, (name.mc._y - name.head) + 10, true)) && (mapHit.hitTest((name.mc._x + 10) + temp, (name.mc._y - name.head) - 10, true))) {
name.xVel = temp;
if (name.mc._xscale > 0) {
name.mc.gotoAndStop("stuckWalkF");
} else {
name.mc.gotoAndStop("stuckWalkB");
}
name.trans = "walk";
} else {
name.xVel = 0;
if (name.trans == "walk") {
name.trans = null;
name.mc.gotoAndStop("stuck1");
name.animHoldIdle = 4;
} else {
name.mc.gotoAndStop("stuck");
}
}
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(((name.mc._x - mcCam._x) / 400) * 100));
} else {
if (name.animHoldIdle <= 0) {
if (name.trans != null) {
name.trans = null;
name.mc.gotoAndStop("stuck1");
name.animHoldIdle = 4;
} else {
name.mc.gotoAndStop("stuck");
}
}
if (name.xVel > 0) {
name.xVel = name.xVel + ((-name.xAcc) * 2);
if (name.xVel <= 0.7) {
name.xVel = 0;
soundWink.stop();
soundWinkDone = true;
}
} else if (name.xVel < 0) {
name.xVel = name.xVel + (name.xAcc * 2);
if (name.xVel >= -0.7) {
name.xVel = 0;
soundWink.stop();
soundWinkDone = true;
}
}
}
name.mc._x = name.mc._x + name.xVel;
if (!mapHit.hitTest((name.mc._x + 10) + temp, (name.mc._y - name.head) + 15, true)) {
name.mc._y = name.mc._y + (-gravity);
}
}
} else if (name.state == "thrown") {
if (name.xVel > 0) {
if (name.yVel != 0) {
name.xVel = name.xVel / frictionAir;
} else {
name.xVel = name.xVel / friction;
}
if (name.xVel <= 0.3) {
name.xVel = 0;
}
} else if (name.xVel < 0) {
if (name.yVel != 0) {
name.xVel = name.xVel / frictionAir;
} else {
name.xVel = name.xVel / friction;
}
if (name.xVel >= -0.3) {
name.xVel = 0;
}
}
if (name.xVel != 0) {
if (mapHit.hitTest(name.mc._x + name.xVel, name.mc._y - (gravity * 2), true)) {
if (name.xVel > 0) {
temp = name.xVel - name.xAcc;
enemyBounceRight(name, temp);
} else {
temp = name.xVel + name.xAcc;
enemyBounceLeft(name, temp);
}
if (Math.abs(name.xVel) <= 0.3) {
name.xVel = 0;
}
} else if (name.xVel > name.xMax) {
if (mapHit.hitTest(name.mc._x + (name.xVel / 2), name.mc._y - (gravity * 2), true)) {
temp = (name.xVel / 2) - name.xAcc;
enemyBounceRight(name, temp);
} else if (mapHit.hitTest(name.mc._x, name.mc._y - (gravity * 2), true)) {
temp = -name.xAcc;
enemyBounceRight(name, temp);
}
} else if (name.xVel < (-name.xMax)) {
if (mapHit.hitTest(name.mc._x + (name.xVel / 2), name.mc._y - (gravity * 2), true)) {
temp = (name.xVel / 2) + name.xAcc;
enemyBounceLeft(name, temp);
} else if (mapHit.hitTest(name.mc._x, name.mc._y - (gravity * 2), true)) {
temp = name.xAcc;
enemyBounceLeft(name, temp);
}
}
}
name.mc._x = name.mc._x + name.xVel;
if (name.xVel != 0) {
if ((!mapHit.hitTest(name.mc._x, name.mc._y, true)) && (mapHit.hitTest(name.mc._x, name.mc._y + (gravity * 8), true))) {
temp = 0;
while ((temp < (gravity * 8)) && (!mapHit.hitTest(name.mc._x, name.mc._y + temp, true))) {
temp = temp + gravity;
}
name.mc._y = name.mc._y + temp;
}
}
if (name.yVel > name.yMax) {
name.yVel = name.yMax;
}
if (!mapHit.hitTest(name.mc._x, (name.mc._y + gravity) + name.yVel, true)) {
if ((Math.abs(name.xVel) > 20) || (Math.abs(name.yVel) > 12)) {
name.mc.gotoAndStop("thrownBlur");
} else {
name.mc.gotoAndStop("thrown");
}
if (name.yVel > 20) {
if (!mapHit.hitTest(name.mc._x, (name.mc._y + gravity) + (name.yVel / 2), true)) {
name.yVel = name.yVel + gravity;
if (name.yVel > gravity) {
name.jumping = false;
}
if (!name.jumping) {
}
} else {
actorHitGround(name);
name._y = name._y + (-gravity);
}
} else {
name.yVel = name.yVel + gravity;
if (name.yVel > gravity) {
name.jumping = false;
}
if (!name.jumping) {
}
}
} else {
actorHitGround(name);
name.mc.gotoAndStop("bouncing");
if (name.xVel == 0) {
if (!mapHit.hitTest(name.mc._x - 10, name.mc._y + 3, true)) {
name.xVel = name.yVel * 2;
} else if (!mapHit.hitTest(name.mc._x - 20, name.mc._y + 3, true)) {
name.xVel = name.yVel;
} else if (!mapHit.hitTest(name.mc._x - 40, name.mc._y + 3, true)) {
name.xVel = name.yVel / 2;
} else if (!mapHit.hitTest(name.mc._x + 10, name.mc._y + 3, true)) {
name.xVel = (-name.yVel) * 2;
} else if (!mapHit.hitTest(name.mc._x + 20, name.mc._y + 3, true)) {
name.xVel = -name.yVel;
} else if (!mapHit.hitTest(name.mc._x + 40, name.mc._y + 3, true)) {
name.xVel = (-name.yVel) / 2;
}
if (soundWinkDone) {
soundWink.attachSound("s_winkhit2");
soundWink.start(0, 0);
soundWink.setPan(Math.ceil(((name.mc._x - mcCam._x) / 400) * 100));
soundWinkDone = false;
}
}
}
if (name.yVel < 0) {
if (mapHit.hitTest(name.mc._x, (name.mc._y - name.head) + name.yVel, true)) {
temp = name.yVel + gravity;
name.mc._y = name.mc._y + temp;
name.yVel = 0.001;
while (mapHit.hitTest(name.mc._x, (name.mc._y - name.head) + temp, true)) {
name.mc._y = name.mc._y + gravity;
temp = temp + gravity;
}
}
}
name.mc._y = name.mc._y + name.yVel;
if ((name.xVel == 0) && (name.yVel == 0)) {
if (thrownName == name) {
thrownName = null;
}
name.state = "down";
} else {
name.downCount = 5;
}
} else if (name.state == "down") {
name.downTime--;
name.gotoAndStop("down");
if (name.downTime <= 0) {
name.state = 1;
name.trans = null;
name.mc.gotoAndStop("getup");
name.animHoldIdle = 11;
name.attackHold = 10;
}
}
}
function playerUpHill() {
if (name.xVel > 0) {
temp = gravity;
while (mapHit.hitTest(name.mc._x + name.xVel, name.mc._y - temp, true)) {
temp = temp + gravity;
}
if (name.xVel < name.xAcc) {
name.xVel = name.xAcc;
}
name.mc._y = name.mc._y + ((-temp) + gravity);
name.yVel = 0;
} else {
temp = gravity;
while (mapHit.hitTest(name.mc._x + name.xVel, name.mc._y - temp, true)) {
temp = temp + gravity;
}
if (name.xVel > (-name.xAcc)) {
name.xVel = -name.xAcc;
}
name.mc._y = name.mc._y + ((-temp) + gravity);
name.yVel = 0;
}
}
function actorHitGround(name) {
var _local1 = name;
_local1.yVel = _local1.yVel + (-gravity);
temp = _local1.yMax;
do {
if (!mapHit.hitTest(_local1.mc._x, (_local1.mc._y + gravity) + _local1.yVel, true)) {
break;
}
_local1.yVel = _local1.yVel + (-gravity);
temp = temp + (-gravity);
} while (temp >= 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(name) {
var _local1 = name;
_local1.yVel = _local1.yVel + (-gravity);
temp = _local1.yMax;
do {
if (!mapHit.hitTest(_local1.mc._x, (_local1.mc._y + gravity) + _local1.yVel, true)) {
break;
}
_local1.yVel = _local1.yVel + (-gravity);
temp = temp + (-gravity);
} while (temp >= 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(name, temp) {
var _local1 = name;
var _local2 = temp;
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(name, temp) {
var _local1 = name;
var _local2 = temp;
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(enemyName) {
name = this[enemyName];
if (name.state == "inactive") {
name.modeCount--;
if ((Math.abs(name.mc._x - p1.mc._x) <= xCutoff) && (Math.abs(name.mc._y - p1.mc._y) <= yCutoff)) {
name.state = 1;
name.mc._visible = true;
}
// unexpected jump
}
} while (name.state == "dead");
name.animHoldIdle--;
name.animHoldWalk--;
name.modeCount--;
name.grabCount--;
if ((name.state == 1) || (name.state == "thrown")) {
if ((((p1.holdName == null) && (p1.grabCount > 0)) && (p1.yVel == 0)) && (p1.mc.mcMC.mcGrab._x != undefined)) {
if ((((name.mc._xscale > 0) && (p1.mc._xscale > 0)) && (p1.mc._x < name.mc._x)) || (((name.mc._xscale < 0) && (p1.mc._xscale < 0)) && (p1.mc._x > name.mc._x))) {
if (p1.mc._xscale > 0) {
temp = p1.mc.mcMC.mcGrab._x;
} else {
temp = -p1.mc.mcMC.mcGrab._x;
}
if (name.mc.mcHit.hitTest(p1.mc._x + temp, p1.mc._y + p1.mc.mcMC.mcGrab._y, true)) {
name.state = "grabbed";
name.xVel = 0;
name.mc.gotoAndStop("grabbed0");
name.animHoldIdle = 10;
name.grabbedName = p1;
p1.holdName = name;
p1.windup = 0;
p1.mc.gotoAndStop("grabIdleFinish");
p1.animHoldIdle = 10;
p1.state = "grabbing";
if (name.holdName != null) {
name.holdName.state = "thrown";
name.holdName.mc._rotation = 0;
if (name.mc._xscale > 0) {
name.holdName.xVel = 6;
} else {
name.holdName.xVel = -6;
}
name.holdName.yVel = -8;
name.holdName.grabbedName = null;
name.holdName = null;
name.grabCount = 0;
}
soundFX.attachSound("s_grabbed");
soundFX.start(0, 0);
}
}
}
}
if (((((p1.whacking == 1) && (name.state != "clothes")) && (name.state != "down")) && (name.state != "getup")) && (name.state != "whacked")) {
if ((Math.abs(name.mc._x - p1.mc._x) < 45) && (Math.abs(name.mc._y - p1.mc._y) < 50)) {
p1.whacking = 2;
}
}
if ((((p1.attackHold > 0) && (name.state != "grabbed")) && (name.state != "clothes")) && (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 (name.mc.mcHit.hitTest(p1.mc._x + temp, p1.mc._y + p1.mc.mcMC.mcAttack._y, true)) {
if (p1.whacking == 3) {
name.state = "whacked";
name.mc.gotoAndStop("whacked");
name.mc.swapDepths(topDepth);
name.modeCount = 34;
if (name.holdName != null) {
name.holdName.state = "thrown";
name.holdName.mc._rotation = 0;
if (name.mc._xscale > 0) {
name.holdName.xVel = (Math.random() * 4) + 4;
} else {
name.holdName.xVel = (Math.random() * -4) - 4;
}
name.holdName.yVel = (Math.random() * -6) - 8;
name.holdName.grabbedName = null;
name.holdName = null;
name.grabCount = 0;
}
soundFX.attachSound("s_whacked");
soundFX.start(0, 0);
} else if (p1.finalHit) {
if (p1.mc._x <= name.mc._x) {
name.xVel = 10;
} else {
name.xVel = -10;
}
name.hitCount = 22;
name.mc.gotoAndStop("falldown");
name.state = "falldown";
} else {
if (p1.mc._x <= name.mc._x) {
name.xVel = p1.xForce;
} else {
name.xVel = -p1.xForce;
}
name.yVel = p1.yForce;
name.hitCount = p1.hitHold;
name.state = "hit";
}
}
}
} while (!((name.mode == 1) || (name.mode == 2)));
if (name.state == 1) {
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 - name.mc._x) < 200) {
if (name.mc.mcHit.hitTest(temp2.mc._x, temp2.mc._y, true)) {
name.xVel = temp2.xVel;
name.yVel = -6 - (Math.random() * 8);
name.state = "thrown";
name.mc.gotoAndStop("thrown");
if (name.holdName != null) {
name.holdName.state = "thrown";
name.holdName.mc._rotation = 0;
name.holdName.xVel = (Math.random() * 10) + name.xVel;
name.holdName.yVel = (Math.random() * -6) - 10;
name.holdName.grabbedName = null;
name.holdName = null;
name.grabCount = 0;
}
if (temp2.projType == "fireball") {
temp2.state = "hit";
temp2.mc.gotoAndStop("hit");
temp2.modeCount = -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(((name.mc._x - mcCam._x) / 400) * 100));
} else if (temp2.projType == "wind") {
temp2.state = "hit";
temp2.mc.gotoAndStop("hit");
temp2.modeCount = -123;
soundFX.attachSound("s_hoodleyhit");
soundFX.start(0, 0);
soundFX.setPan(Math.ceil(((name.mc._x - mcCam._x) / 400) * 100));
} else if (temp2.projType == "lightning") {
temp2.state = "hit";
temp2.mc.gotoAndStop("hit");
temp2.modeCount = -123;
soundFX.attachSound("s_lightninghit");
soundFX.start(0, 0);
soundFX.setPan(Math.ceil(((name.mc._x - mcCam._x) / 400) * 100));
}
}
}
}
temp++;
}
if (name.grabCount > 0) {
temp = 1;
while (temp <= staffs) {
temp2 = "staff_" + temp;
temp2 = this[temp2];
if (((temp2.grabbedName == null) && (temp2.state == 1)) && (name.mc.mcMC.mcGrab != undefined)) {
if (name.mc._xscale > 0) {
temp = name.mc.mcMC.mcGrab._x;
} else {
temp = -name.mc.mcMC.mcGrab._x;
}
if (temp2.mc.mcHit.hitTest(name.mc._x + temp, name.mc._y + name.mc.mcMC.mcGrab._y, true)) {
temp2.state = "grabbed";
temp2.grabbedName = name;
temp2.mc.swapDepths(name.depth0 + 1);
temp2.depth = name.depth0 + 1;
name.holdName = temp2;
name.grabCount = 0;
}
}
temp++;
}
}
if (p1.headbouncing == 1) {
if (name.mc.mcHit.hitTest(p1.mc._x, p1.mc._y, true)) {
p1.headbouncing = 2;
p1.mc._y = name.mc._y - name.head;
name.mc.gotoAndStop("drop");
name.animHoldIdle = 19;
name.xVel = 0;
name.state = "down";
name.modeCount = 90;
name.holdName.mc.swapDepths(name.holdName.mc.getDepth() + enemyDeadOffset);
if (name.holdName != null) {
name.holdName.state = "thrown";
name.holdName.mc._rotation = 0;
name.holdName.yVel = (Math.random() * 4) + 6;
name.holdName.grabbedName = null;
name.holdName = null;
name.grabCount = 0;
}
soundFX.attachSound("s_headbounce");
soundFX.start(0, 0);
}
}
if ((name.mode == 1) && (name.state == 1)) {
if ((p1.plane == "ground") && (p1.state != "stuck")) {
if ((((p1.mc._x - name.mc._x) < 150) && ((p1.mc._x - name.mc._x) > 0)) && (name.mc._xscale > 0)) {
if (Math.abs(p1.mc._y - name.mc._y) < 36) {
if ((!mapHit.hitTest(name.mc._x + 50, name.mc._y - (name.head / 2), true)) && (!mapHit.hitTest(name.mc._x + 100, name.mc._y - (name.head / 2), true))) {
name.alertTime++;
if (Math.abs(p1.xVel) > 4) {
if (name.alertTime > 2) {
with (name) {
alertTime = 0;
mode = 2;
xVel = 0;
stopCount = 15;
mc.gotoAndStop("alert");
animHoldIdle = 8;
modeCount = 300;
xDest = p1.mc._x;
}
soundHuntCount++;
}
} else if (p1.crouching) {
if (name.alertTime > 24) {
with (name) {
alertTime = 0;
mode = 2;
xVel = 0;
stopCount = 15;
mc.gotoAndStop("alert");
animHoldIdle = 8;
modeCount = 300;
xDest = p1.mc._x;
}
soundHuntCount++;
}
} else if (name.alertTime > 12) {
with (name) {
alertTime = 0;
mode = 2;
xVel = 0;
stopCount = 15;
mc.gotoAndStop("alert");
animHoldIdle = 8;
modeCount = 300;
xDest = p1.mc._x;
}
soundHuntCount++;
}
}
}
} else if ((((p1.mc._x - name.mc._x) > -150) && ((p1.mc._x - name.mc._x) < 0)) && (name.mc._xscale < 0)) {
if (Math.abs(p1.mc._y - name.mc._y) < 36) {
if ((!mapHit.hitTest(name.mc._x - 50, name.mc._y - (name.head / 2), true)) && (!mapHit.hitTest(name.mc._x - 100, name.mc._y - (name.head / 2), true))) {
name.alertTime++;
if (Math.abs(p1.xVel) > 4) {
if (name.alertTime > 2) {
with (name) {
alertTime = 0;
mode = 2;
xVel = 0;
stopCount = 15;
mc.gotoAndStop("alert");
animHoldIdle = 8;
modeCount = 300;
xDest = p1.mc._x;
}
soundHuntCount++;
}
} else if (p1.crouching) {
if (name.alertTime > 24) {
with (name) {
alertTime = 0;
mode = 2;
xVel = 0;
stopCount = 15;
mc.gotoAndStop("alert");
animHoldIdle = 8;
modeCount = 300;
xDest = p1.mc._x;
}
soundHuntCount++;
}
} else if (name.alertTime > 12) {
with (name) {
alertTime = 0;
mode = 2;
xVel = 0;
stopCount = 15;
mc.gotoAndStop("alert");
animHoldIdle = 8;
modeCount = 300;
xDest = p1.mc._x;
}
soundHuntCount++;
}
}
}
}
}
if (name.stopCount > 0) {
name.stopCount--;
} else if (name.stopCount == 0) {
temp = Math.random();
if (temp < 0.2) {
name.stopCount--;
if (name.mc._x < name.xPatrol) {
name.xDest = name.xPatrol + 150;
name.mc._xscale = 100;
name.mc.gotoAndStop("turn");
name.animHoldWalk = 9;
} else {
name.xDest = name.xPatrol - 150;
name.mc._xscale = -100;
name.mc.gotoAndStop("turn");
name.animHoldWalk = 9;
}
}
}
if ((name.xVel != 0) && (Math.abs(name.xDest - name.mc._x) < (name.xAcc + 0.2))) {
name.mc._x = name.xDest;
name.xVel = 0;
name.stopCount = 90;
name.mc.gotoAndStop("idle");
} else if ((name.holdName == null) && (name.grabCount <= 0)) {
temp = 1;
while (temp <= staffs) {
temp2 = "staff_" + temp;
temp2 = this[temp2];
if ((temp2.grabbedName == null) && (temp2.state == 1)) {
if ((Math.abs(name.mc._x - temp2.mc._x) < 16) && (Math.abs(name.mc._y - temp2.mc._y) < 12)) {
name.grabCount = 15;
name.mc.gotoAndStop("grabIdle");
name.animHoldIdle = 24;
name.stopCount = 26;
name.xVel = 0;
name.xDest = name.mc._x;
break;
}
}
temp++;
}
}
if ((name.stopCount < 0) && (name.mc._xscale < 0)) {
if (mapHit.hitTest(name.mc._x, name.mc._y + gravity, true)) {
if (name.animHoldWalk <= 0) {
name.mc.gotoAndStop("walk");
}
temp = name.xVel - name.xAcc;
if (temp < (-name.xMax)) {
temp = -name.xMax;
}
enemy1Walk(name, -100, temp, 4);
} else {
temp = name.xVel - name.xAirAcc;
if (temp < (-name.xMax)) {
temp = -name.xMax;
}
if (((!mapHit.hitTest(name.mc._x + temp, name.mc._y, true)) && (!mapHit.hitTest(name.mc._x + temp, name.mc._y - (name.head / 2), true))) && (!mapHit.hitTest(name.mc._x + temp, (name.mc._y - name.head) + 6, true))) {
if (name.xVel < (-name.xMax)) {
if (((!mapHit.hitTest(name.mc._x + (temp / 2), name.mc._y, true)) && (!mapHit.hitTest(name.mc._x + (temp / 2), name.mc._y - (name.head / 2), true))) && (!mapHit.hitTest(name.mc._x + (temp / 2), (name.mc._y - name.head) + 6, true))) {
name.xVel = name.xVel + (-name.xAirAcc);
}
} else {
name.xVel = name.xVel + (-name.xAirAcc);
}
} else {
name.xVel = 0;
name.xDest = name.mc._x + 10;
name.stopCount = -1;
}
}
} else if ((name.stopCount < 0) && (name.mc._xscale > 0)) {
if (mapHit.hitTest(name.mc._x, name.mc._y + gravity, true)) {
if (name.animHoldWalk <= 0) {
name.mc.gotoAndStop("walk");
}
temp = name.xVel + name.xAcc;
if (temp > name.xMax) {
temp = name.xMax;
}
enemy1Walk(name, 100, temp, 4);
} else {
temp = name.xVel + name.xAirAcc;
if (temp > name.xMax) {
temp = name.xMax;
}
if (((!mapHit.hitTest(name.mc._x + temp, name.mc._y, true)) && (!mapHit.hitTest(name.mc._x + temp, name.mc._y - (name.head / 2), true))) && (!mapHit.hitTest(name.mc._x + temp, (name.mc._y - name.head) + 6, true))) {
if (name.xVel > name.xMax) {
if (((!mapHit.hitTest(name.mc._x + (temp / 2), name.mc._y, true)) && (!mapHit.hitTest(name.mc._x + (temp / 2), name.mc._y - (name.head / 2), true))) && (!mapHit.hitTest(name.mc._x + (temp / 2), (name.mc._y - name.head) + 6, true))) {
name.xVel = name.xVel + name.xAirAcc;
}
} else {
name.xVel = name.xVel + name.xAirAcc;
}
} else {
name.xVel = 0;
name.xDest = name.mc._x - 10;
name.stopCount = -1;
}
}
} else if (name.xSpec <= 0) {
if (mapHit.hitTest(name.mc._x, name.mc._y + gravity, true)) {
if ((name.animHoldIdle <= 0) && (name.yVel == 0)) {
if ((name.grabCount <= 0) && (name.windup <= 0)) {
name.mc.gotoAndStop("idle");
}
}
if (name.xVel > 0) {
name.xVel = name.xVel + ((-name.xAcc) * 2);
if (name.xVel <= 0.7) {
name.xVel = 0;
}
} else if (name.xVel < 0) {
name.xVel = name.xVel + (name.xAcc * 2);
if (name.xVel >= -0.7) {
name.xVel = 0;
}
}
} else if (name.xVel > 0) {
if ((name.grabCount <= 0) && (name.animHoldAir <= 0)) {
if (name.windup <= 0) {
name.mc.gotoAndStop("fall");
}
name.jumpPressed = true;
name.animHoldAir = 16;
}
name.mc._xscale = 100;
name.xVel = name.xVel + ((-name.xAcc) / 2);
if (name.xVel <= 0) {
name.xVel = 0;
}
} else if (name.xVel < 0) {
if ((name.grabCount <= 0) && (name.animHoldAir <= 0)) {
if (name.windup <= 0) {
name.mc.gotoAndStop("fall");
}
name.jumpPressed = true;
name.animHoldAir = 16;
}
name.mc._xscale = -100;
name.xVel = name.xVel + (name.xAcc / 2);
if (name.xVel >= 0) {
name.xVel = 0;
}
}
}
if (name.xSpec > 0) {
name.xSpec--;
}
if (name.xSpec <= 0) {
if (name.xVel > name.xMax) {
name.xVel = name.xMax + ((name.xMax - name.xVel) / 8);
} else if (name.xVel < (-name.xMax)) {
name.xVel = (-name.xMax) + ((name.xVel + name.xMax) / 8);
}
}
} else if ((name.mode == 2) && (name.state == 1)) {
name.attackHold--;
if ((name.attackHold > 0) && (p1.plane == "ground")) {
if (name.mc._xscale > 0) {
temp = name.mc.mcMC.mcAttack._x;
} else {
temp = -name.mc.mcMC.mcAttack._x;
}
if ((name.mc.mcMC.mcAttack._x != undefined) && (p1.mc.mcHit.hitTest(name.mc._x + temp, name.mc._y + name.mc.mcMC.mcAttack._y, true))) {
if (((p1.holdName != null) && (p1.state == "grabbing")) || ((p1.holdName.state == "choking") && (p1.state == 1))) {
if (p1.holdName.state == "choking") {
p1.holdName.mc.swapDepths(p1.holdName.depth0);
}
p1.holdName.state = 1;
p1.holdName.mode = 2;
p1.holdName.mc.gotoAndStop("idle2");
p1.holdName.grabbedName = null;
p1.holdName = null;
} else if (p1.holdName != null) {
p1.holdName.state = "thrown";
if (name.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 + (-name.bp);
p1.xVel = name.xForce;
p1.yVel = name.yForce;
p1.grabCount = 0;
p1.attackHold = 0;
if (name.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(((name.mc._x - mcCam._x) / 400) * 100));
soundWinkDone = true;
}
}
if (name.modeCount <= 0) {
name.mode = 1;
name.mc.gotoAndStop("alertToIdle");
name.animHoldIdle = 10;
name.stopCount = 9 + (Math.random() * 15);
} else {
if ((p1.plane == "ground") && (p1.state != "stuck")) {
if ((((p1.mc._x - name.mc._x) < 150) && ((p1.mc._x - name.mc._x) > 0)) && (name.mc._xscale > 0)) {
if (Math.abs(p1.mc._y - name.mc._y) < 40) {
if ((!mapHit.hitTest(name.mc._x + 50, name.mc._y - (name.head / 2), true)) && (!mapHit.hitTest(name.mc._x + 100, name.mc._y - (name.head / 2), true))) {
name.modeCount = 300;
soundHuntCount++;
}
}
} else if ((((p1.mc._x - name.mc._x) > -150) && ((p1.mc._x - name.mc._x) < 0)) && (name.mc._xscale < 0)) {
if (Math.abs(p1.mc._y - name.mc._y) < 40) {
if ((!mapHit.hitTest(name.mc._x - 50, name.mc._y - (name.head / 2), true)) && (!mapHit.hitTest(name.mc._x - 100, name.mc._y - (name.head / 2), true))) {
name.modeCount = 300;
soundHuntCount++;
}
}
}
}
if (name.stopCount > 0) {
name.stopCount--;
} else if (name.stopCount == 0) {
temp = Math.random();
if (name.mc._xscale < 0) {
if ((((p1.mc._x - name.mc._x) > -200) && ((p1.mc._x - name.mc._x) < 0)) && (name.mc._xscale < 0)) {
if (Math.abs(p1.mc._y - name.mc._y) < 80) {
if (p1.plane == "ground") {
name.mc._xscale = -100;
name.xDest = p1.mc._x;
name.mc.gotoAndStop("walk2");
}
}
} else {
name.mc._xscale = 100;
name.xDest = name.mc._x + 250;
name.mc.gotoAndStop("turn2");
name.animHoldIdle = 4;
name.animHoldWalk = 4;
}
name.stopCount--;
} else if (name.mc._xscale > 0) {
if ((((p1.mc._x - name.mc._x) < 200) && ((p1.mc._x - name.mc._x) > 0)) && (name.mc._xscale > 0)) {
if (Math.abs(p1.mc._y - name.mc._y) < 80) {
if (p1.plane == "ground") {
name.mc._xscale = 100;
name.xDest = p1.mc._x;
name.mc.gotoAndStop("walk2");
}
}
} else {
name.mc._xscale = -100;
name.xDest = name.mc._x - 250;
name.mc.gotoAndStop("turn2");
name.animHoldIdle = 4;
name.animHoldWalk = 4;
}
name.stopCount--;
}
}
if ((name.holdName == null) && (name.grabCount <= 0)) {
temp = 1;
while (temp <= staffs) {
temp2 = "staff_" + temp;
temp2 = this[temp2];
if ((temp2.grabbedName == null) && (temp2.state == 1)) {
if ((Math.abs(name.mc._x - temp2.mc._x) < 16) && (Math.abs(name.mc._y - temp2.mc._y) < 12)) {
name.grabCount = 15;
name.mc.gotoAndStop("grabIdle2");
name.animHoldIdle = 24;
name.stopCount = 26;
name.xVel = 0;
name.xDest = name.mc._x;
break;
}
}
temp++;
}
}
if (((name.stopCount <= 0) && (name.xSpec <= 0)) && (name.attackHold <= 0)) {
temp = Math.random();
if ((((name.xVel != 0) && (Math.abs(name.xDest - name.mc._x) < (name.xAcc + 0.2))) || ((name.xDest < name.mc._x) && (name.mc._xscale > 0))) || ((name.xDest > name.mc._x) && (name.mc._xscale < 0))) {
name.mc._x = name.xDest;
name.xVel = 0;
name.stopCount = 40;
name.mc.gotoAndStop("idle2");
} else if ((p1.plane == "ground") && (name.animHoldWalk <= 0)) {
if ((p1.state == 1) || (p1.state == "grabbing")) {
if (name.mc._xscale < 0) {
if ((((temp > 0.7) && ((p1.mc._x - name.mc._x) > -80)) && ((p1.mc._x - name.mc._x) < 0)) && (Math.abs(p1.mc._y - name.mc._y) < 50)) {
if ((!mapHit.hitTest(name.mc._x + 50, name.mc._y - (name.head / 2), true)) && (!mapHit.hitTest(name.mc._x + 100, name.mc._y - (name.head / 2), true))) {
with (name) {
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 - name.mc._x) > -200)) && ((p1.mc._x - name.mc._x) < 0)) && (Math.abs(p1.mc._y - name.mc._y) < 60)) && (name.holdName.actor == "staff")) && (name.attackHold <= 0)) {
if ((!mapHit.hitTest(name.mc._x + 50, name.mc._y - (name.head / 2), true)) && (!mapHit.hitTest(name.mc._x + 100, name.mc._y - (name.head / 2), true))) {
name.mc.gotoAndStop("staffAttack");
name.animHoldIdle = 17;
name.attackHold = 47;
name.stopCount = 15;
staffAttack(name.holdName, 3, 1, 10);
}
}
} else if (name.mc._xscale > 0) {
if ((((temp > 0.7) && ((p1.mc._x - name.mc._x) < 80)) && ((p1.mc._x - name.mc._x) > 0)) && (Math.abs(p1.mc._y - name.mc._y) < 50)) {
if ((!mapHit.hitTest(name.mc._x + 50, name.mc._y - (name.head / 2), true)) && (!mapHit.hitTest(name.mc._x + 100, name.mc._y - (name.head / 2), true))) {
with (name) {
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 - name.mc._x) < 200)) && ((p1.mc._x - name.mc._x) > 0)) && (Math.abs(p1.mc._y - name.mc._y) < 60)) && (name.holdName.actor == "staff")) && (name.attackHold <= 0)) {
if ((!mapHit.hitTest(name.mc._x + 50, name.mc._y - (name.head / 2), true)) && (!mapHit.hitTest(name.mc._x + 100, name.mc._y - (name.head / 2), true))) {
name.mc.gotoAndStop("staffAttack");
name.animHoldIdle = 17;
name.attackHold = 47;
name.stopCount = 15;
staffAttack(name.holdName, 3, 1, 10);
}
}
}
} else if (Math.random() > 0.9) {
name.xDest = name.mc._x;
}
}
}
if ((((name.xSpec <= 0) && (name.attackHold <= 0)) && (name.stopCount < 0)) && (name.mc._xscale < 0)) {
if (mapHit.hitTest(name.mc._x, name.mc._y + gravity, true)) {
if (name.animHoldWalk <= 0) {
name.mc.gotoAndStop("walk2");
}
temp = name.xVel - name.xAcc;
if (temp < (-name.xHuntMax)) {
temp = -name.xHuntMax;
}
enemy1Walk(name, -100, temp, 4);
} else {
temp = name.xVel - name.xAirAcc;
if (temp < (-name.xHuntMax)) {
temp = -name.xHuntMax;
}
if (((!mapHit.hitTest(name.mc._x + temp, name.mc._y, true)) && (!mapHit.hitTest(name.mc._x + temp, name.mc._y - (name.head / 2), true))) && (!mapHit.hitTest(name.mc._x + temp, (name.mc._y - name.head) + 6, true))) {
if (name.xVel < (-name.xHuntMax)) {
if (((!mapHit.hitTest(name.mc._x + (temp / 2), name.mc._y, true)) && (!mapHit.hitTest(name.mc._x + (temp / 2), name.mc._y - (name.head / 2), true))) && (!mapHit.hitTest(name.mc._x + (temp / 2), (name.mc._y - name.head) + 6, true))) {
name.xVel = name.xVel + (-name.xAirAcc);
}
} else {
name.xVel = name.xVel + (-name.xAirAcc);
}
} else {
name.xVel = 0;
}
}
} else if ((((name.xSpec <= 0) && (name.attackHold <= 0)) && (name.stopCount < 0)) && (name.mc._xscale > 0)) {
if (mapHit.hitTest(name.mc._x, name.mc._y + gravity, true)) {
if (name.animHoldWalk <= 0) {
name.mc.gotoAndStop("walk2");
}
temp = name.xVel + name.xAcc;
if (temp > name.xHuntMax) {
temp = name.xHuntMax;
}
enemy1Walk(name, 100, temp, 4);
} else {
temp = name.xVel + name.xAirAcc;
if (temp > name.xHuntMax) {
temp = name.xHuntMax;
}
if (((!mapHit.hitTest(name.mc._x + temp, name.mc._y, true)) && (!mapHit.hitTest(name.mc._x + temp, name.mc._y - (name.head / 2), true))) && (!mapHit.hitTest(name.mc._x + temp, (name.mc._y - name.head) + 6, true))) {
if (name.xVel > name.xHuntMax) {
if (((!mapHit.hitTest(name.mc._x + (temp / 2), name.mc._y, true)) && (!mapHit.hitTest(name.mc._x + (temp / 2), name.mc._y - (name.head / 2), true))) && (!mapHit.hitTest(name.mc._x + (temp / 2), (name.mc._y - name.head) + 6, true))) {
name.xVel = name.xVel + name.xAirAcc;
}
} else {
name.xVel = name.xVel + name.xAirAcc;
}
} else {
name.xVel = 0;
name.xDest = name.mc._x - 10;
name.stopCount = -1;
}
}
} else if (name.xSpec <= 0) {
if (mapHit.hitTest(name.mc._x, name.mc._y + gravity, true)) {
if ((name.animHoldIdle <= 0) && (name.yVel == 0)) {
if ((name.grabCount <= 0) && (name.windup <= 0)) {
name.mc.gotoAndStop("idle2");
}
}
if (name.xVel > 0) {
name.xVel = name.xVel + ((-name.xAcc) * 2);
if (name.xVel <= 0.7) {
name.xVel = 0;
}
} else if (name.xVel < 0) {
name.xVel = name.xVel + (name.xAcc * 2);
if (name.xVel >= -0.7) {
name.xVel = 0;
}
}
} else if (name.xVel > 0) {
if ((name.grabCount <= 0) && (name.animHoldAir <= 0)) {
if (name.windup <= 0) {
name.mc.gotoAndStop("fall");
}
name.jumpPressed = true;
name.animHoldAir = 16;
}
name.mc._xscale = 100;
name.xVel = name.xVel + ((-name.xAcc) / 2);
if (name.xVel <= 0) {
name.xVel = 0;
}
} else if (name.xVel < 0) {
if ((name.grabCount <= 0) && (name.animHoldAir <= 0)) {
if (name.windup <= 0) {
name.mc.gotoAndStop("fall");
}
name.jumpPressed = true;
name.animHoldAir = 16;
}
name.mc._xscale = -100;
name.xVel = name.xVel + (name.xAcc / 2);
if (name.xVel >= 0) {
name.xVel = 0;
}
}
}
if (name.xSpec > 0) {
name.xSpec--;
}
if (name.xSpec <= 0) {
if (name.xVel > name.xHuntMax) {
name.xVel = name.xHuntMax + ((name.xHuntMax - name.xVel) / 8);
} else if (name.xVel < (-name.xHuntMax)) {
name.xVel = (-name.xHuntMax) + ((name.xVel + name.xHuntMax) / 8);
}
}
}
}
if (name.xVel != 0) {
if (name.stopCount >= 0) {
if (mapHit.hitTest(name.mc._x + name.xVel, name.mc._y - gravity, true)) {
name.xVel = 0;
name.xDest = name.mc._x;
name.stopCount = -1;
}
}
}
name.mc._x = name.mc._x + name.xVel;
if ((name.xVel != 0) && (name.stopCount < 0)) {
if ((!mapHit.hitTest(name.mc._x, name.mc._y, true)) && (mapHit.hitTest(name.mc._x, name.mc._y + (gravity * 8), true))) {
temp = 0;
while ((temp < (gravity * 8)) && (!mapHit.hitTest(name.mc._x, name.mc._y + temp, true))) {
temp = temp + gravity;
}
name.mc._y = name.mc._y + temp;
}
}
if (!mapHit.hitTest(name.mc._x, (name.mc._y + gravity) + name.yVel, true)) {
name.yVel = name.yVel + gravity;
if (!name.jumping) {
name.mc.gotoAndStop("fall");
}
} else {
name.yVel = name.yVel + (-gravity);
temp = name.yMax;
while (mapHit.hitTest(name.mc._x, name.mc._y + name.yVel, true)) {
name.yVel = name.yVel + (-gravity);
temp = temp + (-gravity);
if (temp < gravity) {
if (!mapHit.hitTest(name.mc._x - 50, name.mc._y - gravity, true)) {
name.mc._x = name.mc._x + -5;
while ((!mapHit.hitTest(name.mc._x - 50, name.mc._y - gravity, true)) && (mapHit.hitTest(name.mc._x, name.mc._y - gravity, true))) {
name.mc._x = name.mc._x + -5;
}
} else {
name.mc._x = name.mc._x + 5;
while ((!mapHit.hitTest(name.mc._x + 50, name.mc._y - gravity, true)) && (mapHit.hitTest(name.mc._x, name.mc._y - gravity, true))) {
name.mc._x = name.mc._x + 5;
}
}
name.xDest = name.mc._x;
name.yVel = -gravity;
break;
}
}
name.yVel = name.yVel + gravity;
name.mc._y = name.mc._y + name.yVel;
if (name.yVel != 0) {
name.mc.gotoAndStop("land");
name.landCount = 6;
}
name.yVel = 0;
name.jumping = false;
}
if (name.yVel < 0) {
if (mapHit.hitTest(name.mc._x, (name.mc._y - name.head) + name.yVel, true)) {
temp = name.yVel + gravity;
name.mc._y = name.mc._y + temp;
name.yVel = 0.001;
while (mapHit.hitTest(name.mc._x, (name.mc._y - name.head) + temp, true)) {
name.mc._y = name.mc._y + gravity;
temp = temp + gravity;
if (mapHit.hitTest(name.mc._x, name.mc._y + gravity, true)) {
if (!mapHit.hitTest(name.mc._x - 50, name.mc._y, true)) {
name.mc._x = name.mc._x + -50;
} else {
name.mc._x = name.mc._x + 50;
}
}
}
}
}
if (name.ySpec > 0) {
name.ySpec--;
}
if (name.ySpec <= 0) {
if (name.yVel > name.yMax) {
name.yVel = name.yMax;
} else if (name.yVel < (-name.yMax)) {
name.yVel = -name.yMax;
}
}
name.mc._y = name.mc._y + name.yVel;
if ((Math.abs(name.mc._x - p1.mc._x) > xCutoff) || (Math.abs(name.mc._y - p1.mc._y) > yCutoff)) {
if (mapHit.hitTest(name.mc._x, name.mc._y, true)) {
name.state = "inactive";
name.mc._visible = false;
}
}
if ((thrownName != null) && (thrownName != name)) {
if (thrownName.actor != "torch") {
if (name.mc.mcHit.hitTest(thrownName.mc.mcHit)) {
name.xVel = thrownName.xVel;
name.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) {
name.state = "thrown";
name.mc.gotoAndStop("thrown");
if (name.holdName != null) {
name.holdName.state = "thrown";
name.holdName.mc._rotation = 0;
name.holdName.xVel = (Math.random() * 32) - 16;
name.holdName.yVel = (Math.random() * -10) - 12;
name.holdName.grabbedName = null;
name.holdName = null;
name.grabCount = 0;
}
}
}
} else if ((thrownName.state == "thrown") && ((Math.abs(thrownName.xVel) > 6) || (Math.abs(thrownName.yVel) > 6))) {
if (name.mc.mcHit.hitTest(thrownName.mc._x, thrownName.mc._y, true)) {
name.state = "onfire";
name.mc.gotoAndStop("onfire");
name.modeCount = 180;
thrownName.state = "hit";
thrownName.mc.gotoAndStop("hit");
thrownName.xVel = 0;
thrownName.yVel = 0;
thrownName = null;
if (name.holdName != null) {
name.holdName.state = "thrown";
name.holdName.mc._rotation = 0;
name.holdName.xVel = (Math.random() * 16) - 8;
name.holdName.yVel = (Math.random() * -6) - 12;
name.holdName.grabbedName = null;
name.holdName = null;
name.grabCount = 0;
}
soundFX.attachSound("s_torchhit");
soundFX.start(0, 0);
soundFX.setPan(Math.ceil(((name.mc._x - mcCam._x) / 400) * 100));
soundHoodleyFire.attachSound("s_hoodleyfire");
soundHoodleyFire.start(0, 5);
}
}
}
} else if (name.state == "grabbed") {
if (p1.xVel != 0) {
if (((p1.mc._xscale < 0) && (p1.xVel > 0)) || ((p1.mc._xscale > 0) && (p1.xVel < 0))) {
name.mc.gotoAndStop("grabbedB");
} else {
name.mc.gotoAndStop("grabbedF");
}
} else if (name.animHoldIdle <= 0) {
name.mc.gotoAndStop("grabbed");
}
if (name.grabbedName.mc._xscale > 0) {
name.mc._x = name.grabbedName.mc._x + name.grabbedName.mc.mcMC.mcHand._x;
name.mc._xscale = 100;
} else {
name.mc._x = name.grabbedName.mc._x - name.grabbedName.mc.mcMC.mcHand._x;
name.mc._xscale = -100;
}
} else if (name.state == "thrown") {
if (name.xVel > 0) {
if (name.yVel != 0) {
name.xVel = name.xVel / frictionAir;
} else {
name.xVel = name.xVel / friction;
}
if (name.xVel <= 0.3) {
name.xVel = 0;
}
} else if (name.xVel < 0) {
if (name.yVel != 0) {
name.xVel = name.xVel / frictionAir;
} else {
name.xVel = name.xVel / friction;
}
if (name.xVel >= -0.3) {
name.xVel = 0;
}
}
if (name.xVel != 0) {
if (mapHit.hitTest(name.mc._x + name.xVel, name.mc._y - (gravity * 2), true)) {
if (name.xVel > 0) {
temp = name.xVel - name.xAcc;
enemyBounceRight(name, temp);
} else {
temp = name.xVel + name.xAcc;
enemyBounceLeft(name, temp);
}
if (Math.abs(name.xVel) <= 0.3) {
name.xVel = 0;
name.xDest = name.mc._x + 10;
name.stopCount = -1;
}
} else if (name.xVel > name.xMax) {
if (mapHit.hitTest(name.mc._x + (name.xVel / 2), name.mc._y - (gravity * 2), true)) {
temp = (name.xVel / 2) - name.xAcc;
enemyBounceRight(name, temp);
} else if (mapHit.hitTest(name.mc._x, name.mc._y - (gravity * 2), true)) {
temp = -name.xAcc;
enemyBounceRight(name, temp);
}
} else if (name.xVel < (-name.xMax)) {
if (mapHit.hitTest(name.mc._x + (name.xVel / 2), name.mc._y - (gravity * 2), true)) {
temp = (name.xVel / 2) + name.xAcc;
enemyBounceLeft(name, temp);
} else if (mapHit.hitTest(name.mc._x, name.mc._y - (gravity * 2), true)) {
temp = name.xAcc;
enemyBounceLeft(name, temp);
}
}
}
name.mc._x = name.mc._x + name.xVel;
if (((name.xVel != 0) && (!Key.isDown(name.keyLeft))) && (!Key.isDown(name.keyRight))) {
if ((!mapHit.hitTest(name.mc._x, name.mc._y, true)) && (mapHit.hitTest(name.mc._x, name.mc._y + (gravity * 8), true))) {
temp = 0;
while ((temp < (gravity * 8)) && (!mapHit.hitTest(name.mc._x, name.mc._y + temp, true))) {
temp = temp + gravity;
}
name.mc._y = name.mc._y + temp;
}
}
if (name.yVel > name.yMax) {
name.yVel = name.yMax;
}
if (!mapHit.hitTest(name.mc._x, (name.mc._y + gravity) + name.yVel, true)) {
name.mc.gotoAndStop("thrown");
if (name.yVel > 20) {
if (name.yVel > 20) {
if (!mapHit.hitTest(name.mc._x, (name.mc._y + gravity) + (name.yVel / 2), true)) {
name.yVel = name.yVel + gravity;
if (name.yVel > gravity) {
name.jumping = false;
}
if (!name.jumping) {
}
} else {
enemy0HitGround(name);
name._y = name._y + (-gravity);
}
}
} else {
name.yVel = name.yVel + gravity;
if (name.yVel > gravity) {
name.jumping = false;
}
if (!name.jumping) {
}
}
} else {
enemy0HitGround(name);
name.mc.gotoAndStop("bouncing");
name.animHoldIdle = 4;
if (name.xVel == 0) {
if (!mapHit.hitTest(name.mc._x - 10, name.mc._y + 3, true)) {
name.xVel = name.yVel * 2;
} else if (!mapHit.hitTest(name.mc._x - 20, name.mc._y + 3, true)) {
name.xVel = name.yVel;
} else if (!mapHit.hitTest(name.mc._x - 40, name.mc._y + 3, true)) {
name.xVel = name.yVel / 2;
} else if (!mapHit.hitTest(name.mc._x + 10, name.mc._y + 3, true)) {
name.xVel = (-name.yVel) * 2;
} else if (!mapHit.hitTest(name.mc._x + 20, name.mc._y + 3, true)) {
name.xVel = -name.yVel;
} else if (!mapHit.hitTest(name.mc._x + 40, name.mc._y + 3, true)) {
name.xVel = (-name.yVel) / 2;
}
}
}
if (name.yVel < 0) {
if (mapHit.hitTest(name.mc._x, (name.mc._y - name.head) + name.yVel, true)) {
temp = name.yVel + gravity;
name.mc._y = name.mc._y + temp;
name.yVel = 0.001;
while (mapHit.hitTest(name.mc._x, (name.mc._y - name.head) + temp, true)) {
name.mc._y = name.mc._y + gravity;
temp = temp + gravity;
}
}
}
name.mc._y = name.mc._y + name.yVel;
if ((name.xVel == 0) && (name.yVel == 0)) {
if (thrownName == name) {
thrownName = null;
}
name.state = "down";
} else {
name.modeCount = 30;
}
} else if (name.state == "hit") {
name.hitCount--;
if (name.hitCount <= 0) {
if (name.yVel != 0) {
name.mc.gotoAndStop("fall");
} else {
name.mc.gotoAndStop("idle");
}
name.state = 1;
} else {
name.mc.gotoAndStop("hit2");
if (name.xVel > 0) {
if (name.yVel != 0) {
name.xVel = name.xVel / frictionAir;
} else {
name.xVel = name.xVel / friction;
}
if (name.xVel <= 0.9) {
name.xVel = 0;
}
} else if (name.xVel < 0) {
if (name.yVel != 0) {
name.xVel = name.xVel / frictionAir;
} else {
name.xVel = name.xVel / friction;
}
if (name.xVel >= -0.9) {
name.xVel = 0;
}
}
if (name.xVel != 0) {
if (name.stopCount >= 0) {
if (mapHit.hitTest(name.mc._x + name.xVel, name.mc._y - gravity, true)) {
name.xVel = 0;
name.xDest = name.mc._x - 10;
name.stopCount = -1;
}
}
}
name.mc._x = name.mc._x + name.xVel;
if ((name.xVel != 0) && (name.stopCount < 0)) {
if ((!mapHit.hitTest(name.mc._x, name.mc._y, true)) && (mapHit.hitTest(name.mc._x, name.mc._y + (gravity * 8), true))) {
temp = 0;
while ((temp < (gravity * 8)) && (!mapHit.hitTest(name.mc._x, name.mc._y + temp, true))) {
temp = temp + gravity;
}
name.mc._y = name.mc._y + temp;
}
}
if (!mapHit.hitTest(name.mc._x, (name.mc._y + gravity) + name.yVel, true)) {
name.yVel = name.yVel + gravity;
if (!name.jumping) {
}
} else {
name.yVel = name.yVel + (-gravity);
temp = name.yMax;
while (mapHit.hitTest(name.mc._x, name.mc._y + name.yVel, true)) {
name.yVel = name.yVel + (-gravity);
temp = temp + (-gravity);
if (temp < gravity) {
if (!mapHit.hitTest(name.mc._x - 50, name.mc._y + name.head, true)) {
name.mc._x = name.mc._x + -50;
} else if (!mapHit.hitTest(name.mc._x + 50, name.mc._y + name.head, true)) {
name.mc._x = name.mc._x + 50;
}
name.yVel = 0;
break;
}
}
name.yVel = name.yVel + gravity;
name.mc._y = name.mc._y + name.yVel;
if (name.yVel != 0) {
name.landCount = 6;
}
name.yVel = 0;
name.jumping = false;
}
if (name.ySpec <= 0) {
if (name.yVel > name.yMax) {
name.yVel = name.yMax;
} else if (name.yVel < (-name.yMax)) {
name.yVel = -name.yMax;
}
}
name.mc._y = name.mc._y + name.yVel;
}
} else if (name.state == "falldown") {
name.hitCount--;
if ((name.hitCount <= 0) && (name.yVel == 0)) {
if (name.hp > 0) {
name.hitCount = 12;
name.mc.gotoAndStop("getup");
name.state = "getup";
}
}
if (name.xVel > 0) {
if (name.yVel != 0) {
name.xVel = name.xVel / frictionAir;
} else {
name.xVel = name.xVel / friction;
}
if (name.xVel <= 0.9) {
name.xVel = 0;
}
} else if (name.xVel < 0) {
if (name.yVel != 0) {
name.xVel = name.xVel / frictionAir;
} else {
name.xVel = name.xVel / friction;
}
if (name.xVel >= -0.9) {
name.xVel = 0;
}
}
if (name.xVel != 0) {
if (name.stopCount >= 0) {
if (mapHit.hitTest(name.mc._x + name.xVel, name.mc._y - gravity, true)) {
name.xVel = 0;
name.xDest = name.mc._x;
name.stopCount = -1;
}
}
}
name.mc._x = name.mc._x + name.xVel;
if ((name.xVel != 0) && (name.stopCount < 0)) {
if ((!mapHit.hitTest(name.mc._x, name.mc._y, true)) && (mapHit.hitTest(name.mc._x, name.mc._y + (gravity * 8), true))) {
temp = 0;
while ((temp < (gravity * 8)) && (!mapHit.hitTest(name.mc._x, name.mc._y + temp, true))) {
temp = temp + gravity;
}
name.mc._y = name.mc._y + temp;
}
}
if (!mapHit.hitTest(name.mc._x, (name.mc._y + gravity) + name.yVel, true)) {
name.yVel = name.yVel + gravity;
if (!name.jumping) {
}
if (name.yVel > 0) {
name.fallTime++;
}
} else {
name.yVel = name.yVel + (-gravity);
temp = name.yMax;
while (mapHit.hitTest(name.mc._x, name.mc._y + name.yVel, true)) {
name.yVel = name.yVel + (-gravity);
temp = temp + (-gravity);
if (temp < gravity) {
if (!mapHit.hitTest(name.mc._x - 50, name.mc._y + name.head, true)) {
name.mc._x = name.mc._x + -50;
} else if (!mapHit.hitTest(name.mc._x + 50, name.mc._y + name.head, true)) {
name.mc._x = name.mc._x + 50;
}
name.yVel = 0;
break;
}
}
name.yVel = name.yVel + gravity;
name.mc._y = name.mc._y + name.yVel;
if (name.yVel != 0) {
}
name.yVel = 0;
name.jumping = false;
name.fallTime = 0;
}
if (name.ySpec <= 0) {
if (name.yVel > name.yMax) {
name.yVel = name.yMax;
} else if (name.yVel < (-name.yMax)) {
name.yVel = -name.yMax;
}
}
name.mc._y = name.mc._y + name.yVel;
} else if (name.state == "getup") {
name.hitCount--;
if (name.hitCount <= 0) {
name.mc.gotoAndStop("idle");
name.state = 1;
}
} else if (name.state == "choking") {
if (name.mc._xscale < 0) {
name.mc._x = p1.mc._x - p1.mc.mcMC.mcHand;
} else {
name.mc._x = p1.mc._x + p1.mc.mcMC.mcHand;
}
if (name.modeCount <= 0) {
p1.holdName = null;
name.state = "clothes";
soundFX.attachSound("s_choke2");
soundFX.start(0, 0);
}
} else if (name.state == "down") {
if (name.animHoldIdle <= 0) {
name.mc.gotoAndStop("down");
}
if (name.modeCount <= 0) {
name.state = 1;
name.mc.gotoAndStop("getup");
name.animHoldIdle = 23;
name.animHoldWalk = 23;
name.xSpec = 23;
name.mc.swapDepths(name.depth0);
name.mode = 2;
name.modeCount = 300;
name.xDest = name.mc._x;
name.stopCount = -1;
}
} else if (name.state == "onfire") {
if (name.modeCount > 0) {
temp = 1;
while (temp <= projectiles) {
temp2 = "proj_" + temp;
temp2 = this[temp2];
if ((temp2.mc._x != undefined) && (temp2.state == "thrown")) {
if (Math.abs(temp2.mc._x - name.mc._x) < 300) {
if (name.mc.mcHit.hitTest(temp2.mc._x, temp2.mc._y, true)) {
name.xVel = temp2.xVel;
name.yVel = -6 - (Math.random() * 8);
name.state = "thrown";
name.mc.gotoAndStop("thrown");
temp2.state = "hit";
temp2.modeCount = -123;
}
}
}
temp++;
}
if (p1.headbouncing == 1) {
if (name.mc.mcHit.hitTest(p1.mc._x, p1.mc._y, true)) {
p1.headbouncing = 2;
p1.mc._y = name.mc._y - name.head;
name.mc.gotoAndStop("drop");
name.animHoldIdle = 19;
name.xVel = 0;
name.state = "down";
name.modeCount = 90;
name.holdName.mc.swapDepths(name.holdName.mc.getDepth() + enemyDeadOffset);
}
}
if (name.state == "onfire") {
soundHoodleyFire.setPan(Math.ceil(((name.mc._x - mcCam._x) / 400) * 100));
soundHoodleyFire.setVolume(Math.abs(100 - Math.abs(Math.ceil(((name.mc._x - mcCam._x) / 400) * 100))) + 30);
if (Math.abs(name.mc._x - name.xDest) < 5) {
name.mc._x = name.xDest;
name.xVel = 0;
if (Math.random() > 0.5) {
name.xDest = (name.mc._x + (Math.random() * 100)) + 60;
} else {
name.xDest = (name.mc._x - (Math.random() * 100)) - 60;
}
if ((name.mc._xscale > 0) && (name.xDest < name.mc._x)) {
name.mc._xscale = -100;
name.mc.gotoAndStop("turnFire");
name.animHoldWalk = 2;
} else if ((name.mc._xscale < 0) && (name.xDest > name.mc._x)) {
name.mc._xscale = 100;
name.mc.gotoAndStop("turnFire");
name.animHoldWalk = 2;
} else {
name.gotoAndStop("onfire");
}
}
if (name.mc._xscale < 0) {
if (mapHit.hitTest(name.mc._x, name.mc._y + gravity, true)) {
if (name.animHoldWalk <= 0) {
name.mc.gotoAndStop("onfire");
}
temp = name.xVel - name.xAcc;
if (temp < (-name.xFireMax)) {
temp = -name.xFireMax;
}
enemy1Walk(name, -100, temp, 4);
} else {
temp = name.xVel - name.xAirAcc;
if (temp < (-name.xFireMax)) {
temp = -name.xFireMax;
}
if (((!mapHit.hitTest(name.mc._x + temp, name.mc._y, true)) && (!mapHit.hitTest(name.mc._x + temp, name.mc._y - (name.head / 2), true))) && (!mapHit.hitTest(name.mc._x + temp, (name.mc._y - name.head) + 6, true))) {
if (name.xVel < (-name.xFireMax)) {
if (((!mapHit.hitTest(name.mc._x + (temp / 2), name.mc._y, true)) && (!mapHit.hitTest(name.mc._x + (temp / 2), name.mc._y - (name.head / 2), true))) && (!mapHit.hitTest(name.mc._x + (temp / 2), (name.mc._y - name.head) + 6, true))) {
name.xVel = name.xVel + (-name.xAirAcc);
}
} else {
name.xVel = name.xVel + (-name.xAirAcc);
}
} else {
name.xVel = 0;
}
}
} else if (name.mc._xscale > 0) {
if (mapHit.hitTest(name.mc._x, name.mc._y + gravity, true)) {
if (name.animHoldWalk <= 0) {
name.mc.gotoAndStop("onfire");
}
temp = name.xVel + name.xAcc;
if (temp > name.xFireMax) {
temp = name.xFireMax;
}
enemy1Walk(name, 100, temp, 4);
} else {
temp = name.xVel + name.xAirAcc;
if (temp > name.xFireMax) {
temp = name.xFireMax;
}
if (((!mapHit.hitTest(name.mc._x + temp, name.mc._y, true)) && (!mapHit.hitTest(name.mc._x + temp, name.mc._y - (name.head / 2), true))) && (!mapHit.hitTest(name.mc._x + temp, (name.mc._y - name.head) + 6, true))) {
if (name.xVel > name.xFireMax) {
if (((!mapHit.hitTest(name.mc._x + (temp / 2), name.mc._y, true)) && (!mapHit.hitTest(name.mc._x + (temp / 2), name.mc._y - (name.head / 2), true))) && (!mapHit.hitTest(name.mc._x + (temp / 2), (name.mc._y - name.head) + 6, true))) {
name.xVel = name.xVel + name.xAirAcc;
}
} else {
name.xVel = name.xVel + name.xAirAcc;
}
} else {
name.xVel = 0;
}
}
}
if (name.xSpec > 0) {
name.xSpec--;
}
if (name.xSpec <= 0) {
if (name.xVel > name.xFireMax) {
name.xVel = name.xFireMax + ((name.xFireMax - name.xVel) / 8);
} else if (name.xVel < (-name.xFireMax)) {
name.xVel = (-name.xFireMax) + ((name.xVel + name.xFireMax) / 8);
}
}
}
if (name.xVel != 0) {
if (mapHit.hitTest(name.mc._x + name.xVel, name.mc._y - gravity, true)) {
name.xVel = 0;
}
}
name.mc._x = name.mc._x + name.xVel;
if (name.xVel != 0) {
if ((!mapHit.hitTest(name.mc._x, name.mc._y, true)) && mapHit.hitTest(name.mc._x, name.mc._y + (gravity * 8), true)) {
temp = 0;
while ((temp < (gravity * 8)) && (!mapHit.hitTest(name.mc._x, name.mc._y + temp, true))) {
temp = temp + gravity;
}
name.mc._y = name.mc._y + temp;
}
}
if (!mapHit.hitTest(name.mc._x, (name.mc._y + gravity) + name.yVel, true)) {
name.yVel = name.yVel + gravity;
} else {
name.yVel = name.yVel + (-gravity);
temp = name.yMax;
while (mapHit.hitTest(name.mc._x, name.mc._y + name.yVel, true)) {
name.yVel = name.yVel + (-gravity);
temp = temp + (-gravity);
if (temp < gravity) {
if (!mapHit.hitTest(name.mc._x - 50, name.mc._y + 10, true)) {
name.mc._x = name.mc._x + -50;
} else {
name.mc._x = name.mc._x + 50;
}
name.yVel = 0;
break;
}
}
name.yVel = name.yVel + gravity;
name.mc._y = name.mc._y + name.yVel;
name.yVel = 0;
name.jumping = false;
}
if (name.yVel < 0) {
if (mapHit.hitTest(name.mc._x, (name.mc._y - name.head) + name.yVel, true)) {
temp = name.yVel + gravity;
name.mc._y = name.mc._y + temp;
name.yVel = 0.001;
while (mapHit.hitTest(name.mc._x, (name.mc._y - name.head) + temp, true)) {
name.mc._y = name.mc._y + gravity;
temp = temp + gravity;
}
}
}
if (name.ySpec > 0) {
name.ySpec--;
}
if (name.ySpec <= 0) {
if (name.yVel > name.yMax) {
name.yVel = name.yMax;
} else if (name.yVel < (-name.yMax)) {
name.yVel = -name.yMax;
}
}
name.mc._y = name.mc._y + name.yVel;
if ((Math.abs(name.mc._x - p1.mc._x) > xCutoff) || (Math.abs(name.mc._y - p1.mc._y) > yCutoff)) {
name.mc._visible = false;
} else if (Math.random() > 0.75) {
makeFX("fire", (name.mc._x - 16) + (Math.random() * 32), (name.mc._y - 6) - (Math.random() * 30));
}
if ((thrownName != null) && (thrownName != name)) {
if (thrownName.actor != "torch") {
if (name.mc.mcHit.hitTest(thrownName.mc.mcHit)) {
name.xVel = thrownName.xVel;
name.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 (name.mc.mcHit.hitTest(thrownName.mc._x, thrownName.mc._y, true)) {
name.state = "onfire";
name.mc.gotoAndStop("onfire");
name.modeCount = 120;
thrownName.state = "hit";
thrownName.mc.gotoAndStop("hit");
thrownName.xVel = 0;
thrownName.yVel = 0;
thrownName = null;
}
}
}
} else {
name.state = 1;
name.mode = 2;
name.modeCount = 300;
name.mc.gotoAndStop("idle2");
}
} else if (name.state == "whacked") {
if (name.modeCount == 25) {
shakeCam = 10;
} else if (name.modeCount <= 0) {
name.mc._visible = false;
name.mc._x = -50000;
name.mc._y = -50000;
name.state = "dead";
}
} else if (name.state == "clothes") {
}
}
function enemy1Walk(name, bDirection, velocity, xBuffer) {
var _local1 = name;
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 == 1) && (_local1.mode == 1)) {
_local1.mc.gotoAndStop("idle");
} else if ((_local1.state == 1) && (_local1.mode == 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 == 1) && (_local1.mode == 1)) {
_local1.mc.gotoAndStop("idle");
} else if ((_local1.state == 1) && (_local1.mode == 2)) {
_local1.mc.gotoAndStop("idle2");
}
}
}
function enemy1Jump(name) {
with (name) {
jumping = true;
crouched = false;
jumpPressed = true;
yVel = -20;
animHoldAir = 10;
mc.gotoAndStop("jump");
}
}
function staffControl(staffName) {
name = this[staffName];
var _local2 = name.mc._x;
var _local1 = name.mc._y;
if (name.state == "inactive") {
if ((Math.abs(_local2 - p1.mc._x) <= xCutoff) && (Math.abs(_local1 - p1.mc._y) <= yCutoff)) {
name.state = name.lastState;
name.mc._visible = true;
}
} else {
if ((name.state == 1) || (name.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 (name.mc.mcHit.hitTest(p1.mc._x + temp, p1.mc._y + p1.mc.mcMC.mcGrab._y, true)) {
name.state = "grabbed";
name.grabbedName = p1;
name.mc.swapDepths(grabbedDepth);
name.depth = grabbedDepth;
p1.holdName = name;
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) && (name.mc.mcHit.hitTest(p1.mc._x + temp, p1.mc._y + p1.mc.mcMC.mcAttack._y, true))) {
if (p1.mc._xscale > 0) {
name.xVel = p1.xForce * 4;
} else {
name.xVel = (-p1.xForce) * 4;
}
if (p1.mc.mcMC.mcAttack._y < -10) {
name.yVel = p1.yForce * 4;
}
name.state = "thrown";
}
}
if (name.state == 1) {
name.mc.gotoAndStop("down");
name.mc.mcMC.mcHand.gotoAndStop("none");
name._xscale = name.xScale0;
name._yscale = name.yScale0;
if (name.stopCount > 0) {
name.stopCount++;
if (name.stopCount > ((Math.random() * 45) + 15)) {
name.stopCount = 0;
name.mc._xscale = -name.mc._xscale;
}
}
if (name.xSpec > 0) {
name.xSpec--;
}
if (name.xSpec <= 0) {
if (name.xVel > name.xMax) {
name.xVel = name.xMax + ((name.xMax - name.xVel) / 8);
} else if (name.xVel < (-name.xMax)) {
name.xVel = (-name.xMax) + ((name.xVel + name.xMax) / 8);
}
}
if (name.xVel != 0) {
if (name.stopCount > 0) {
if (mapHit.hitTest(_local2 + name.xVel, _local1 - gravity, true)) {
name.xVel = 0;
}
}
}
name.mc._x = name.mc._x + name.xVel;
if (((name.xVel != 0) && (!Key.isDown(name.keyLeft))) && (!Key.isDown(name.keyRight))) {
if ((!mapHit.hitTest(_local2, _local1, true)) && (mapHit.hitTest(_local2, _local1 + (gravity * 8), true))) {
temp = 0;
while ((temp < (gravity * 8)) && (!mapHit.hitTest(_local2, _local1 + temp, true))) {
temp = temp + gravity;
}
name.mc._y = name.mc._y + temp;
}
}
if (name.ySpec > 0) {
name.ySpec--;
}
if (name.ySpec <= 0) {
if (name.yVel > name.yMax) {
name.yVel = name.yMax;
} else if (name.yVel < (-name.yMax)) {
name.yVel = -name.yMax;
}
}
name.mc._y = name.mc._y + name.yVel;
if ((Math.abs(_local2 - p1.mc._x) > xCutoff) || (Math.abs(_local1 - p1.mc._y) > yCutoff)) {
if (mapHit.hitTest(_local2, _local1, true)) {
name.lastState = name.state;
name.state = "inactive";
name.mc._visible = false;
}
}
if ((((thrownName != null) && (thrownName != name)) && (thrownName.actor != "hoodley")) && (thrownName.actor != "staff")) {
if (name.mc.mcHit.hitTest(thrownName.mc.mcHit)) {
name.xVel = thrownName.xVel;
name.yVel = thrownName.yVel;
thrownName.xVel = (-thrownName.xVel) * 0.8;
thrownName.yVel = (-thrownName.yVel) * 0.8;
name.state = "thrown";
name.mc.gotoAndStop("thrown");
name.mc.mcMC.mcHand.gotoAndStop("none");
}
}
} else if (name.state == "grabbed") {
name.mc.gotoAndStop("grabbed");
if (name.grabbedName.mc._name == "mcP1") {
name.mc.mcMC.mcHand.gotoAndStop("Wink");
} else {
name.mc.mcMC.mcHand.gotoAndStop("none");
}
if (name.grabbedName.mc._xscale > 0) {
name.mc._x = name.grabbedName.mc._x + name.grabbedName.mc.mcMC.mcHand._x;
name.mc._xscale = name.grabbedName.mc.mcMC.mcHand._xscale;
name.mc._rotation = name.grabbedName.mc.mcMC.mcHand._rotation;
} else {
name.mc._x = name.grabbedName.mc._x - name.grabbedName.mc.mcMC.mcHand._x;
name.mc._xscale = -name.grabbedName.mc.mcMC.mcHand._xscale;
name.mc._rotation = -name.grabbedName.mc.mcMC.mcHand._rotation;
}
name.mc._y = name.grabbedName.mc._y + name.grabbedName.mc.mcMC.mcHand._y;
name.mc._yscale = name.grabbedName.mc.mcMC.mcHand._yscale;
if ((Math.abs(_local2 - p1.mc._x) > xCutoff) || (Math.abs(_local1 - p1.mc._y) > yCutoff)) {
name.lastState = name.state;
name.state = "inactive";
name.mc._visible = false;
}
} else if (name.state == "thrown") {
name.mc.mcMC.mcHand.gotoAndStop("none");
name.mc._xscale = name.xScale0;
name.mc._yscale = name.yScale0;
if ((Math.abs(_local2 - p1.mc._x) > xCutoff) || (Math.abs(_local1 - p1.mc._y) > yCutoff)) {
if (mapHit.hitTest(_local2, _local1, true)) {
name.lastState = name.state;
name.state = "inactive";
name.mc._visible = false;
}
}
if (Math.abs(name.mc._rotation + 90) > 93) {
name.mc._rotation = (name.mc._rotation / 2) - 180;
}
if (name.xVel > 0) {
if (name.yVel != 0) {
name.xVel = name.xVel / frictionAir;
} else {
name.xVel = name.xVel / friction;
}
if (name.xVel <= 0.3) {
name.xVel = 0;
}
} else if (name.xVel < 0) {
if (name.yVel != 0) {
name.xVel = name.xVel / frictionAir;
} else {
name.xVel = name.xVel / friction;
}
if (name.xVel >= -0.3) {
name.xVel = 0;
}
}
if (name.xVel != 0) {
if (mapHit.hitTest(_local2 + name.xVel, _local1 - (gravity * 2), true)) {
if (name.xVel > 0) {
temp = name.xVel - name.xAcc;
enemyBounceRight(name, temp);
} else {
temp = name.xVel + name.xAcc;
enemyBounceLeft(name, temp);
}
if (Math.abs(name.xVel) <= 0.3) {
name.xVel = 0;
}
} else if (name.xVel > name.xMax) {
if (mapHit.hitTest(_local2 + (name.xVel / 2), _local1 - (gravity * 2), true)) {
temp = (name.xVel / 2) - name.xAcc;
enemyBounceRight(name, temp);
} else if (mapHit.hitTest(_local2, _local1 - (gravity * 2), true)) {
temp = -name.xAcc;
enemyBounceRight(name, temp);
}
} else if (name.xVel < (-name.xMax)) {
if (mapHit.hitTest(_local2 + (name.xVel / 2), _local1 - (gravity * 2), true)) {
temp = (name.xVel / 2) + name.xAcc;
enemyBounceLeft(name, temp);
} else if (mapHit.hitTest(_local2, _local1 - (gravity * 2), true)) {
temp = name.xAcc;
enemyBounceLeft(name, temp);
}
}
}
name.mc._x = name.mc._x + name.xVel;
if (((name.xVel != 0) && (!Key.isDown(name.keyLeft))) && (!Key.isDown(name.keyRight))) {
if ((!mapHit.hitTest(_local2, _local1, true)) && (mapHit.hitTest(_local2, _local1 + (gravity * 8), true))) {
temp = 0;
while ((temp < (gravity * 8)) && (!mapHit.hitTest(_local2, _local1 + temp, true))) {
temp = temp + gravity;
}
name.mc._y = name.mc._y + temp;
}
}
if (name.yVel > name.yMax) {
name.yVel = name.yMax;
}
if (!mapHit.hitTest(name.mc._x, (name.mc._y + gravity) + name.yVel, true)) {
if ((Math.abs(name.xVel) > 20) || (Math.abs(name.yVel) > 12)) {
name.mc.gotoAndStop("thrownBlur");
} else {
name.mc.gotoAndStop("thrown");
}
if (name.yVel > 20) {
if (!mapHit.hitTest(name.mc._x, (name.mc._y + gravity) + (name.yVel / 2), true)) {
name.yVel = name.yVel + gravity;
if (name.yVel > gravity) {
name.jumping = false;
}
if (!name.jumping) {
name.mc.gotoAndStop("fall");
}
} else {
enemy0HitGround(name);
name._y = name._y + (-gravity);
}
} else {
name.yVel = name.yVel + gravity;
if (name.yVel > gravity) {
name.jumping = false;
}
if (!name.jumping) {
name.mc.gotoAndStop("fall");
}
}
} else {
enemy0HitGround(name);
name.mc.gotoAndStop("bouncing");
if (name.xVel == 0) {
if (!mapHit.hitTest(name.mc._x - 10, name.mc._y + 3, true)) {
name.xVel = name.yVel * 2;
} else if (!mapHit.hitTest(name.mc._x - 20, name.mc._y + 3, true)) {
name.xVel = name.yVel;
} else if (!mapHit.hitTest(name.mc._x - 40, name.mc._y + 3, true)) {
name.xVel = name.yVel / 2;
} else if (!mapHit.hitTest(name.mc._x + 10, name.mc._y + 3, true)) {
name.xVel = (-name.yVel) * 2;
} else if (!mapHit.hitTest(name.mc._x + 20, name.mc._y + 3, true)) {
name.xVel = -name.yVel;
} else if (!mapHit.hitTest(name.mc._x + 40, name.mc._y + 3, true)) {
name.xVel = (-name.yVel) / 2;
}
}
}
if (name.yVel < 0) {
if (mapHit.hitTest(name.mc._x, (name.mc._y - name.head) + name.yVel, true)) {
temp = name.yVel + gravity;
name.mc._y = name.mc._y + temp;
name.yVel = 0.001;
while (mapHit.hitTest(name.mc._x, (name.mc._y - name.head) + temp, true)) {
name.mc._y = name.mc._y + gravity;
temp = temp + gravity;
}
}
}
name.mc._y = name.mc._y + name.yVel;
if ((name.xVel == 0) && (name.yVel == 0)) {
name.state = 1;
if (thrownName == name) {
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) / 16);
} 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) / 16);
}
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(projectileName) {
name = this[projectileName];
switch (name.projType) {
case "fireball" :
if (name.state == "thrown") {
if (mapHit.hitTest(name.mc._x, name.mc._y, true)) {
name.mc.gotoAndStop("hit");
name.state = "hit";
name.modeCount = -123;
makeFX("fire", (name.mc._x - 16) + (Math.random() * 32), (name.mc._y - 8) + (Math.random() * 16));
makeFX("fire", (name.mc._x - 16) + (Math.random() * 32), (name.mc._y - 8) + (Math.random() * 16));
}
if (name.state == "thrown") {
name.mc.gotoAndStop("idle");
if ((((Math.abs(name.mc._x - p1.mc._x) < 250) && (Math.abs(name.mc._y - p1.mc._y) < 150)) && ((count % 4) == 0)) && (Math.random() > 0.5)) {
makeFX("fire", name.mc._x, (name.mc._y - 7) + (Math.random() * 14));
}
if (name.xVel > name.xMax) {
name.xVel = name.xMax + ((name.xMax - name.xVel) / 8);
} else if (name.xVel < (-name.xMax)) {
name.xVel = (-name.xMax) + ((name.xVel + name.xMax) / 8);
}
name.mc._x = name.mc._x + name.xVel;
if (name.ySpec > 0) {
name.ySpec--;
}
if (name.ySpec <= 0) {
if (name.yVel > name.yMax) {
name.yVel = name.yMax;
} else if (name.yVel < (-name.yMax)) {
name.yVel = -name.yMax;
}
}
name.mc._y = name.mc._y + name.yVel;
if ((Math.abs(name.mc._x - p1.mc._x) > 350) || (Math.abs(name.mc._y - p1.mc._y) > 250)) {
name.state = "dead";
name.mc._visible = false;
}
}
} else if (name.state == "hit") {
if (name.modeCount == -123) {
name.modeCount = 13;
name.mc._rotation = -30 + (Math.random() * 60);
}
name.modeCount--;
name.mc.gotoAndStop("hit");
if (name.modeCount <= 0) {
name.state = "dead";
name.mc._visible = false;
}
}
return;
case "wind" :
if (name.state == "thrown") {
name.life--;
if (name.life <= 0) {
name.modeCount = 8;
name.state = "hit";
name.mc.gotoAndStop("die");
}
if (mapHit.hitTest(name.mc._x, name.mc._y, true)) {
temp = false;
if ((name.yVel > 0) && (mapHit.hitTest(name.mc._x + name.xVel, name.mc._y - name.yMax, true))) {
name.xVel = -name.xVel;
name.mc._rotation = -name.mc._rotation;
temp = true;
} else if ((name.yVel < 0) && (mapHit.hitTest(name.mc._x + name.xVel, name.mc._y + name.yMax, true))) {
name.xVel = -name.xVel;
name.mc._rotation = -name.mc._rotation;
temp = true;
}
if ((name.xVel > 0) && (mapHit.hitTest(name.mc._x - name.xMax, name.mc._y + name.yVel, true))) {
name.yVel = -name.yVel;
name.mc._rotation = -name.mc._rotation;
temp = true;
} else if ((name.xVel < 0) && (mapHit.hitTest(name.mc._x + name.xMax, name.mc._y + name.yVel, true))) {
name.yVel = -name.yVel;
name.mc._rotation = -name.mc._rotation;
temp = true;
}
name.mc._x = name.mc._x + name.xVel;
name.mc._y = name.mc._y + name.yVel;
if (temp) {
soundFX.attachSound("s_windbounce");
soundFX.start(0, 0);
soundFX.setPan(Math.ceil(((name.mc._x - mcCam._x) / 400) * 100));
}
}
if (name.state == "thrown") {
name.mc.gotoAndStop("idle");
if (name.xVel > name.xMax) {
name.xVel = name.xMax + ((name.xMax - name.xVel) / 8);
} else if (name.xVel < (-name.xMax)) {
name.xVel = (-name.xMax) + ((name.xVel + name.xMax) / 8);
}
name.mc._x = name.mc._x + name.xVel;
if (((name.xVel != 0) && (!Key.isDown(name.keyLeft))) && (!Key.isDown(name.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;
}
name.mc._y = name.mc._y + temp;
}
}
if (name.ySpec > 0) {
name.ySpec--;
}
if (name.ySpec <= 0) {
if (name.yVel > name.yMax) {
name.yVel = name.yMax;
} else if (name.yVel < (-name.yMax)) {
name.yVel = -name.yMax;
}
}
name.mc._y = name.mc._y + name.yVel;
if ((Math.abs(name.mc._x - p1.mc._x) > 350) || (Math.abs(name.mc._y - p1.mc._y) > 250)) {
name.state = "dead";
name.mc._visible = false;
}
}
} else if (name.state == "hit") {
if (name.modeCount == -123) {
name.modeCount = 10;
}
name.modeCount--;
if (name.modeCount <= 0) {
name.state = "dead";
name.mc._visible = false;
}
}
return;
case "lightning" :
if (name.state == "thrown") {
name.life--;
if (name.life <= 0) {
name.state = "hit";
}
if (mapHit.hitTest(name.mc._x, name.mc._y, true)) {
name.mc.gotoAndStop("die");
name.state = "hit";
name.modeCount = 8;
}
if (name.state == "thrown") {
name.mc._x = name.mc._x + name.xVel;
if (name.ySpec <= 0) {
if (name.yVel > name.yMax) {
name.yVel = name.yMax;
} else if (name.yVel < (-name.yMax)) {
name.yVel = -name.yMax;
}
}
name.mc._y = name.mc._y + name.yVel;
if ((Math.abs(name.mc._x - p1.mc._x) > 350) || (Math.abs(name.mc._y - p1.mc._y) > 250)) {
name.state = "dead";
name.mc._visible = false;
}
}
} else {
if (name.state != "hit") {
break;
}
if (name.modeCount == -123) {
name.modeCount = 13;
name.mc._rotation = -30 + (Math.random() * 60);
}
name.modeCount--;
if (name.modeCount > 0) {
break;
}
name.state = "dead";
name.mc._visible = false;
}
}
}
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(torchName, rot) {
var _local2 = torchName;
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(staffName, direction, hitTarget, xSpeed) {
var _local2 = this;
var _local3 = staffName;
_local3.mc.mcMC.mcFX.gotoAndStop(_local3.element);
shakeCam = shakeCam + 3;
var _local1 = projectiles;
temp = 1;
while (temp <= projectiles) {
temp2 = "proj_" + temp;
if ((!_local2[temp2].mc._visible) || (_local2[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];
if (_local3.mc._xscale > 0) {
}
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 = "proj_" + i;
if ((!_local2[j].mc._visible) || (_local2[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 = "proj_" + i;
if ((!_local2[j].mc._visible) || (_local2[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 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:-2750, _y:-130});
p1 = new player1(mcAll.mcMain.mcP1);
mcCam._x = p1.mc._x;
mcCam._y = p1.mc._y;
for (temp3 in mcAll.mcMain) {
if (typeof(mcAll.mcMain[temp3]) == "movieclip") {
if (mcAll.mcMain[temp3].enemyType == "hoodley") {
enemies++;
mcAll.mcMain.attachMovie("enemy1", "enemy1_mc_" + enemies, enemyDepth + (enemies * 10), {_x:mcAll.mcMain[temp3]._x, _y:mcAll.mcMain[temp3]._y});
_local1["enemy1_" + enemies] = new enemy1(mcAll.mcMain["enemy1_mc_" + enemies]);
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].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);
gameloaded = 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;
name = "";
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;
introDone = false;
_root.attachMovie("menu", "mcMenu", 888889, {_x:350, _y:200});
bossCount = 0;
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 (introDone) {
introDone = false;
loadGame();
}
if (gameloaded) {
if (!paused) {
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(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;
}
mcCam.debugText2.text = "Music, now playing: " + soundArray[0];
mcCam.debugText1.text = "Wink: the Game v0.75";
};
Instance of Symbol 1577 MovieClip [enemy1] in Frame 2
onClipEvent (load) {
this._visible = false;
}
Instance of Symbol 1026 MovieClip [player_wink] in Frame 2
onClipEvent (load) {
this._visible = false;
}
Instance of Symbol 1615 MovieClip in Frame 2
onClipEvent (load) {
this._visible = false;
}
Instance of Symbol 1661 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 172 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 175 Button
on (release) {
mcControls._visible = false;
}
Symbol 178 Button
on (release) {
mcControls._visible = true;
}
Symbol 181 Button
on (release) {
mcControls._visible = false;
}
Symbol 218 MovieClip [menu] Frame 1
mcControls._visible = false;
Symbol 222 MovieClip Frame 9
if (Math.random() > 0.8) {
gotoAndPlay ("blink");
} else {
gotoAndPlay ("idle");
}
Symbol 222 MovieClip Frame 19
gotoAndPlay ("idle");
Symbol 223 MovieClip Frame 9
Symbol 227 MovieClip Frame 3
_parent.gotoAndStop("walk");
Symbol 231 MovieClip Frame 3
Symbol 261 MovieClip Frame 30
gotoAndPlay ("loop");
Symbol 278 MovieClip Frame 19
if (Math.random() > 0.5) {
gotoAndPlay ("moveDown");
} else {
gotoAndPlay ("up");
}
Symbol 278 MovieClip Frame 49
if (Math.random() > 0.5) {
gotoAndPlay ("moveUp");
} else {
gotoAndPlay ("down");
}
Symbol 287 MovieClip Frame 8
_parent.gotoAndStop("crouched");
Symbol 290 MovieClip Frame 5
_parent.gotoAndStop("crouched");
Symbol 309 MovieClip Frame 37
gotoAndPlay ("loop");
Symbol 319 MovieClip Frame 9
_parent.gotoAndStop("fall");
Symbol 331 MovieClip Frame 17
_parent.gotoAndStop("fall");
Symbol 353 MovieClip Frame 11
stop();
Symbol 367 MovieClip Frame 11
_parent.gotoAndStop("stuck");
Symbol 395 MovieClip Frame 38
if (Math.random() > 0.6) {
gotoAndPlay ("move");
} else {
gotoAndPlay ("idle");
}
Symbol 395 MovieClip Frame 64
if (Math.random() > 0.8) {
gotoAndPlay ("moveBack");
} else {
gotoAndPlay ("moved");
}
Symbol 395 MovieClip Frame 78
gotoAndPlay ("idle");
Symbol 399 MovieClip Frame 5
_parent.gotoAndStop("stuck");
Symbol 411 MovieClip Frame 25
gotoAndPlay ("loop");
Symbol 424 MovieClip Frame 25
gotoAndPlay ("loop");
Symbol 427 MovieClip Frame 5
_parent.gotoAndStop("fall");
Symbol 455 MovieClip Frame 17
_parent.gotoAndStop("shadowIdle");
Symbol 463 MovieClip Frame 17
_parent.gotoAndStop("shadowIdle");
Symbol 465 MovieClip Frame 9
if (Math.random() > 0.8) {
gotoAndPlay ("blink");
} else {
gotoAndPlay ("idle");
}
Symbol 465 MovieClip Frame 19
gotoAndPlay ("idle");
Symbol 470 MovieClip Frame 2
_parent.gotoAndStop("shadowIdle");
Symbol 476 MovieClip Frame 3
_parent.gotoAndStop("shadowIdle");
Symbol 493 MovieClip Frame 10
gotoAndPlay ("loop");
Symbol 500 MovieClip Frame 11
_parent.gotoAndStop("wallsliding");
Symbol 511 MovieClip Frame 14
_parent.gotoAndStop("fall");
Symbol 515 MovieClip Frame 4
_parent.gotoAndStop("dashLoop");
Symbol 535 MovieClip Frame 10
stop();
Symbol 552 MovieClip Frame 27
_parent.gotoAndStop("fall");
Symbol 634 MovieClip Frame 21
gotoAndPlay ("loop");
Symbol 661 MovieClip Frame 24
_parent.gotoAndStop("idle");
Symbol 671 MovieClip Frame 11
_parent.gotoAndStop("grabbingIdle");
Symbol 687 MovieClip Frame 24
_parent.gotoAndStop("idle");
Symbol 702 MovieClip Frame 16
_parent.gotoAndStop("fall");
Symbol 716 MovieClip Frame 15
_parent.gotoAndStop("crouched");
Symbol 722 MovieClip Frame 20
stop();
Symbol 778 MovieClip Frame 17
_parent.gotoAndStop("walk");
Symbol 788 MovieClip Frame 30
stop();
Symbol 789 MovieClip Frame 30
stop();
Symbol 790 MovieClip Frame 30
stop();
Symbol 791 MovieClip Frame 30
stop();
Symbol 798 MovieClip Frame 12
stop();
Symbol 807 MovieClip Frame 14
stop();
Symbol 815 MovieClip Frame 20
stop();
Symbol 826 MovieClip Frame 11
_parent.gotoAndStop("crouched");
Symbol 829 MovieClip Frame 30
stop();
Symbol 833 MovieClip Frame 7
_parent.gotoAndStop("wallsliding");
Symbol 853 MovieClip Frame 20
gotoAndStop ("loop");
Symbol 864 MovieClip Frame 10
stop();
Symbol 874 MovieClip Frame 12
_parent.gotoAndStop("idle");
Symbol 880 MovieClip Frame 10
stop();
Symbol 890 MovieClip Frame 16
_parent.gotoAndStop("fall");
Symbol 920 MovieClip Frame 7
_parent.gotoAndStop("crouched");
Symbol 928 MovieClip Frame 10
_parent.gotoAndStop("crouched");
Symbol 945 MovieClip Frame 10
_parent.gotoAndStop("idle");
Symbol 957 MovieClip Frame 11
_parent.gotoAndStop("idle");
Symbol 969 MovieClip Frame 14
_parent.gotoAndStop("fall");
Symbol 980 MovieClip Frame 14
_parent.gotoAndStop("fall");
Symbol 990 MovieClip Frame 10
_parent.gotoAndStop("fall");
Symbol 1010 MovieClip Frame 19
stop();
Symbol 1025 MovieClip Frame 14
stop();
Symbol 1026 MovieClip [player_wink] Frame 1
stop();
Symbol 1026 MovieClip [player_wink] Frame 7
stop();
Symbol 1026 MovieClip [player_wink] Frame 19
stop();
Symbol 1026 MovieClip [player_wink] Frame 25
stop();
Symbol 1026 MovieClip [player_wink] Frame 34
stop();
Symbol 1026 MovieClip [player_wink] Frame 42
stop();
Symbol 1026 MovieClip [player_wink] Frame 50
stop();
Symbol 1026 MovieClip [player_wink] Frame 60
stop();
Symbol 1026 MovieClip [player_wink] Frame 68
stop();
Symbol 1026 MovieClip [player_wink] Frame 78
stop();
Symbol 1026 MovieClip [player_wink] Frame 84
stop();
Symbol 1026 MovieClip [player_wink] Frame 137
stop();
Symbol 1026 MovieClip [player_wink] Frame 164
stop();
Symbol 1026 MovieClip [player_wink] Frame 174
stop();
Symbol 1026 MovieClip [player_wink] Frame 196
stop();
Symbol 1026 MovieClip [player_wink] Frame 207
stop();
Symbol 1026 MovieClip [player_wink] Frame 217
stop();
Symbol 1026 MovieClip [player_wink] Frame 227
stop();
Symbol 1026 MovieClip [player_wink] Frame 237
stop();
Symbol 1026 MovieClip [player_wink] Frame 247
stop();
Symbol 1026 MovieClip [player_wink] Frame 257
stop();
Symbol 1026 MovieClip [player_wink] Frame 266
stop();
Symbol 1026 MovieClip [player_wink] Frame 275
stop();
Symbol 1026 MovieClip [player_wink] Frame 297
stop();
Symbol 1026 MovieClip [player_wink] Frame 309
stop();
Symbol 1026 MovieClip [player_wink] Frame 321
stop();
Symbol 1026 MovieClip [player_wink] Frame 329
stop();
Symbol 1026 MovieClip [player_wink] Frame 341
stop();
Symbol 1026 MovieClip [player_wink] Frame 350
stop();
Symbol 1026 MovieClip [player_wink] Frame 358
stop();
Symbol 1026 MovieClip [player_wink] Frame 368
stop();
Symbol 1026 MovieClip [player_wink] Frame 381
stop();
Symbol 1026 MovieClip [player_wink] Frame 391
stop();
Symbol 1026 MovieClip [player_wink] Frame 411
stop();
Symbol 1026 MovieClip [player_wink] Frame 425
stop();
Symbol 1026 MovieClip [player_wink] Frame 436
stop();
Symbol 1026 MovieClip [player_wink] Frame 447
stop();
Symbol 1026 MovieClip [player_wink] Frame 462
stop();
Symbol 1026 MovieClip [player_wink] Frame 475
stop();
Symbol 1026 MovieClip [player_wink] Frame 490
stop();
Symbol 1026 MovieClip [player_wink] Frame 505
stop();
Symbol 1026 MovieClip [player_wink] Frame 515
stop();
Symbol 1026 MovieClip [player_wink] Frame 525
stop();
Symbol 1026 MovieClip [player_wink] Frame 535
stop();
Symbol 1026 MovieClip [player_wink] Frame 545
stop();
Symbol 1026 MovieClip [player_wink] Frame 555
stop();
Symbol 1026 MovieClip [player_wink] Frame 571
stop();
Symbol 1026 MovieClip [player_wink] Frame 582
stop();
Symbol 1026 MovieClip [player_wink] Frame 599
stop();
Symbol 1026 MovieClip [player_wink] Frame 642
stop();
Symbol 1026 MovieClip [player_wink] Frame 673
stop();
Symbol 1026 MovieClip [player_wink] Frame 682
stop();
Symbol 1026 MovieClip [player_wink] Frame 688
stop();
Symbol 1026 MovieClip [player_wink] Frame 698
stop();
Symbol 1026 MovieClip [player_wink] Frame 704
stop();
Instance of Symbol 1041 MovieClip in Symbol 1042 MovieClip Frame 1
onClipEvent (enterFrame) {
this._x = 0.6;
_width = ((_root.getBytesLoaded() / _root.getBytesTotal()) * 275);
}
Symbol 1045 MovieClip Frame 1
this.onRelease = function () {
getURL ("http://www.gamesofgondor.com", "_blank");
};
Instance of Symbol 1042 MovieClip in Symbol 1047 MovieClip Frame 1
on (release) {
if ((_root.getBytesLoaded() / _root.getBytesTotal()) == 1) {
_root.play();
}
}
Symbol 1064 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();
}
}
};
Object.registerClass("doorhit", DoorHitClass);
#endinitclip
Instance of Symbol 1064 MovieClip [doorhit] in Symbol 1066 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
element = "fire";
doorNum = 1;
bVertical = true;
}
Instance of Symbol 1064 MovieClip [doorhit] in Symbol 1066 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
element = "fire";
doorNum = 2;
bVertical = false;
}
Instance of Symbol 1064 MovieClip [doorhit] in Symbol 1066 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
element = "fire";
doorNum = 3;
bVertical = false;
}
Instance of Symbol 1064 MovieClip [doorhit] in Symbol 1066 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
element = "wind";
doorNum = 4;
bVertical = true;
}
Instance of Symbol 1064 MovieClip [doorhit] in Symbol 1066 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
element = "wind";
doorNum = 5;
bVertical = false;
}
Instance of Symbol 1064 MovieClip [doorhit] in Symbol 1066 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
element = "lightning";
doorNum = 6;
bVertical = false;
}
Instance of Symbol 1064 MovieClip [doorhit] in Symbol 1066 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
element = "fire";
doorNum = 7;
bVertical = false;
}
Instance of Symbol 1064 MovieClip [doorhit] in Symbol 1066 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
element = "lightning";
doorNum = 8;
bVertical = true;
}
Instance of Symbol 1064 MovieClip [doorhit] in Symbol 1066 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
element = "lightning";
doorNum = 9;
bVertical = false;
}
Instance of Symbol 2 MovieClip "mcBossBlock" in Symbol 1066 MovieClip Frame 1
onClipEvent (load) {
this._x = this._x + 1000;
}
Symbol 1131 MovieClip Frame 25
gotoAndPlay ("loop");
Symbol 1165 MovieClip Frame 30
stop();
this.done = true;
Instance of Symbol 1165 MovieClip in Symbol 1166 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 1165 MovieClip in Symbol 1166 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 1166 MovieClip in Symbol 1168 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 1171 MovieClip [enemySpawn] Frame 1
#initclip 1
function EnemyClass() {
this._visible = false;
}
EnemyClass.prototype = new MovieClip();
Object.registerClass("enemySpawn", EnemyClass);
#endinitclip
Instance of Symbol 1174 MovieClip in Symbol 1175 MovieClip Frame 1
onClipEvent (load) {
gotoAndPlay(Math.ceil(Math.random() * 20));
}
Symbol 1178 MovieClip Frame 16
stop();
Instance of Symbol 1174 MovieClip in Symbol 1179 MovieClip Frame 1
onClipEvent (load) {
gotoAndPlay(Math.ceil(Math.random() * 20));
}
Symbol 1181 MovieClip Frame 25
stop();
Symbol 1182 MovieClip [torch] Frame 1
#initclip 2
function TorchClass() {
}
TorchClass.prototype = new MovieClip();
Object.registerClass("torch", TorchClass);
#endinitclip
stop();
Instance of Symbol 1057 MovieClip "mcSky" in Symbol 1183 MovieClip Frame 1
/* no clip actions */
Instance of Symbol 2 MovieClip in Symbol 1183 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 1032 MovieClip [fire back] "firePartBack" in Symbol 1183 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 1030 MovieClip [fire] "firePart" in Symbol 1183 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 1028 MovieClip [fire white] "firePartWhite" in Symbol 1183 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 1171 MovieClip [enemySpawn] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "none";
}
Instance of Symbol 1171 MovieClip [enemySpawn] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "fire";
}
Instance of Symbol 1171 MovieClip [enemySpawn] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "none";
}
Instance of Symbol 1171 MovieClip [enemySpawn] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "none";
}
Instance of Symbol 1171 MovieClip [enemySpawn] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "fire";
}
Instance of Symbol 1171 MovieClip [enemySpawn] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "fire";
}
Instance of Symbol 1171 MovieClip [enemySpawn] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "none";
}
Instance of Symbol 1171 MovieClip [enemySpawn] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "none";
}
Instance of Symbol 1171 MovieClip [enemySpawn] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "fire";
}
Instance of Symbol 1171 MovieClip [enemySpawn] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "fire";
}
Instance of Symbol 1171 MovieClip [enemySpawn] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "fire";
}
Instance of Symbol 1171 MovieClip [enemySpawn] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "none";
}
Instance of Symbol 1171 MovieClip [enemySpawn] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "none";
}
Instance of Symbol 1171 MovieClip [enemySpawn] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "none";
}
Instance of Symbol 1171 MovieClip [enemySpawn] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "fire";
}
Instance of Symbol 1171 MovieClip [enemySpawn] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "none";
}
Instance of Symbol 1171 MovieClip [enemySpawn] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "fire";
}
Instance of Symbol 1171 MovieClip [enemySpawn] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "fire";
}
Instance of Symbol 1171 MovieClip [enemySpawn] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "wind";
}
Instance of Symbol 1171 MovieClip [enemySpawn] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "none";
}
Instance of Symbol 1171 MovieClip [enemySpawn] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "fire";
}
Instance of Symbol 1171 MovieClip [enemySpawn] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "wind";
}
Instance of Symbol 1171 MovieClip [enemySpawn] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "fire";
}
Instance of Symbol 1171 MovieClip [enemySpawn] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "none";
}
Instance of Symbol 1171 MovieClip [enemySpawn] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "none";
}
Instance of Symbol 1171 MovieClip [enemySpawn] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "wind";
}
Instance of Symbol 1171 MovieClip [enemySpawn] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "fire";
}
Instance of Symbol 1171 MovieClip [enemySpawn] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "wind";
}
Instance of Symbol 1171 MovieClip [enemySpawn] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "fire";
}
Instance of Symbol 1171 MovieClip [enemySpawn] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "wind";
}
Instance of Symbol 1171 MovieClip [enemySpawn] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "lightning";
}
Instance of Symbol 1171 MovieClip [enemySpawn] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "fire";
}
Instance of Symbol 1171 MovieClip [enemySpawn] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "wind";
}
Instance of Symbol 1171 MovieClip [enemySpawn] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "lightning";
}
Instance of Symbol 1171 MovieClip [enemySpawn] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "none";
}
Instance of Symbol 1171 MovieClip [enemySpawn] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "fire";
}
Instance of Symbol 1171 MovieClip [enemySpawn] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "fire";
}
Instance of Symbol 1171 MovieClip [enemySpawn] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "fire";
}
Instance of Symbol 1171 MovieClip [enemySpawn] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "fire";
}
Instance of Symbol 1171 MovieClip [enemySpawn] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "wind";
}
Instance of Symbol 1171 MovieClip [enemySpawn] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
enemyType = "hoodley";
staffType = "none";
}
Instance of Symbol 1182 MovieClip [torch] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
objType = "torch";
}
Instance of Symbol 1182 MovieClip [torch] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
objType = "torch";
}
Instance of Symbol 1182 MovieClip [torch] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
objType = "torch";
}
Instance of Symbol 1182 MovieClip [torch] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
objType = "torch";
}
Instance of Symbol 1182 MovieClip [torch] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
objType = "torch";
}
Instance of Symbol 1182 MovieClip [torch] in Symbol 1183 MovieClip Frame 1
//component parameters
onClipEvent (initialize) {
objType = "torch";
}
Symbol 1225 MovieClip Frame 12
gotoAndPlay ("loop");
Symbol 1255 MovieClip Frame 9
_parent.gotoAndStop("idle2");
Symbol 1268 MovieClip Frame 12
_parent.gotoAndStop("idle2");
Symbol 1298 MovieClip Frame 24
stop();
Symbol 1317 MovieClip Frame 24
stop();
Symbol 1335 MovieClip Frame 25
stop();
Symbol 1369 MovieClip Frame 30
gotoAndPlay ("loop");
Symbol 1383 MovieClip Frame 21
gotoAndPlay ("loop");
Symbol 1444 MovieClip Frame 86
_parent.gotoAndStop("dead");
Symbol 1456 MovieClip Frame 5
stop();
Symbol 1474 MovieClip Frame 22
stop();
Symbol 1477 MovieClip Frame 3
stop();
Instance of Symbol 1476 MovieClip in Symbol 1477 MovieClip Frame 3
onClipEvent (load) {
this.gotoAndPlay(9);
}
Symbol 1489 MovieClip Frame 16
stop();
Symbol 1493 MovieClip Frame 11
stop();
Symbol 1509 MovieClip Frame 24
stop();
Instance of Symbol 1517 MovieClip in Symbol 1529 MovieClip Frame 1
onClipEvent (load) {
this.gotoAndPlay(6);
}
Instance of Symbol 1517 MovieClip in Symbol 1529 MovieClip Frame 1
onClipEvent (load) {
this.gotoAndPlay(1);
}
Instance of Symbol 1517 MovieClip in Symbol 1529 MovieClip Frame 1
onClipEvent (load) {
this.gotoAndPlay(3);
}
Instance of Symbol 1517 MovieClip in Symbol 1529 MovieClip Frame 1
onClipEvent (load) {
this.gotoAndPlay(8);
}
Instance of Symbol 1517 MovieClip in Symbol 1529 MovieClip Frame 3
onClipEvent (load) {
this.gotoAndPlay(8);
}
Instance of Symbol 1517 MovieClip in Symbol 1529 MovieClip Frame 3
onClipEvent (load) {
this.gotoAndPlay(3);
}
Instance of Symbol 1517 MovieClip in Symbol 1529 MovieClip Frame 3
onClipEvent (load) {
this.gotoAndPlay(5);
}
Instance of Symbol 1517 MovieClip in Symbol 1529 MovieClip Frame 3
onClipEvent (load) {
this.gotoAndPlay(10);
}
Symbol 1529 MovieClip Frame 11
gotoAndPlay ("loop");
Symbol 1558 MovieClip Frame 33
stop();
Symbol 1575 MovieClip Frame 17
stop();
Symbol 1577 MovieClip [enemy1] Frame 1
stop();
Symbol 1577 MovieClip [enemy1] Frame 19
stop();
Symbol 1577 MovieClip [enemy1] Frame 105
stop();
Symbol 1577 MovieClip [enemy1] Frame 145
stop();
Symbol 1577 MovieClip [enemy1] Frame 165
stop();
Symbol 1577 MovieClip [enemy1] Frame 175
stop();
Symbol 1577 MovieClip [enemy1] Frame 217
stop();
Symbol 1577 MovieClip [enemy1] Frame 227
stop();
Symbol 1577 MovieClip [enemy1] Frame 238
stop();
Symbol 1577 MovieClip [enemy1] Frame 252
stop();
Symbol 1615 MovieClip Frame 1
stop();
Symbol 1615 MovieClip Frame 2
stop();
Symbol 1632 MovieClip Frame 1
stop();
Symbol 1632 MovieClip Frame 850
stop();
Symbol 1634 MovieClip Frame 1
stop();
Symbol 1634 MovieClip Frame 106
stop();
_root.bossCount = 2;
this._visible = false;
Symbol 1639 Button
on (release) {
gotoAndPlay ("end");
}
Symbol 1645 MovieClip Frame 1
stop();
Symbol 1645 MovieClip Frame 978
_root.introDone = true;
Symbol 1645 MovieClip Frame 1028
stop();
this._visible = false;
Symbol 1655 Button
on (release) {
if (_quality == "LOW") {
_quality = "MEDIUM";
} else if (_quality == "MEDIUM") {
_quality = "HIGH";
} else if (_quality == "HIGH") {
_quality = "LOW";
}
}
Symbol 1660 Button
on (release) {
getURL ("http://www.gamesofgondor.com", "_blank");
}
Symbol 1661 MovieClip Frame 1
mcFrame._visible = false;
Instance of Symbol 1650 MovieClip "mcPaused" in Symbol 1661 MovieClip Frame 1
onClipEvent (load) {
this._visible = false;
}