Frame 1
function initialMusic() {
music = {};
music.currentMusic = "none";
music.menuLoop = new Sound();
music.menuLoop.attachSound("musicLoopMenu");
music.gameLoop = new Sound();
music.gameLoop.attachSound("musicLoopGame");
}
function initialSFX() {
sfx = {};
sfx.hit0 = new Sound();
sfx.hit0.attachSound("sfxHit0");
sfx.hit1 = new Sound();
sfx.hit1.attachSound("sfxHit1");
sfx.die = new Sound();
sfx.die.attachSound("sfxDie");
sfx.powerUpRollDown = new Sound();
sfx.powerUpRollDown.attachSound("sfxpowerUpRollDown");
sfx.powerUp = new Sound();
sfx.powerUp.attachSound("sfxPowerUp");
sfx.bound = new Sound();
sfx.bound.attachSound("sfxBound");
}
function playMusic(name) {
if (world.soundOn) {
if (music.currentMusic != "none") {
stopMusic(music.currentMusic);
}
music.currentMusic = name;
var _local1 = music[name];
_local1.start();
_local1.onSoundComplete = function () {
playMusic(music.currentMusic);
};
}
}
function stopMusic(name) {
music.currentMusic = "none";
var _local1 = music[name];
_local1.stop();
}
function playSFX(name) {
if (world.soundOn) {
var _local1 = sfx[name];
_local1.start();
}
}
function stopSFX(name) {
trace("stop sfx");
var _local1 = sfx[name];
_local1.stop();
}
ako.ako.text = String(22);
function initialVariables() {
world = {};
world.startlives = 3;
world.lives = world.startlives;
world.score = 0;
world.totalEnemiesKilled = 1000;
world.enemiesKilled = 0;
world.totalLevels = 25;
world.startLevel = 1;
world.currentLevel = world.startLevel;
world.speedUp = false;
world.extraHealth = false;
world.shootFaster = false;
world.soundOn = true;
}
funcHITBOX = function (arString) {
getURL (("javascript:_hbPageView ('/gamepad/play/games/1000zombies/game/" + arString) + "', '/')");
};
initialVariables();
initialMusic();
initialSFX();
Frame 2
function initialTitleButtons() {
play_btn.onRelease = function () {
world.enemiesKilled = 0;
_root.funcHITBOX("Play_game");
gotoAndPlay ("game");
};
instructions_btn.onRelease = function () {
_root.funcHITBOX("Instructions");
gotoAndPlay ("instructions");
};
enterCode_btn.onRelease = function () {
gotoAndPlay ("enterCode");
};
soundControl_btn.onRelease = function () {
if (world.soundOn) {
world.soundOn = false;
stopMusic(music.currentMusic);
this.gotoAndStop("off");
} else {
world.soundOn = true;
playMusic("menuLoop");
this.gotoAndStop("on");
}
};
}
function updateTitleMusic() {
if (music.currentMusic != "menuLoop") {
playMusic("menuLoop");
}
}
main = this;
Selection.setFocus("startLevel_txt");
updateTitleMusic();
initialTitleButtons();
Frame 10
stop();
Frame 11
function initialInstructionsButtons() {
play_btn.onRelease = function () {
world.enemiesKilled = 0;
_root.funcHITBOX("Play_from_Instructions");
gotoAndPlay ("game");
};
soundControl_btn.onRelease = function () {
if (world.soundOn) {
world.soundOn = false;
stopMusic(music.currentMusic);
this.gotoAndStop("off");
} else {
world.soundOn = true;
playMusic("menuLoop");
this.gotoAndStop("on");
}
};
}
initialInstructionsButtons();
Frame 20
stop();
Frame 21
function checkCheatCode(cheatCode) {
if (cheatCode == "pixiedust") {
world.speedUp = true;
world.extraHealth = false;
world.shootFaster = false;
_root.funcHITBOX("Code_pixiedust");
gotoAndPlay ("goodCode");
} else if (cheatCode == "superseeds") {
world.speedUp = false;
world.extraHealth = true;
world.shootFaster = false;
_root.funcHITBOX("Code_superseeds");
gotoAndPlay ("goodCode");
} else if (cheatCode == "tothemoon") {
world.speedUp = false;
world.extraHealth = false;
world.shootFaster = true;
_root.funcHITBOX("Code_tothemoon");
gotoAndPlay ("goodCode");
} else {
world.speedUp = false;
world.extraHealth = false;
world.shootFaster = false;
gotoAndPlay ("badCode");
}
}
function initialEnterCodeButtons() {
submit_btn.onRelease = function () {
var _local1 = cheatCode_txt.text.toLowerCase();
checkCheatCode(_local1);
};
back_btn.onRelease = function () {
gotoAndPlay ("title");
};
soundControl_btn.onRelease = function () {
if (world.soundOn) {
world.soundOn = false;
stopMusic(music.currentMusic);
this.gotoAndStop("off");
} else {
world.soundOn = true;
playMusic("menuLoop");
this.gotoAndStop("on");
}
};
}
Selection.setFocus("cheatCode_txt");
initialEnterCodeButtons();
Frame 30
stop();
Frame 40
gotoAndPlay ("enterCode");
Frame 50
gotoAndPlay ("game");
Frame 51
function initialLevelCompleteButtons() {
nextLevel_btn.onRelease = function () {
gotoAndPlay ("game");
};
soundControl_btn.onRelease = function () {
if (world.soundOn) {
world.soundOn = false;
stopMusic(music.currentMusic);
this.gotoAndStop("off");
} else {
world.soundOn = true;
playMusic("gameLoop");
this.gotoAndStop("on");
}
};
}
function showLevelCompleteStats() {
ako.ako.text = String(world.enemiesKilled);
bko.ako.text = String(world.totalEnemiesKilled - world.enemiesKilled);
}
initialLevelCompleteButtons();
showLevelCompleteStats();
Frame 60
stop();
Frame 61
function initialGameWinButtons() {
playAgain_btn.onRelease = function () {
_root.funcHITBOX("play_again");
world.score = 0;
world.enemiesKilled = 0;
world.lives = world.startlives;
world.currentLevel = world.startLevel;
world.speedUp = false;
world.extraHealth = false;
world.shootFaster = false;
gotoAndPlay ("title");
};
soundControl_btn.onRelease = function () {
if (world.soundOn) {
world.soundOn = false;
stopMusic(music.currentMusic);
this.gotoAndStop("off");
} else {
world.soundOn = true;
playMusic("gameLoop");
this.gotoAndStop("on");
}
};
}
initialGameWinButtons();
Frame 70
stop();
Frame 71
function initialGameOverButtons() {
playAgain_btn.onRelease = function () {
_root.funcHITBOX("play_again");
world.score = 0;
world.enemiesKilled = 0;
world.lives = world.startlives;
world.currentLevel = world.startLevel;
world.speedUp = false;
world.extraHealth = false;
world.shootFaster = false;
gotoAndPlay ("title");
};
soundControl_btn.onRelease = function () {
if (world.soundOn) {
world.soundOn = false;
stopMusic(music.currentMusic);
this.gotoAndStop("off");
} else {
world.soundOn = true;
playMusic("gameLoop");
this.gotoAndStop("on");
}
};
}
function showGameOverStats() {
trace(world.enemiesKilled);
if ((world.enemiesKilled == 0) || (world.enemiesKilled == undefined)) {
cko.ako.text = "0";
} else {
cko.ako.text = String(world.enemiesKilled);
}
}
initialGameOverButtons();
showGameOverStats();
Frame 80
stop();
Frame 81
function initialIsoWorld() {
iso = {};
iso.alpha = 0;
iso.theta = 45;
iso.alphaRad = (iso.alpha * Math.PI) / 180;
iso.thetaRad = (iso.theta * Math.PI) / 180;
iso.sinAlpha = Math.sin(iso.alphaRad);
iso.cosAlpha = Math.cos(iso.alphaRad);
iso.sinTheta = Math.sin(iso.thetaRad);
iso.cosTheta = Math.cos(iso.thetaRad);
}
function mapToScreen(xpp, ypp, zpp) {
var _local4 = iso.sinTheta;
var _local6 = iso.cosTheta;
var _local1 = iso.sinAlpha;
var _local2 = iso.cosAlpha;
var _local5 = ypp;
var _local7 = (xpp * _local2) + (zpp * _local1);
var _local3 = (zpp * _local2) - (xpp * _local1);
var _local9 = _local7;
var _local8 = (_local5 * _local6) - (_local3 * _local4);
return([_local9, _local8]);
}
function mapToIsoWorld(screenX, screenY) {
var _local4 = iso.sinTheta;
var _local7 = iso.cosTheta;
var _local1 = iso.sinAlpha;
var _local2 = iso.cosAlpha;
var _local3 = ((screenX / _local2) - (screenY / (_local1 * _local4))) * (1 / ((_local2 / _local1) + (_local1 / _local2)));
var _local5 = (1 / _local2) * (screenX - (_local3 * _local1));
return([_local5, _local3]);
}
function rearrangeItemClipsDepth() {
var _local1 = [];
var _local3 = player;
_local1.push(_local3);
var _local2 = 0;
while (_local2 < ball.item_array.length) {
_local3 = ball.item_array[_local2];
_local1.push(_local3);
_local2++;
}
_local2 = 0;
while (_local2 < enemy.item_array.length) {
_local3 = enemy.item_array[_local2];
_local1.push(_local3);
_local2++;
}
_local2 = 0;
while (_local2 < game.friends) {
_local3 = main["friend" + _local2];
_local1.push(_local3);
_local2++;
}
_local3 = player;
_local1.push(_local3);
_local1.sortOn("z", Array.DESCENDING | Array.NUMERIC);
_local2 = 0;
while (_local2 < _local1.length) {
_local3 = _local1[_local2];
_local3.clipDepth = depth.itemMin + _local2;
_local2++;
}
_local2 = 0;
while (_local2 < _local1.length) {
_local3 = _local1[_local2];
_local3.clip.swapDepths(_local3.clipDepth);
_local2++;
}
}
function checkCollision() {
checkBallsEnemiesCollision();
checkBallsPlayerCollision();
checkBallsPowerUpCollision();
}
function checkBallsEnemiesCollision() {
var _local8 = 0;
while (_local8 < ball.item_array.length) {
var _local1 = ball.item_array[_local8];
var _local5 = _local1.radius;
if (_local1.status == "fly") {
if (_local1.xmov > 0) {
var _local3 = 0;
while (_local3 < enemy.item_array.length) {
var _local2 = enemy.item_array[_local3];
if (((_local2.status == "normal") || (_local2.status == "readyThrow")) || (_local2.status == "throw")) {
var _local6 = Math.abs(_local1.x - _local2.x);
if (_local6 < _local5) {
var _local7 = Math.abs(_local1.z - _local2.z);
if (_local7 < _local5) {
var _local4 = random(1);
playSFX("hit" + _local4);
reduceEnemyHealth(_local2.id, _local1.strength, _local1);
explodeBall(_local1.id);
}
}
}
_local3++;
}
world.score = world.score + _local1.score;
}
}
_local8++;
}
}
function checkBallsPlayerCollision() {
var _local2 = 0;
while (_local2 < ball.item_array.length) {
var _local1 = ball.item_array[_local2];
var _local3 = _local1.radius;
if (_local1.status == "fly") {
if (_local1.xmov < 0) {
if (((player.status == "normal") || (player.status == "readyToThrow")) || (player.status == "throw")) {
var _local5 = Math.abs(_local1.x - player.x);
if (_local5 < _local3) {
var _local6 = Math.abs(_local1.z - player.z);
if (_local6 < _local3) {
if (player.powerUpType == "shield") {
playSFX("bound");
playerReflectBall(_local1.id);
} else {
var _local4 = random(1);
playSFX("hit" + _local4);
explodeBall(_local1.id);
reducePlayerHealth(_local1.strength);
}
}
}
}
}
}
_local2++;
}
}
function checkBallsPowerUpCollision() {
var _local2 = 0;
while (_local2 < ball.item_array.length) {
var _local1 = ball.item_array[_local2];
if (_local1.xmov > 0) {
if (powerUp.status == "roll") {
var _local3 = mapToScreen(_local1.x, _local1.y, _local1.z);
_local1.flashx = _local3[0];
_local1.flashy = _local3[1];
_local1.clip._x = _local1.flashx;
_local1.clip._y = _local1.flashy;
_local3 = mapToScreen(powerUp.x, powerUp.y, powerUp.z);
powerUp.flashx = _local3[0];
powerUp.flashy = _local3[1];
powerUp.clip._x = powerUp.flashx;
powerUp.clip._y = powerUp.flashy;
var _local6 = Math.abs(_local1.flashx - powerUp.flashx);
if (_local6 < powerUp.ballCollisionRadius) {
var _local5 = Math.abs(_local1.flashy - powerUp.flashy);
if (_local5 < powerUp.ballCollisionRadius) {
var _local4 = random(1);
playSFX("hit" + _local4);
playSFX("powerUp");
explodeBall(_local1.id);
explodePowerUp();
playerPowerUp();
}
}
}
}
_local2++;
}
}
function initialEnemyType() {
enemyType1 = {};
var _local1 = enemyType1;
_local1.type = 1;
_local1.shootType = "normal";
_local1.score = 5;
_local1.health = 5;
_local1.strength = 10;
_local1.speed = 2;
_local1.minX = 380;
_local1.maxX = 480;
_local1.minZ = -500;
_local1.maxZ = -170;
_local1.initX = 550;
_local1.initY = 0;
_local1.minFramesChangeDirection = 48;
_local1.maxFramesChangeDirection = 168;
_local1.clipNormalLastFrame = 22;
_local1.clipReadyThrowLastFrame = 38;
_local1.clipThrowLastFrame = 42;
_local1.clipMoveLastFrame = 56;
_local1.clipDownLastFrame = 85;
_local1.clipDeadLastFrame = 90;
_local1.minFramesPerThrow = 60;
_local1.maxFramesPerThrow = 120;
_local1.minThrowSpeed = 12;
_local1.maxThrowSpeed = 24;
_local1.minZThrowSpeed = 0;
_local1.maxZThrowSpeed = 0;
_local1.initThrowYSpeed = -1;
_local1.throwHeight = 60;
_local1.ballRadius = 35;
_local1.ballClipScale = 60;
enemyType2 = {};
_local1 = enemyType2;
_local1.shootType = "angle";
_local1.type = 2;
_local1.score = 10;
_local1.health = 5;
_local1.strength = 10;
_local1.speed = 1.5;
_local1.minX = 420;
_local1.maxX = 480;
_local1.minZ = -500;
_local1.maxZ = -170;
_local1.initX = 550;
_local1.initY = 0;
_local1.minFramesChangeDirection = 48;
_local1.maxFramesChangeDirection = 168;
_local1.clipNormalLastFrame = 20;
_local1.clipReadyThrowLastFrame = 36;
_local1.clipThrowLastFrame = 40;
_local1.clipMoveLastFrame = 54;
_local1.clipDownLastFrame = 83;
_local1.clipDeadLastFrame = 88;
_local1.minFramesPerThrow = 36;
_local1.maxFramesPerThrow = 48;
_local1.minThrowSpeed = 20;
_local1.maxThrowSpeed = 18;
_local1.minZThrowSpeed = -5;
_local1.maxZThrowSpeed = 5;
_local1.initThrowYSpeed = -2;
_local1.throwHeight = 40;
_local1.ballRadius = 35;
_local1.ballClipScale = 50;
enemyType3 = {};
_local1 = enemyType3;
_local1.type = 3;
_local1.shootType = "normal";
_local1.score = 15;
_local1.health = 5;
_local1.strength = 20;
_local1.speed = 4;
_local1.minX = 380;
_local1.maxX = 480;
_local1.minZ = -500;
_local1.maxZ = -170;
_local1.initX = 550;
_local1.initY = 0;
_local1.minFramesChangeDirection = 48;
_local1.maxFramesChangeDirection = 168;
_local1.clipNormalLastFrame = 22;
_local1.clipReadyThrowLastFrame = 38;
_local1.clipThrowLastFrame = 42;
_local1.clipMoveLastFrame = 56;
_local1.clipDownLastFrame = 85;
_local1.clipDeadLastFrame = 90;
_local1.minFramesPerThrow = 36;
_local1.maxFramesPerThrow = 72;
_local1.minThrowSpeed = 18;
_local1.maxThrowSpeed = 30;
_local1.minZThrowSpeed = 0;
_local1.maxZThrowSpeed = 0;
_local1.initThrowYSpeed = -1;
_local1.throwHeight = 60;
_local1.ballRadius = 35;
_local1.ballClipScale = 60;
enemyType4 = {};
_local1 = enemyType4;
_local1.type = 4;
_local1.shootType = "double";
_local1.score = 20;
_local1.health = 5;
_local1.strength = 10;
_local1.speed = 2;
_local1.minX = 380;
_local1.maxX = 480;
_local1.minZ = -480;
_local1.maxZ = -170;
_local1.initX = 550;
_local1.initY = 0;
_local1.minFramesChangeDirection = 48;
_local1.maxFramesChangeDirection = 168;
_local1.clipNormalLastFrame = 22;
_local1.clipReadyThrowLastFrame = 38;
_local1.clipThrowLastFrame = 42;
_local1.clipMoveLastFrame = 56;
_local1.clipDownLastFrame = 85;
_local1.clipDeadLastFrame = 90;
_local1.minFramesPerThrow = 60;
_local1.maxFramesPerThrow = 120;
_local1.minThrowSpeed = 12;
_local1.maxThrowSpeed = 24;
_local1.minZThrowSpeed = -5;
_local1.maxZThrowSpeed = 5;
_local1.initThrowYSpeed = -1;
_local1.throwHeight = 60;
_local1.ballRadius = 35;
_local1.ballClipScale = 60;
}
function loadEnemies(level) {
var _local8 = main["level" + level];
var _local2 = 0;
while (_local2 < _local8.enemy_array.length) {
var _local3 = _local8.enemy_array[_local2];
var _local1 = main["enemyType" + _local3.type];
var _local9 = Math.round(_local1.maxX - _local1.minX);
var _local4 = Math.round(_local1.maxZ - _local1.minZ);
var _local7 = _local1.initX;
var _local6 = _local1.initY;
var _local5 = _local1.minZ + random(_local4);
createEnemy(_local7, _local6, _local5, _local3.type);
_local2++;
}
}
function checkCreateEnemies() {
var _local4 = main["level" + world.currentLevel];
var _local2 = 0;
while (_local2 < _local4.enemy_array.length) {
var _local3 = _local4.enemy_array[_local2];
if (game.frames >= _local3.frame) {
var _local5 = enemy.item_array.length;
if (_local5 < _local4.maxZombiesOnScreen) {
var _local1 = main["enemyType" + _local3.type];
var _local10 = Math.round(_local1.maxX - _local1.minX);
var _local6 = Math.round(_local1.maxZ - _local1.minZ);
var _local9 = _local1.initX;
var _local8 = _local1.initY;
var _local7 = _local1.minZ + random(_local6);
createEnemy(_local9, _local8, _local7, _local3.type);
_local4.enemy_array.splice(_local2, 1);
}
}
_local2++;
}
}
function createEnemy(x, y, z, type) {
var _local3 = enemy.currentId;
var _local2 = main["enemyType" + type];
var _local1 = {};
_local1.id = _local3;
_local1.shootType = _local2.shootType;
_local1.score = _local2.score;
_local1.minX = _local2.minX;
_local1.maxX = _local2.maxX;
_local1.minZ = _local2.minZ;
_local1.maxZ = _local2.maxZ;
_local1.speed = _local2.speed;
_local1.health = _local2.health;
_local1.minFramesChangeDirection = _local2.minFramesChangeDirection;
_local1.maxFramesChangeDirection = _local2.maxFramesChangeDirection;
_local1.clipReadyThrowLastFrame = _local2.clipReadyThrowLastFrame;
_local1.clipThrowLastFrame = _local2.clipThrowLastFrame;
_local1.clipDownLastFrame = _local2.clipDownLastFrame;
_local1.clipDeadLastFrame = _local2.clipDeadLastFrame;
_local1.minFramesPerThrow = _local2.minFramesPerThrow;
_local1.maxFramesPerThrow = _local2.maxFramesPerThrow;
_local1.minThrowSpeed = _local2.minThrowSpeed;
_local1.maxThrowSpeed = _local2.maxThrowSpeed;
_local1.minZThrowSpeed = _local2.minZThrowSpeed;
_local1.maxZThrowSpeed = _local2.maxZThrowSpeed;
_local1.initThrowYSpeed = _local2.initThrowYSpeed;
_local1.throwHeight = _local2.throwHeight;
_local1.strength = _local2.strength;
_local1.ballRadius = _local2.ballRadius;
_local1.ballClipScale = _local2.ballClipScale;
_local1.targetx = x;
_local1.targetz = z;
_local1.xmov = 0;
_local1.ymov = 0;
_local1.zmov = 0;
_local1.x = x;
_local1.y = y;
_local1.z = z;
enmey_obj.clipDepth = depth.itemInit;
_local1.nextMoveFrame = 0;
_local1.nextThrowFrame = 0;
_local1.type = type;
_local1.status = "normal";
_local1.moveStatus = "rest";
_local1.nextClipLabel = "normal";
var _local6 = "enemy" + type;
var _local7 = ("enemy" + _local3) + "_mc";
var _local4 = depth.itemInit;
_local1.clip = field.clip.attachMovie(_local6, _local7, _local4);
_local1.animationClip = _local1.clip.animation_mc;
enmey_obj.clipDepth = _local4;
var _local5 = mapToScreen(_local1.x, _local1.y, _local1.z);
_local1.flashx = _local5[0];
_local1.flashy = _local5[1];
_local1.clip._x = _local1.flashx;
_local1.clip._y = _local1.flashy;
enemy.item_array.push(_local1);
setNextThrowFrame(_local3);
setEnemyNewTarget(_local3);
enemy.currentId++;
if (enemy.currentId > enemy.maxId) {
enemy.currentId = 0;
}
rearrangeItemClipsDepth();
}
function readyToRemoveEnemy(id) {
var _local1 = 0;
while (_local1 < enemy.item_array.length) {
var _local2 = enemy.item_array[_local1];
if (_local2.id == id) {
_local2.status = "readyToRemoved";
}
_local1++;
}
}
function removeAllEnemies() {
var _local1 = 0;
while (_local1 < enemy.item_array.length) {
removeEnemy(_local1);
_local1++;
}
}
function removeEnemy(id) {
var _local2 = 0;
while (_local2 < enemy.item_array.length) {
var _local1 = enemy.item_array[_local2];
if (_local1.id == id) {
_local1.status = "removed";
_local1.clip.removeMovieClip();
enemy.item_array.splice(_local2, 1);
_local1 = {};
}
_local2++;
}
}
function setNextThrowFrame(id) {
var _local2 = 0;
while (_local2 < enemy.item_array.length) {
var _local1 = enemy.item_array[_local2];
if (_local1.id == id) {
var _local3 = _local1.maxFramesPerThrow - _local1.minFramesPerThrow;
_local1.nextThrowFrame = game.frames + random(_local3);
}
_local2++;
}
}
function setEnemyNextMoveFrame(id) {
var _local2 = 0;
while (_local2 < enemy.item_array.length) {
var _local1 = enemy.item_array[_local2];
if (_local1.id == id) {
var _local3 = _local1.maxFramesChangeDirection - _local1.minFramesChangeDirection;
var _local4 = _local1.minFramesChangeDirection + random(_local3);
_local1.nextMoveFrame = game.frames + _local4;
}
_local2++;
}
}
function setEnemyNewTarget(id) {
var _local2 = 0;
while (_local2 < enemy.item_array.length) {
var _local1 = enemy.item_array[_local2];
if (_local1.id == id) {
var _local3 = Math.round(_local1.maxX - _local1.minX);
var _local5 = _local1.minX + random(_local3);
var _local6 = Math.round(_local1.maxZ - _local1.minZ);
var _local4 = _local1.minZ + random(_local6);
_local1.targetx = _local5;
_local1.targetz = _local4;
}
_local2++;
}
}
function enemyMoveToTarget(id) {
var _local2 = 0;
while (_local2 < enemy.item_array.length) {
var _local1 = enemy.item_array[_local2];
if (_local1.id == id) {
var _local3 = _local1.targetx - _local1.x;
var _local4 = _local1.targetz - _local1.z;
var _local5 = Math.sqrt((_local3 * _local3) + (_local4 * _local4));
_local1.xmov = (_local3 / _local5) * _local1.speed;
_local1.zmov = (_local4 / _local5) * _local1.speed;
_local1.moveStatus = "move";
if (_local1.xmov <= 0) {
_local1.clip._xscale = 100;
} else {
_local1.clip._xscale = -100;
}
_local1.nextClipLabel = "move";
}
_local2++;
}
}
function reduceEnemyHealth(id, damage, ball_obj) {
var _local2 = 0;
while (_local2 < enemy.item_array.length) {
var _local1 = enemy.item_array[_local2];
if (_local1.id == id) {
_local1.health = _local1.health - damage;
if (_local1.health <= 0) {
playSFX("die");
world.enemiesKilled++;
game.levelEnemiesKilled++;
ball_obj.score = ball_obj.score + (ball_obj.score + _local1.score);
_local1.status = "dead";
_local1.nextClipLabel = "dead";
} else {
_local1.status = "down";
_local1.nextClipLabel = "down";
}
}
_local2++;
}
}
function enemyStop(id) {
var _local2 = 0;
while (_local2 < enemy.item_array.length) {
var _local1 = enemy.item_array[_local2];
if (_local1.id == id) {
_local1.xmov = 0;
_local1.zmov = 0;
_local1.moveStatus = "rest";
_local1.nextClipLabel = "normal";
}
_local2++;
}
}
function enemyBackToNormal(id) {
var _local2 = 0;
while (_local2 < enemy.item_array.length) {
var _local1 = enemy.item_array[_local2];
if (_local1.id == id) {
_local1.status = "normal";
_local1.nextClipLabel = "normal";
}
_local2++;
}
}
function enemyReadyThrowBall(id) {
var _local2 = 0;
while (_local2 < enemy.item_array.length) {
var _local1 = enemy.item_array[_local2];
if (_local1.id == id) {
_local1.status = "readyThrow";
_local1.clip._xscale = 100;
_local1.nextClipLabel = "readyToThrow";
}
_local2++;
}
}
function enemyThrowBall(id) {
var _local7 = 0;
while (_local7 < enemy.item_array.length) {
var _local1 = enemy.item_array[_local7];
if (_local1.id == id) {
var _local5 = _local1.x;
var _local3 = _local1.y - _local1.throwHeight;
var _local2 = _local1.z;
var _local10 = _local1.maxThrowSpeed - _local1.minThrowSpeed;
var _local4 = -(_local1.minThrowSpeed + random(_local10));
var _local6 = _local1.initThrowYSpeed;
_local1.status = "throw";
_local1.nextClipLabel = "throw";
if (_local1.shootType == "normal") {
var _local12 = 0;
createBall(_local5, _local3, _local2, _local4, _local6, 0, _local1.strength, _local1.ballRadius, _local1.ballClipScale, 1);
} else if (_local1.shootType == "angle") {
var _local11 = _local1.maxZThrowSpeed - _local1.minZThrowSpeed;
var _local12 = _local1.minZThrowSpeed + random(_local11);
createBall(_local5, _local3, _local2, _local4, _local6, _local12, _local1.strength, _local1.ballRadius, _local1.ballClipScale, 1);
} else if (_local1.shootType == "double") {
var _local12 = 0;
createBall(_local5, _local3, _local2, _local4, _local6, 0, _local1.strength, _local1.ballRadius, _local1.ballClipScale, 1);
var _local9 = _local1.maxZThrowSpeed - _local1.minZThrowSpeed;
var _local8 = _local1.minZThrowSpeed + random(_local9);
createBall(_local5, _local3, _local2, _local4, _local6, _local8, _local1.strength, _local1.ballRadius, _local1.ballClipScale, 1);
}
}
_local7++;
}
}
function checkRemoveEnemies() {
var _local1 = 0;
while (_local1 < enemy.item_array.length) {
var _local2 = enemy.item_array[_local1];
if (_local2.status == "readyToRemoved") {
removeEnemy(_local2.id);
}
_local1++;
}
}
function isNoEnemiesLeft() {
var _local1 = main["level" + world.currentLevel];
_local1.enemy_array;
return((_local1.enemy_array.length == 0) && (enemy.item_array.length == 0));
}
function updateEnemies() {
var _local2 = 0;
while (_local2 < enemy.item_array.length) {
var _local1 = enemy.item_array[_local2];
if (_local1.status == "normal") {
if (_local1.moveStatus == "rest") {
if (game.frames > _local1.nextMoveFrame) {
setEnemyNewTarget(_local1.id);
enemyMoveToTarget(_local1.id);
} else if (game.frames > _local1.nextThrowFrame) {
enemyReadyThrowBall(_local1.id);
}
} else if (_local1.moveStatus == "move") {
_local1.x = _local1.x + _local1.xmov;
_local1.y = _local1.y + _local1.ymov;
_local1.z = _local1.z + _local1.zmov;
if (_local1.xmov == 0) {
if (_local1.zmov == 0) {
enemyStop(_local1.id);
setEnemyNextMoveFrame(_local1.id);
} else if (_local1.zmov > 0) {
if (_local1.z > _local1.targetz) {
enemyStop(_local1.id);
setEnemyNextMoveFrame(_local1.id);
}
} else if (_local1.z < _local1.targetz) {
enemyStop(_local1.id);
setEnemyNextMoveFrame(_local1.id);
}
} else if (_local1.xmov > 0) {
if (_local1.x > _local1.targetx) {
_local1.x = _local1.targetx;
enemyStop(_local1.id);
setEnemyNextMoveFrame(_local1.id);
}
} else if (_local1.x < _local1.targetx) {
_local1.x = _local1.targetx;
enemyStop(_local1.id);
setEnemyNextMoveFrame(_local1.id);
}
var _local3 = mapToScreen(_local1.x, _local1.y, _local1.z);
_local1.flashx = _local3[0];
_local1.flashy = _local3[1];
_local1.clip._x = _local1.flashx;
_local1.clip._y = _local1.flashy;
}
} else if (_local1.status == "readyThrow") {
if (_local1.animationClip._currentframe == _local1.clipReadyThrowLastFrame) {
enemyThrowBall(_local1.id);
}
} else if (_local1.status == "throw") {
if (_local1.animationClip._currentframe == _local1.clipThrowLastFrame) {
enemyBackToNormal(_local1.id);
setNextThrowFrame(_local1.id);
}
} else if (_local1.status == "down") {
if (_local1.animationClip._currentframe == _local1.clipDownLastFrame) {
enemyBackToNormal(_local1.id);
setNextThrowFrame(_local1.id);
}
} else if (_local1.status == "dead") {
if (_local1.animationClip._currentframe == _local1.clipDeadLastFrame) {
readyToRemoveEnemy(_local1.id);
}
}
_local2++;
}
}
function updateEnemiesClip() {
var _local2 = 0;
while (_local2 < enemy.item_array.length) {
var _local1 = enemy.item_array[_local2];
var _local3 = _local1.nextClipLabel;
if (_local3 != "none") {
_local1.animationClip.gotoAndPlay(_local3);
_local1.nextClipLabel = "none";
}
_local2++;
}
}
function initialFriends() {
friend = {};
friend.clipShowLastFrame = 10;
friend.clipReadyThrowLastFrame = 36;
friend.clipThrowLastFrame = 47;
friend0 = {};
var _local1 = friend0;
_local1.id = 0;
_local1.clip = "";
_local1.animationClip = "";
_local1.throwHeight = 35;
_local1.strength = 10;
_local1.ballRadius = 35;
_local1.ballClipScale = 80;
_local1.minThrowXSpeed = 24;
_local1.maxThrowXSpeed = 32;
_local1.throwYSpeed = -1;
_local1.minThrowZSpeed = -6;
_local1.maxThrowZSpeed = 6;
_local1.framesPerThrow = 24;
_local1.nextThrowFrame = 0;
_local1.initx = 75;
_local1.inity = 0;
_local1.initz = -250;
_local1.x = 0;
_local1.y = 0;
_local1.z = 0;
_local1.status = "hide";
friend1 = {};
_local1 = friend1;
_local1.id = 1;
_local1.clip = "";
_local1.animationClip = "";
_local1.throwHeight = 35;
_local1.strength = 10;
_local1.ballRadius = 35;
_local1.ballClipScale = 80;
_local1.minThrowXSpeed = 24;
_local1.maxThrowXSpeed = 32;
_local1.throwYSpeed = -1;
_local1.minThrowZSpeed = -6;
_local1.maxThrowZSpeed = 2;
_local1.framesPerThrow = 24;
_local1.nextThrowFrame = 0;
_local1.initx = 75;
_local1.inity = 0;
_local1.initz = -450;
_local1.x = 0;
_local1.y = 0;
_local1.z = 0;
_local1.status = "hide";
}
function friendThrowBall(id) {
var _local1 = main["friend" + id];
var _local8 = _local1.x;
var _local6 = _local1.y - _local1.throwHeight;
var _local5 = _local1.z;
var _local2 = _local1.maxThrowXSpeed - _local1.minThrowXSpeed;
var _local7 = _local1.minThrowXSpeed + random(_local2);
var _local9 = _local1.throwYSpeed;
var _local3 = _local1.maxThrowZSpeed - _local1.minThrowZSpeed;
var _local4 = _local1.minThrowZSpeed + random(_local3);
_local1.status = "throw";
_local1.nextClipLabel = "throw";
_local1.animationClip.gotoAndPlay("throw");
createBall(_local8, _local6, _local5, _local7, _local9, _local4, _local1.strength, _local1.ballRadius, _local1.ballClipScale, 0);
}
function loadFriends() {
var _local2 = 0;
while (_local2 < game.friends) {
var _local1 = main["friend" + _local2];
var _local5 = "friend";
var _local6 = ("friend" + _local2) + "_mc";
var _local4 = 3000 + _local2;
_local1.clip = field.clip.attachMovie(_local5, _local6, _local4);
_local1.animationClip = _local1.clip.animation_mc;
_local1.x = _local1.initx;
_local1.y = _local1.inity;
_local1.z = _local1.initz;
var _local3 = mapToScreen(_local1.x, _local1.y, _local1.z);
_local1.flashx = _local3[0];
_local1.flashy = _local3[1];
_local1.clip._x = _local1.flashx;
_local1.clip._y = _local1.flashy;
_local1.clip._x = _local1.flashx;
_local1.clip._y = _local1.flashy;
_local1.animationClip.stop();
_local1.status = "hide";
_local2++;
}
}
function showFriends() {
var _local1 = 0;
while (_local1 < game.friends) {
showFriend(_local1);
_local1++;
}
}
function hideFriends() {
var _local1 = 0;
while (_local1 < game.friends) {
hideFriend(_local1);
_local1++;
}
}
function showFriend(id) {
var _local1 = main["friend" + id];
_local1.animationClip.gotoAndPlay("show");
_local1.status = "show";
}
function hideFriend(id) {
var _local1 = main["friend" + id];
_local1.animationClip.gotoAndPlay("hide");
_local1.status = "hide";
}
function updateFriends() {
var _local2 = 0;
while (_local2 < game.friends) {
var _local1 = main["friend" + _local2];
if (_local2 == 0) {
}
if (_local1.status == "show") {
if (_local1.animationClip._currentframe == friend.clipShowLastFrame) {
_local1.clip.gotoAndPlay("normal");
_local1.status = "normal";
}
} else if (_local1.status == "normal") {
if (game.frames >= _local1.nextThrowFrame) {
_local1.animationClip.gotoAndPlay("readyToThrow");
_local1.status = "readyToThrow";
}
} else if (_local1.status == "readyToThrow") {
if (_local1.animationClip._currentframe == friend.clipReadyThrowLastFrame) {
friendThrowBall(_local2);
_local1.nextThrowFrame = game.frames + _local1.framesPerThrow;
_local1.status = "throw";
}
} else if (_local1.status == "throw") {
if (_local1.animationClip._currentframe == friend.clipThrowLastFrame) {
_local1.animationClip.gotoAndPlay("normal");
_local1.status = "normal";
}
}
_local2++;
}
}
function loadPlayer() {
if (world.speedUp) {
player.speed = player.extraSpeed;
}
if (world.extraHealth) {
player.healthMax = player.extraHealthMax;
}
if (world.shootFaster) {
player.throwSpeedMax = 40;
player.throwSpeedMin = player.throwSpeedMax * player.throwSpeedMinRatio;
}
player.health = player.healthMax;
player.tempx = player.initx;
player.tempy = player.initx;
player.tempz = player.initz;
player.x = player.initx;
player.y = player.inity;
player.z = player.initz;
player.clipDepth = depth.itemInit;
var _local3 = "player";
var _local4 = "player_mc";
var _local2 = depth.itemInit;
player.clip = field.clip.attachMovie(_local3, _local4, _local2);
player.animationClip = player.clip.animation_mc;
player.headClip = player.animationClip.head_mc;
player.clip.meterClip = player.clip.meter_mc;
player.clip.meterClip._visible = false;
var _local1 = mapToScreen(player.x, player.y, player.z);
player.flashx = _local1[0];
player.flashy = _local1[1];
player.clip._x = player.flashx;
player.clip._y = player.flashy;
player.nextClipLabel = "none";
player.status = "dead";
player.moveStatus = "rest";
player.lastMoveStatus = "rest";
rearrangeItemClipsDepth();
}
function showPlayer() {
player.tempx = player.initx;
player.tempy = player.initx;
player.tempz = player.initz;
player.x = player.initx;
player.y = player.inity;
player.z = player.initz;
player.clip.meterClip._visible = false;
player.toNormalFrame = game.frames + player.framesShowToNormal;
player.nextClipLabel = "show";
player.status = "show";
}
function resetPlayerStatus() {
player.health = player.healthMax;
player.status = "dead";
player.moveStatus = "rest";
player.lastMoveStatus = "rest";
player.powerUpType = "none";
}
function captureKeys() {
player.lastMoveStatus = player.moveStatus;
var _local3 = Key.isDown(65);
var _local1 = Key.isDown(68);
var _local2 = Key.isDown(87);
var _local4 = Key.isDown(83);
if ((!_local3) && (!_local1)) {
player.xmov = 0;
} else if (_local3) {
player.xmov = -player.speed;
} else if (_local1) {
player.xmov = player.speed;
}
if ((!_local2) && (!_local4)) {
player.zmov = 0;
} else if (_local2) {
player.zmov = player.speed;
} else if (_local4) {
player.zmov = -player.speed;
}
field.clip.onMouseDown = function () {
if (field.clip._ymouse > 40) {
if (player.status == "normal") {
player.throwSpeed = player.throwSpeedMin;
player.moveStatus = "rest";
playerReadyToThrow();
}
}
};
field.clip.onMouseUp = function () {
if (player.status == "readyToThrow") {
playerThrowBall();
}
};
}
function captureMouse() {
var _local1 = 10;
var _local3 = field.clip._xmouse - player.flashx;
var _local2 = field.clip._ymouse - player.flashy;
if (Math.abs(_local3) < _local1) {
player.xmov = 0;
} else if (_local3 > 0) {
player.xmov = player.speed;
} else {
player.xmov = -player.speed;
}
if (Math.abs(_local2) < _local1) {
player.zmov = 0;
} else if (_local2 > 0) {
player.zmov = -player.speed;
} else {
player.zmov = player.speed;
}
field.clip.onMouseDown = function () {
if (field.clip._ymouse > 40) {
if (player.status == "normal") {
player.throwSpeed = player.throwSpeedMin;
player.moveStatus = "rest";
playerReadyToThrow();
}
}
};
field.clip.onMouseUp = function () {
if (player.status == "readyToThrow") {
playerThrowBall();
}
};
}
function playerReadyToThrow() {
player.throwSpeed = player.throwSpeedMin;
var _local1 = Math.round(((player.throwSpeed - player.throwSpeedMin) / (player.throwSpeedMax - player.throwSpeedMin)) * 100) + 1;
player.clip.meterClip.gotoAndStop(_local1);
player.clip.meterClip._visible = true;
player.status = "readyToThrow";
player.nextClipLabel = "readyToThrow";
}
function playerStartMove() {
player.nextClipLabel = "move";
player.moveStatus = "move";
}
function playerStartReadyThrowMove() {
player.nextClipLabel = "readyToThrowMove";
player.moveStatus = "move";
}
function playerStop() {
player.nextClipLabel = "normal";
player.moveStatus = "rest";
}
function playerReadyThrowStop() {
player.nextClipLabel = "readyToThrowLast";
player.moveStatus = "rest";
}
function playerChargeThrowSpeed() {
var _local2 = player.throwSpeedMax / player.framesMaxThrowSpeed;
player.throwSpeed = player.throwSpeed + _local2;
if (player.throwSpeed > player.throwSpeedMax) {
player.throwSpeed = player.throwSpeedMax;
}
var _local1 = Math.round(((player.throwSpeed - player.throwSpeedMin) / (player.throwSpeedMax - player.throwSpeedMin)) * 100) + 1;
trace((player.clip.meterClip + " ") + _local1);
player.clip.meterClip.gotoAndStop(_local1);
}
function playerThrowBall() {
var _local3 = player.x;
var _local2 = player.y - player.throwHeight;
var _local1 = player.z;
player.clip.meterClip._visible = false;
player.nextClipLabel = "throw";
player.status = "throw";
createBall(_local3, _local2, _local1, player.throwSpeed, 0, 0, player.strength, player.ballRadius, player.ballClipScale, 0);
if (player.powerUpType == "threeWay") {
createBall(_local3, _local2, _local1, player.throwSpeed, 0, -player.powerUpThrowZSpeed, player.strength, player.ballRadius, player.ballClipScale, 0);
createBall(_local3, _local2, _local1, player.throwSpeed, 0, player.powerUpThrowZSpeed, player.strength, player.ballRadius, player.ballClipScale, 0);
player.threeWayShotsLeft--;
if (player.threeWayShotsLeft <= 0) {
player.powerUpType = "none";
}
}
player.nextThrowFrame = game.frames + player.framesPerThrow;
}
function playerBackToNormal() {
player.status = "normal";
player.nextClipLabel = "normal";
}
function reducePlayerHealth(damage) {
player.health = player.health - damage;
if (player.health <= 0) {
playerDead();
} else {
playerDown();
}
}
function playerShootMultiBalls() {
var _local6 = powerUp.x;
var _local5 = powerUp.y - 40;
var _local4 = powerUp.z;
var _local2 = 30;
var _local1 = 60;
var _local3 = 1;
createBall(_local6, _local5, _local4, 13, -2, 0, 10, _local2, _local1, _local3);
createBall(_local6, _local5, _local4, 10, -1, 0, 10, _local2, _local1, _local3);
createBall(_local6, _local5, _local4, 8, 0, 0, 10, _local2, _local1, _local3);
createBall(_local6, _local5, _local4, 13, -2, -5, 10, _local2, _local1, _local3);
createBall(_local6, _local5, _local4, 8, 0, -5, 10, _local2, _local1, _local3);
createBall(_local6, _local5, _local4, 13, -2, 5, 10, _local2, _local1, _local3);
createBall(_local6, _local5, _local4, 8, 0, 5, 10, _local2, _local1, _local3);
}
function playerReflectBall(id) {
var _local2 = 0;
while (_local2 < ball.item_array.length) {
var _local1 = ball.item_array[_local2];
if (_local1.id == id) {
_local1.xmov = _local1.xmov * -1;
_local1.ymov = _local1.ymov * -1;
}
_local2++;
}
player.nextClipLabel = "down";
}
function playerPowerUp() {
var _local2 = powerUp.item_array[powerUp.id];
var _local1 = _local2.type;
var _local3 = _local2.frameLast;
if (_local1 == "multiBalls") {
playerShootMultiBalls();
player.powerUpType = "none";
} else if (_local1 == "threeWay") {
player.powerUpType = _local1;
player.threeWayShotsLeft = powerUp.threeWayShots;
} else if (_local1 == "friends") {
showFriends();
player.powerUpType = _local1;
player.powerUpEndFrame = game.frames + _local3;
playerFaceGlow();
} else if (_local1 == "shield") {
player.powerUpType = _local1;
player.powerUpEndFrame = game.frames + _local3;
playerFaceGlow();
}
}
function playerToNormal() {
player.status = "normal";
}
function playerDown() {
player.backToNormalFrame = game.frames + player.framesDown;
player.clip.meterClip._visible = false;
player.status = "down";
player.nextClipLabel = "down";
}
function playerDead() {
player.status = "dead";
player.nextClipLabel = "dead";
player.quitFrame = game.frames + player.framesDead;
if (player.powerUpType == "friends") {
player.powerUpType = "none";
playerFaceStopGlow();
hideFriends();
} else if (player.powerUpType == "shield") {
playerFaceStopGlow();
player.powerUpType = "none";
}
}
function playerQuit() {
player.status = "quited";
}
function playerFaceGlow() {
trace("player face glow" + player.headClip);
player.headClip.gotoAndPlay("glow");
}
function playerFaceStopGlow() {
player.headClip.gotoAndStop("Normal");
}
function removePlayer() {
player.status = "removed";
player.clip.removeMovieClip();
}
function playerAtRest() {
return((player.xmov == 0) && (player.zmov == 0));
}
function preUpdatePlayer() {
if (player.status == "show") {
if (game.frames > player.toNormalFrame) {
playerToNormal();
}
} else if (player.status == "normal") {
if (player.moveStatus == "rest") {
if (!playerAtRest()) {
playerStartMove();
}
} else if (player.moveStatus == "move") {
if (playerAtRest()) {
playerStop();
}
}
} else if (player.status == "readyToThrow") {
playerChargeThrowSpeed();
if (player.moveStatus == "rest") {
if (!playerAtRest()) {
playerStartReadyThrowMove();
}
} else if (player.moveStatus == "move") {
if (playerAtRest()) {
playerReadyThrowStop();
}
}
} else if (player.status == "throw") {
if (game.frames > player.nextThrowFrame) {
playerBackToNormal();
}
} else if (player.status == "down") {
if (game.frames > player.backToNormalFrame) {
playerBackToNormal();
}
} else if (player.status == "dead") {
if (game.frames > player.quitFrame) {
playerQuit();
}
}
player.tempx = player.x + player.xmov;
player.tempy = player.y + player.ymov;
player.tempz = player.z + player.zmov;
if (player.tempx < player.minX) {
player.tempx = player.minX;
} else if (player.tempx > player.maxX) {
player.tempx = player.maxX;
}
if (player.tempz < player.minZ) {
player.tempz = player.minZ;
} else if (player.tempz > player.maxZ) {
player.tempz = player.maxZ;
}
}
function updatePlayerPowerUp() {
player.powerUpEndFrame;
if (player.powerUpType == "friends") {
if (game.frames > player.powerUpEndFrame) {
player.powerUpType = "none";
playerFaceStopGlow();
hideFriends();
}
} else if (player.powerUpType == "shield") {
if (game.frames > player.powerUpEndFrame) {
playerFaceStopGlow();
player.powerUpType = "none";
}
}
}
function updatePlayerAnimation() {
if (player.nextClipLabel != "none") {
var _local1 = player.nextClipLabel;
player.animationClip.gotoAndPlay(_local1);
player.nextClipLabel = "none";
}
}
function updatePlayer() {
player.x = player.tempx;
player.y = player.tempy;
player.z = player.tempz;
var _local1 = mapToScreen(player.x, player.y, player.z);
player.flashx = _local1[0];
player.flashy = _local1[1];
player.clip._x = player.flashx;
player.clip._y = player.flashy;
updatePlayerPowerUp();
updatePlayerAnimation();
}
function createBall(x, y, z, xmov, ymov, zmov, strength, radius, clipScale, type) {
var _local2 = ball.currentId;
var _local1 = {};
_local1.id = _local2;
_local1.x = x;
_local1.y = y;
_local1.z = z;
_local1.xmov = xmov;
_local1.ymov = ymov;
_local1.zmov = zmov;
_local1.strength = strength;
_local1.radius = radius;
_local1.clipScale = clipScale;
_local1.score = 0;
_local1.type = type;
_local1.status = "fly";
_local1.clipDepth = depth.itemInit;
var _local5 = "ball" + type;
var _local9 = ("ball" + _local2) + "_mc";
var _local4 = depth.itemInit;
_local1.clip = field.clip.attachMovie(_local5, _local9, _local4);
var _local3 = mapToScreen(_local1.x, _local1.y, _local1.z);
var _local8 = _local3[0];
var _local7 = _local3[1];
_local1.clip._x = _local8;
_local1.clip._y = _local7;
_local1.clip._xscale = clipScale;
_local1.clip._yscale = clipScale;
_local5 = "ballShadow";
_local9 = ("ballShadow" + _local2) + "_mc";
_local4 = depth.ballShadowMin + _local2;
_local1.shadowClip = field.clip.attachMovie(_local5, _local9, _local4);
_local3 = mapToScreen(_local1.x, 0, _local1.z);
_local8 = _local3[0];
_local7 = _local3[1];
_local1.shadowClip._x = _local8;
_local1.shadowClip._y = _local7;
ball.item_array.push(_local1);
ball.currentId++;
if (ball.currentId > ball.maxId) {
ball.currentId = 0;
}
rearrangeItemClipsDepth();
}
function explodeBall(id) {
var _local2 = 0;
while (_local2 < ball.item_array.length) {
var _local1 = ball.item_array[_local2];
if (_local1.id == id) {
_local1.status = "explode";
_local1.clip.gotoAndPlay("explode");
_local1.clip.score = _local1.score;
_local1.shadowClip.removeMovieClip();
}
_local2++;
}
}
function removeAllBalls() {
var _local1 = 0;
while (_local1 < ball.item_array.length) {
var _local2 = ball.item_array[_local1];
removeBall(_local1);
_local1++;
}
}
function removeBall(id) {
var _local2 = 0;
while (_local2 < ball.item_array.length) {
var _local1 = ball.item_array[_local2];
if (_local1.id == id) {
ball.item_array.splice(_local2, 1);
_local1.status = "removed";
_local1.clip.removeMovieClip();
_local1 = {};
}
_local2++;
}
}
function updateBalls() {
var _local2 = 0;
while (_local2 < ball.item_array.length) {
var _local1 = ball.item_array[_local2];
if (_local1.status == "fly") {
_local1.ymov = _local1.ymov + game.gravity;
_local1.x = _local1.x + _local1.xmov;
_local1.y = _local1.y + _local1.ymov;
_local1.z = _local1.z + _local1.zmov;
var _local5 = (-_local1.radius) / 2;
if (_local1.y > _local5) {
var _local4 = random(1);
playSFX("hit" + _local4);
explodeBall(_local1.id);
} else if (_local1.xmov > 0) {
if (_local1.x > ball.maxX) {
removeBall(_local1.id);
}
} else if (_local1.x < ball.minX) {
removeBall(_local1.id);
}
var _local3 = mapToScreen(_local1.x, _local1.y, _local1.z);
var _local7 = _local3[0];
var _local6 = _local3[1];
_local1.clip._x = _local7;
_local1.clip._y = _local6;
_local3 = mapToScreen(_local1.x, 0, _local1.z);
_local7 = _local3[0];
_local6 = _local3[1];
_local1.shadowClip._x = _local7;
_local1.shadowClip._y = _local6;
} else if (_local1.status == "explode") {
if (_local1.clip._currentframe == _local1.clip._totalframes) {
removeBall(_local1.id);
}
}
_local2++;
}
}
function initialPowerUp() {
powerUp = {};
powerUp.clip = "";
powerUp.id = 0;
powerUp.item_array = [{type:"multiBalls", frameLast:0}, {type:"threeWay", frameLast:0}, {type:"friends", frameLast:192}, {type:"shield", frameLast:192}];
powerUp.ballCollisionRadius = 30;
powerUp.threeWayShots = 3;
powerUp.zmov = -10;
powerUp.initx = 250;
powerUp.inity = 0;
powerUp.initz = 0;
powerUp.minZ = -600;
powerUp.x = 0;
powerUp.y = 0;
powerUp.z = 0;
powerUp.flashx = 0;
powerUp.flashy = 0;
powerUp.radius = 60;
powerUp.status = "removed";
}
function checkCreatePowerUp() {
if ((player.powerUpType == "none") && (powerUp.status == "removed")) {
var _local1 = main["level" + game.currentLevel];
if (_local1.powerUp_array.length > 0) {
if (game.frames > game.nextPowerUpCreateFrame) {
var _local3 = random(_local1.powerUp_array.length);
var _local2 = _local1.powerUp_array[_local3];
createPowerUp(_local2);
game.nextPowerUpCreateFrame = game.frames + _local1.framesPowerUpCreate;
playSFX("powerUpRollDown");
}
}
}
}
function createPowerUp(id) {
powerUp.id = id;
powerUp.x = powerUp.initx;
powerUp.y = powerUp.inity;
powerUp.z = powerUp.initz;
var _local1 = mapToScreen(powerUp.x, powerUp.y, powerUp.z);
powerUp.flashx = _local1[0];
powerUp.flashy = _local1[1];
powerUp.status = "roll";
var _local4 = "powerUp" + id;
var _local5 = ("powerUp" + id) + "_mc";
var _local2 = depth.powerUp;
powerUp.clip = field.clip.attachMovie(_local4, _local5, _local2);
powerUp.clip._x = powerUp.flashx;
powerUp.clip._y = powerUp.flashy;
}
function explodePowerUp() {
powerUp.clip.gotoAndPlay("explode");
powerUp.status = "explode";
}
function removePowerUp() {
powerUp.clip.removeMovieClip();
powerUp.status = "removed";
}
function updatePowerUp() {
if (powerUp.status == "roll") {
powerUp.z = powerUp.z + powerUp.zmov;
var _local1 = mapToScreen(powerUp.x, powerUp.y, powerUp.z);
powerUp.flashx = _local1[0];
powerUp.flashy = _local1[1];
powerUp.clip._x = powerUp.flashx;
powerUp.clip._y = powerUp.flashy;
if (powerUp.z < powerUp.minZ) {
removePowerUp();
}
} else if (powerUp.status == "explode") {
if (powerUp.clip._currentframe == powerUp.clip._totalframes) {
removePowerUp();
}
}
}
function playGameMusicLoop() {
if (music.currentMusic != "none") {
stopMusic(music.currentMusic);
}
playMusic("gameLoop");
}
function initialLevels() {
level1 = {};
var _local2 = level1;
_local2.enemy_array = [{frame:0, type:1}, {frame:144, type:1}, {frame:145, type:1}, {frame:288, type:1}, {frame:289, type:1}];
_local2.powerUp_array = [];
_local2.framesPowerUpCreate = 999999 /* 0x0F423F */;
_local2.maxZombiesOnScreen = 3;
_local2.mapId = 0;
level2 = {};
_local2 = level2;
_local2.enemy_array = [{frame:0, type:1}, {frame:1, type:1}, {frame:144, type:1}, {frame:145, type:1}, {frame:146, type:1}, {frame:288, type:1}, {frame:289, type:1}, {frame:290, type:1}, {frame:432, type:1}, {frame:433, type:1}];
_local2.powerUp_array = [];
_local2.framesPowerUpCreate = 360;
_local2.maxZombiesOnScreen = 5;
_local2.mapId = 0;
level3 = {};
_local2 = level3;
_local2.enemy_array = [{frame:0, type:1}, {frame:1, type:1}, {frame:2, type:1}, {frame:144, type:1}, {frame:145, type:1}, {frame:146, type:1}, {frame:288, type:1}, {frame:289, type:1}, {frame:290, type:1}, {frame:432, type:2}, {frame:433, type:2}];
_local2.powerUp_array = [0];
_local2.framesPowerUpCreate = 360;
_local2.maxZombiesOnScreen = 6;
_local2.mapId = 0;
level4 = {};
_local2 = level4;
_local2.enemy_array = [{frame:0, type:1}, {frame:1, type:1}, {frame:2, type:1}, {frame:144, type:1}, {frame:145, type:1}, {frame:146, type:2}, {frame:288, type:1}, {frame:289, type:1}, {frame:290, type:2}, {frame:432, type:1}, {frame:433, type:1}, {frame:434, type:2}, {frame:576, type:1}, {frame:577, type:1}, {frame:578, type:2}];
_local2.powerUp_array = [0];
_local2.framesPowerUpCreate = 360;
_local2.maxZombiesOnScreen = 7;
_local2.mapId = 0;
level5 = {};
_local2 = level5;
_local2.enemy_array = [{frame:0, type:1}, {frame:1, type:1}, {frame:2, type:1}, {frame:144, type:2}, {frame:145, type:2}, {frame:288, type:1}, {frame:289, type:1}, {frame:290, type:1}, {frame:432, type:2}, {frame:433, type:2}, {frame:576, type:1}, {frame:577, type:1}, {frame:578, type:2}, {frame:579, type:2}, {frame:720, type:1}, {frame:721, type:1}, {frame:722, type:2}, {frame:723, type:2}];
_local2.powerUp_array = [2];
_local2.framesPowerUpCreate = 360;
_local2.maxZombiesOnScreen = 8;
_local2.mapId = 0;
level6 = {};
_local2 = level6;
_local2.enemy_array = [{frame:0, type:1}, {frame:1, type:1}, {frame:2, type:2}, {frame:144, type:1}, {frame:145, type:1}, {frame:146, type:1}, {frame:147, type:1}, {frame:288, type:2}, {frame:289, type:2}, {frame:432, type:1}, {frame:433, type:1}, {frame:434, type:1}, {frame:435, type:1}, {frame:576, type:2}, {frame:577, type:2}, {frame:578, type:2}, {frame:720, type:2}, {frame:721, type:2}];
_local2.powerUp_array = [2];
_local2.framesPowerUpCreate = 360;
_local2.maxZombiesOnScreen = 8;
_local2.mapId = 0;
level7 = {};
_local2 = level7;
_local2.enemy_array = [{frame:0, type:1}, {frame:1, type:1}, {frame:2, type:1}, {frame:3, type:1}, {frame:144, type:1}, {frame:145, type:1}, {frame:146, type:2}, {frame:147, type:2}, {frame:288, type:1}, {frame:289, type:1}, {frame:290, type:1}, {frame:432, type:1}, {frame:433, type:1}, {frame:434, type:2}, {frame:576, type:1}, {frame:577, type:2}, {frame:578, type:2}, {frame:720, type:1}, {frame:721, type:2}, {frame:722, type:2}];
_local2.powerUp_array = [0, 2];
_local2.framesPowerUpCreate = 360;
_local2.maxZombiesOnScreen = 9;
_local2.mapId = 0;
level8 = {};
_local2 = level8;
_local2.enemy_array = [{frame:0, type:2}, {frame:1, type:2}, {frame:2, type:2}, {frame:144, type:1}, {frame:145, type:1}, {frame:146, type:2}, {frame:288, type:1}, {frame:289, type:1}, {frame:290, type:2}, {frame:291, type:2}, {frame:432, type:1}, {frame:433, type:1}, {frame:434, type:2}, {frame:435, type:2}, {frame:576, type:1}, {frame:577, type:1}, {frame:578, type:2}, {frame:579, type:2}, {frame:720, type:1}, {frame:721, type:1}, {frame:722, type:2}, {frame:864, type:1}, {frame:865, type:1}, {frame:866, type:2}, {frame:867, type:2}];
_local2.powerUp_array = [0, 2];
_local2.framesPowerUpCreate = 360;
_local2.maxZombiesOnScreen = 9;
_local2.mapId = 0;
level9 = {};
_local2 = level9;
_local2.enemy_array = [{frame:0, type:1}, {frame:1, type:1}, {frame:2, type:1}, {frame:3, type:1}, {frame:4, type:1}, {frame:144, type:3}, {frame:145, type:3}, {frame:288, type:2}, {frame:289, type:2}, {frame:290, type:2}, {frame:432, type:1}, {frame:433, type:1}, {frame:434, type:1}, {frame:435, type:1}, {frame:576, type:2}, {frame:577, type:2}, {frame:578, type:2}, {frame:720, type:1}, {frame:721, type:1}, {frame:722, type:3}, {frame:864, type:1}, {frame:865, type:1}, {frame:866, type:3}, {frame:867, type:3}];
_local2.powerUp_array = [1];
_local2.framesPowerUpCreate = 360;
_local2.maxZombiesOnScreen = 10;
_local2.mapId = 0;
level10 = {};
_local2 = level10;
_local2.enemy_array = [{frame:0, type:3}, {frame:1, type:3}, {frame:144, type:1}, {frame:145, type:2}, {frame:146, type:3}, {frame:288, type:1}, {frame:289, type:2}, {frame:290, type:3}, {frame:432, type:1}, {frame:433, type:2}, {frame:434, type:3}, {frame:576, type:1}, {frame:577, type:2}, {frame:578, type:3}, {frame:720, type:1}, {frame:721, type:2}, {frame:722, type:3}, {frame:864, type:1}, {frame:865, type:2}, {frame:866, type:3}, {frame:1008, type:1}, {frame:1009, type:2}, {frame:1010, type:3}];
_local2.powerUp_array = [0, 1, 2];
_local2.framesPowerUpCreate = 360;
_local2.maxZombiesOnScreen = 10;
_local2.mapId = 0;
level11 = {};
_local2 = level11;
_local2.enemy_array = [{frame:0, type:1}, {frame:1, type:1}, {frame:2, type:1}, {frame:3, type:2}, {frame:4, type:2}, {frame:144, type:1}, {frame:145, type:1}, {frame:146, type:2}, {frame:147, type:2}, {frame:288, type:2}, {frame:289, type:2}, {frame:290, type:3}, {frame:291, type:3}, {frame:432, type:1}, {frame:433, type:1}, {frame:434, type:2}, {frame:435, type:2}, {frame:576, type:2}, {frame:577, type:2}, {frame:578, type:3}, {frame:579, type:3}, {frame:720, type:1}, {frame:721, type:1}, {frame:722, type:2}, {frame:723, type:2}, {frame:864, type:2}, {frame:865, type:2}, {frame:866, type:3}, {frame:867, type:3}, {frame:1008, type:1}, {frame:1009, type:1}, {frame:1010, type:1}, {frame:1011, type:3}, {frame:1012, type:3}];
_local2.powerUp_array = [0, 1, 2];
_local2.framesPowerUpCreate = 360;
_local2.maxZombiesOnScreen = 10;
_local2.mapId = 0;
level12 = {};
_local2 = level12;
_local2.enemy_array = [{frame:0, type:2}, {frame:1, type:2}, {frame:2, type:2}, {frame:3, type:2}, {frame:144, type:1}, {frame:145, type:1}, {frame:146, type:1}, {frame:147, type:1}, {frame:288, type:3}, {frame:289, type:3}, {frame:290, type:3}, {frame:432, type:1}, {frame:433, type:1}, {frame:434, type:2}, {frame:435, type:2}, {frame:576, type:1}, {frame:577, type:1}, {frame:578, type:3}, {frame:579, type:3}, {frame:720, type:2}, {frame:721, type:2}, {frame:722, type:3}, {frame:723, type:3}, {frame:864, type:1}, {frame:865, type:1}, {frame:866, type:2}, {frame:867, type:2}, {frame:868, type:3}, {frame:1008, type:1}, {frame:1009, type:2}, {frame:1010, type:3}, {frame:1152, type:3}, {frame:1153, type:3}, {frame:1154, type:3}, {frame:1155, type:3}];
_local2.powerUp_array = [3];
_local2.framesPowerUpCreate = 360;
_local2.maxZombiesOnScreen = 10;
_local2.mapId = 0;
level13 = {};
_local2 = level13;
_local2.enemy_array = [{frame:0, type:3}, {frame:1, type:3}, {frame:2, type:3}, {frame:144, type:3}, {frame:145, type:3}, {frame:146, type:3}, {frame:288, type:3}, {frame:289, type:3}, {frame:290, type:3}, {frame:432, type:1}, {frame:433, type:1}, {frame:434, type:3}, {frame:435, type:3}, {frame:576, type:2}, {frame:577, type:2}, {frame:578, type:3}, {frame:579, type:3}, {frame:720, type:1}, {frame:721, type:1}, {frame:722, type:2}, {frame:723, type:2}, {frame:724, type:3}, {frame:864, type:1}, {frame:865, type:2}, {frame:866, type:3}, {frame:867, type:3}, {frame:1008, type:3}, {frame:1009, type:3}, {frame:1010, type:3}, {frame:1011, type:4}, {frame:1152, type:3}, {frame:1153, type:3}, {frame:1154, type:4}, {frame:1155, type:4}];
_local2.powerUp_array = [0, 1, 2, 3];
_local2.framesPowerUpCreate = 360;
_local2.maxZombiesOnScreen = 10;
_local2.mapId = 0;
level14 = {};
_local2 = level14;
_local2.enemy_array = [{frame:0, type:1}, {frame:1, type:1}, {frame:2, type:2}, {frame:3, type:2}, {frame:4, type:3}, {frame:144, type:2}, {frame:145, type:3}, {frame:146, type:4}, {frame:288, type:1}, {frame:289, type:1}, {frame:290, type:2}, {frame:291, type:2}, {frame:432, type:1}, {frame:433, type:1}, {frame:434, type:1}, {frame:435, type:1}, {frame:576, type:2}, {frame:577, type:2}, {frame:578, type:2}, {frame:579, type:2}, {frame:720, type:3}, {frame:721, type:3}, {frame:722, type:3}, {frame:723, type:3}, {frame:864, type:3}, {frame:865, type:3}, {frame:866, type:3}, {frame:1008, type:1}, {frame:1009, type:1}, {frame:1010, type:1}, {frame:1011, type:1}, {frame:1012, type:2}, {frame:1152, type:1}, {frame:1153, type:1}, {frame:1154, type:1}, {frame:1155, type:1}, {frame:1156, type:3}, {frame:1296, type:1}, {frame:1297, type:1}, {frame:1298, type:1}, {frame:1299, type:1}, {frame:1300, type:4}];
_local2.powerUp_array = [0, 1, 2, 3];
_local2.framesPowerUpCreate = 360;
_local2.maxZombiesOnScreen = 10;
_local2.mapId = 0;
level15 = {};
_local2 = level15;
_local2.enemy_array = [{frame:0, type:1}, {frame:1, type:2}, {frame:2, type:3}, {frame:3, type:4}, {frame:144, type:1}, {frame:145, type:2}, {frame:146, type:3}, {frame:147, type:4}, {frame:288, type:1}, {frame:289, type:1}, {frame:290, type:2}, {frame:291, type:3}, {frame:292, type:4}, {frame:432, type:1}, {frame:433, type:2}, {frame:434, type:2}, {frame:435, type:3}, {frame:436, type:4}, {frame:576, type:1}, {frame:577, type:2}, {frame:578, type:3}, {frame:579, type:3}, {frame:580, type:4}, {frame:720, type:1}, {frame:721, type:2}, {frame:722, type:3}, {frame:723, type:4}, {frame:724, type:4}, {frame:864, type:1}, {frame:865, type:1}, {frame:866, type:2}, {frame:867, type:3}, {frame:868, type:4}, {frame:1008, type:1}, {frame:1009, type:2}, {frame:1010, type:2}, {frame:1011, type:3}, {frame:1012, type:4}, {frame:1152, type:1}, {frame:1153, type:2}, {frame:1154, type:3}, {frame:1155, type:3}, {frame:1156, type:4}, {frame:1296, type:1}, {frame:1297, type:2}, {frame:1298, type:3}, {frame:1299, type:4}, {frame:1300, type:4}];
_local2.powerUp_array = [0, 1, 2, 3];
_local2.framesPowerUpCreate = 360;
_local2.maxZombiesOnScreen = 10;
_local2.mapId = 0;
level16 = {};
_local2 = level16;
_local2.enemy_array = [{frame:0, type:1}, {frame:1, type:1}, {frame:2, type:1}, {frame:3, type:1}, {frame:144, type:2}, {frame:145, type:2}, {frame:146, type:2}, {frame:147, type:2}, {frame:288, type:3}, {frame:289, type:3}, {frame:290, type:3}, {frame:291, type:3}, {frame:432, type:1}, {frame:433, type:4}, {frame:434, type:4}, {frame:435, type:4}, {frame:436, type:4}, {frame:576, type:1}, {frame:577, type:1}, {frame:578, type:1}, {frame:579, type:1}, {frame:720, type:1}, {frame:721, type:2}, {frame:722, type:2}, {frame:723, type:2}, {frame:724, type:2}, {frame:864, type:3}, {frame:865, type:3}, {frame:866, type:3}, {frame:867, type:3}, {frame:1008, type:1}, {frame:1009, type:4}, {frame:1010, type:4}, {frame:1011, type:4}, {frame:1012, type:4}, {frame:1152, type:1}, {frame:1153, type:3}, {frame:1154, type:3}, {frame:1155, type:4}, {frame:1156, type:4}, {frame:1296, type:1}, {frame:1297, type:3}, {frame:1298, type:3}, {frame:1299, type:4}, {frame:1300, type:4}, {frame:1440, type:2}, {frame:1441, type:3}, {frame:1442, type:3}, {frame:1443, type:4}, {frame:1444, type:4}];
_local2.powerUp_array = [0, 1, 2, 3];
_local2.framesPowerUpCreate = 360;
_local2.maxZombiesOnScreen = 11;
_local2.mapId = 0;
level17 = {};
_local2 = level17;
_local2.enemy_array = [{frame:0, type:4}, {frame:1, type:4}, {frame:2, type:4}, {frame:144, type:4}, {frame:145, type:4}, {frame:146, type:4}, {frame:288, type:4}, {frame:289, type:4}, {frame:290, type:4}, {frame:432, type:1}, {frame:433, type:1}, {frame:434, type:2}, {frame:435, type:2}, {frame:436, type:2}, {frame:576, type:1}, {frame:577, type:1}, {frame:578, type:2}, {frame:579, type:2}, {frame:580, type:2}, {frame:720, type:1}, {frame:721, type:1}, {frame:722, type:2}, {frame:723, type:2}, {frame:724, type:2}, {frame:864, type:2}, {frame:865, type:2}, {frame:866, type:3}, {frame:867, type:3}, {frame:868, type:3}, {frame:1008, type:2}, {frame:1009, type:2}, {frame:1010, type:3}, {frame:1011, type:3}, {frame:1012, type:3}, {frame:1152, type:2}, {frame:1153, type:2}, {frame:1154, type:3}, {frame:1155, type:3}, {frame:1156, type:3}, {frame:1296, type:3}, {frame:1297, type:3}, {frame:1298, type:4}, {frame:1299, type:4}, {frame:1300, type:4}, {frame:1440, type:3}, {frame:1441, type:3}, {frame:1442, type:4}, {frame:1443, type:4}, {frame:1444, type:4}];
_local2.powerUp_array = [0, 1, 2, 3];
_local2.framesPowerUpCreate = 360;
_local2.maxZombiesOnScreen = 11;
_local2.mapId = 0;
level18 = {};
_local2 = level18;
_local2.enemy_array = [{frame:0, type:1}, {frame:1, type:1}, {frame:2, type:1}, {frame:3, type:1}, {frame:4, type:1}, {frame:144, type:3}, {frame:145, type:3}, {frame:146, type:4}, {frame:147, type:4}, {frame:288, type:1}, {frame:289, type:1}, {frame:290, type:1}, {frame:291, type:1}, {frame:292, type:1}, {frame:432, type:3}, {frame:433, type:3}, {frame:434, type:4}, {frame:435, type:4}, {frame:576, type:2}, {frame:577, type:2}, {frame:578, type:3}, {frame:579, type:3}, {frame:580, type:3}, {frame:720, type:2}, {frame:721, type:2}, {frame:722, type:3}, {frame:723, type:3}, {frame:724, type:3}, {frame:864, type:1}, {frame:865, type:1}, {frame:866, type:1}, {frame:867, type:4}, {frame:868, type:4}, {frame:1008, type:3}, {frame:1009, type:3}, {frame:1010, type:4}, {frame:1011, type:4}, {frame:1012, type:4}, {frame:1152, type:1}, {frame:1153, type:1}, {frame:1154, type:1}, {frame:1155, type:4}, {frame:1156, type:4}, {frame:1296, type:3}, {frame:1297, type:3}, {frame:1298, type:4}, {frame:1299, type:4}, {frame:1300, type:4}, {frame:1440, type:1}, {frame:1441, type:1}, {frame:1442, type:1}, {frame:1443, type:4}, {frame:1444, type:4}];
_local2.powerUp_array = [0, 1, 2, 3];
_local2.framesPowerUpCreate = 360;
_local2.maxZombiesOnScreen = 11;
_local2.mapId = 0;
level19 = {};
_local2 = level19;
_local2.enemy_array = [{frame:0, type:4}, {frame:1, type:4}, {frame:2, type:4}, {frame:144, type:4}, {frame:145, type:4}, {frame:146, type:4}, {frame:147, type:4}, {frame:288, type:4}, {frame:289, type:4}, {frame:290, type:4}, {frame:291, type:4}, {frame:432, type:1}, {frame:433, type:1}, {frame:434, type:1}, {frame:435, type:1}, {frame:436, type:4}, {frame:437, type:4}, {frame:576, type:1}, {frame:577, type:1}, {frame:578, type:1}, {frame:579, type:1}, {frame:580, type:2}, {frame:581, type:2}, {frame:720, type:1}, {frame:721, type:1}, {frame:722, type:1}, {frame:723, type:1}, {frame:864, type:2}, {frame:865, type:2}, {frame:866, type:2}, {frame:867, type:2}, {frame:868, type:3}, {frame:869, type:3}, {frame:1008, type:2}, {frame:1009, type:2}, {frame:1010, type:2}, {frame:1011, type:2}, {frame:1012, type:3}, {frame:1013, type:3}, {frame:1152, type:2}, {frame:1153, type:2}, {frame:1154, type:2}, {frame:1155, type:2}, {frame:1296, type:2}, {frame:1297, type:2}, {frame:1298, type:3}, {frame:1299, type:3}, {frame:1300, type:3}, {frame:1301, type:3}, {frame:1440, type:2}, {frame:1441, type:2}, {frame:1442, type:3}, {frame:1443, type:3}, {frame:1444, type:3}, {frame:1445, type:3}, {frame:1584, type:2}, {frame:1585, type:2}, {frame:1586, type:2}, {frame:1587, type:2}, {frame:1588, type:4}, {frame:1589, type:4}];
_local2.powerUp_array = [0, 1, 2, 3];
_local2.framesPowerUpCreate = 360;
_local2.maxZombiesOnScreen = 11;
_local2.mapId = 0;
level20 = {};
_local2 = level20;
_local2.enemy_array = [{frame:0, type:1}, {frame:1, type:1}, {frame:2, type:1}, {frame:3, type:1}, {frame:4, type:1}, {frame:144, type:1}, {frame:145, type:1}, {frame:146, type:1}, {frame:147, type:1}, {frame:148, type:1}, {frame:288, type:2}, {frame:289, type:2}, {frame:290, type:2}, {frame:291, type:2}, {frame:432, type:2}, {frame:433, type:2}, {frame:434, type:2}, {frame:435, type:2}, {frame:576, type:1}, {frame:577, type:1}, {frame:578, type:3}, {frame:579, type:3}, {frame:580, type:3}, {frame:581, type:3}, {frame:720, type:3}, {frame:721, type:3}, {frame:722, type:3}, {frame:723, type:3}, {frame:864, type:1}, {frame:865, type:1}, {frame:866, type:3}, {frame:867, type:3}, {frame:868, type:3}, {frame:869, type:3}, {frame:1008, type:4}, {frame:1009, type:4}, {frame:1010, type:4}, {frame:1011, type:4}, {frame:1152, type:1}, {frame:1153, type:1}, {frame:1154, type:1}, {frame:1155, type:2}, {frame:1156, type:2}, {frame:1157, type:2}, {frame:1296, type:1}, {frame:1297, type:1}, {frame:1298, type:1}, {frame:1299, type:2}, {frame:1300, type:2}, {frame:1301, type:2}, {frame:1440, type:1}, {frame:1441, type:1}, {frame:1442, type:3}, {frame:1443, type:3}, {frame:1444, type:4}, {frame:1445, type:4}, {frame:1584, type:1}, {frame:1585, type:1}, {frame:1586, type:3}, {frame:1587, type:3}, {frame:1588, type:4}, {frame:1589, type:4}];
_local2.powerUp_array = [0, 1, 2, 3];
_local2.framesPowerUpCreate = 360;
_local2.maxZombiesOnScreen = 11;
_local2.mapId = 0;
level21 = {};
_local2 = level21;
_local2.enemy_array = [{frame:0, type:1}, {frame:1, type:1}, {frame:2, type:2}, {frame:3, type:3}, {frame:4, type:4}, {frame:144, type:1}, {frame:145, type:2}, {frame:146, type:2}, {frame:147, type:3}, {frame:148, type:4}, {frame:288, type:1}, {frame:289, type:2}, {frame:290, type:3}, {frame:291, type:3}, {frame:292, type:4}, {frame:432, type:1}, {frame:433, type:2}, {frame:434, type:3}, {frame:435, type:4}, {frame:436, type:4}, {frame:576, type:1}, {frame:577, type:1}, {frame:578, type:2}, {frame:579, type:2}, {frame:580, type:2}, {frame:720, type:2}, {frame:721, type:2}, {frame:722, type:3}, {frame:723, type:3}, {frame:724, type:3}, {frame:864, type:3}, {frame:865, type:3}, {frame:866, type:4}, {frame:867, type:4}, {frame:868, type:4}, {frame:1008, type:1}, {frame:1009, type:3}, {frame:1010, type:3}, {frame:1011, type:4}, {frame:1012, type:4}, {frame:1152, type:2}, {frame:1153, type:2}, {frame:1154, type:3}, {frame:1155, type:3}, {frame:1156, type:4}, {frame:1296, type:3}, {frame:1297, type:3}, {frame:1298, type:3}, {frame:1299, type:4}, {frame:1300, type:4}, {frame:1440, type:2}, {frame:1441, type:2}, {frame:1442, type:2}, {frame:1443, type:4}, {frame:1444, type:4}, {frame:1445, type:4}, {frame:1584, type:2}, {frame:1585, type:2}, {frame:1586, type:2}, {frame:1587, type:4}, {frame:1588, type:4}, {frame:1589, type:4}];
_local2.powerUp_array = [0, 1, 2, 3];
_local2.framesPowerUpCreate = 360;
_local2.maxZombiesOnScreen = 11;
_local2.mapId = 0;
level22 = {};
_local2 = level22;
_local2.enemy_array = [{frame:0, type:4}, {frame:1, type:4}, {frame:2, type:4}, {frame:3, type:4}, {frame:144, type:4}, {frame:145, type:4}, {frame:146, type:4}, {frame:147, type:4}, {frame:288, type:2}, {frame:289, type:2}, {frame:290, type:3}, {frame:291, type:3}, {frame:432, type:2}, {frame:433, type:2}, {frame:434, type:3}, {frame:435, type:3}, {frame:576, type:1}, {frame:577, type:1}, {frame:578, type:1}, {frame:579, type:1}, {frame:580, type:1}, {frame:720, type:2}, {frame:721, type:2}, {frame:722, type:2}, {frame:723, type:2}, {frame:724, type:2}, {frame:864, type:1}, {frame:865, type:1}, {frame:866, type:4}, {frame:867, type:4}, {frame:868, type:4}, {frame:1008, type:2}, {frame:1009, type:2}, {frame:1010, type:4}, {frame:1011, type:4}, {frame:1012, type:4}, {frame:1152, type:3}, {frame:1153, type:3}, {frame:1154, type:4}, {frame:1155, type:4}, {frame:1156, type:4}, {frame:1296, type:1}, {frame:1297, type:1}, {frame:1298, type:1}, {frame:1299, type:1}, {frame:1300, type:2}, {frame:1301, type:2}, {frame:1440, type:1}, {frame:1441, type:1}, {frame:1442, type:3}, {frame:1443, type:3}, {frame:1444, type:4}, {frame:1445, type:4}, {frame:1446, type:4}, {frame:1584, type:1}, {frame:1585, type:1}, {frame:1586, type:3}, {frame:1587, type:3}, {frame:1588, type:4}, {frame:1589, type:4}, {frame:1728, type:1}, {frame:1729, type:1}, {frame:1730, type:3}, {frame:1731, type:3}, {frame:1732, type:3}, {frame:1733, type:4}, {frame:1734, type:4}, {frame:1735, type:4}];
_local2.powerUp_array = [0, 1, 2, 3];
_local2.framesPowerUpCreate = 360;
_local2.maxZombiesOnScreen = 11;
_local2.mapId = 0;
level23 = {};
_local2 = level23;
_local2.enemy_array = [{frame:0, type:2}, {frame:1, type:2}, {frame:2, type:2}, {frame:3, type:2}, {frame:144, type:4}, {frame:145, type:4}, {frame:146, type:4}, {frame:288, type:1}, {frame:289, type:1}, {frame:290, type:1}, {frame:291, type:1}, {frame:292, type:1}, {frame:432, type:4}, {frame:433, type:4}, {frame:434, type:4}, {frame:576, type:1}, {frame:577, type:1}, {frame:578, type:1}, {frame:579, type:1}, {frame:580, type:1}, {frame:720, type:1}, {frame:721, type:1}, {frame:722, type:2}, {frame:723, type:2}, {frame:724, type:3}, {frame:864, type:1}, {frame:865, type:1}, {frame:866, type:2}, {frame:867, type:2}, {frame:868, type:3}, {frame:1008, type:3}, {frame:1009, type:3}, {frame:1010, type:4}, {frame:1011, type:4}, {frame:1012, type:4}, {frame:1152, type:1}, {frame:1153, type:3}, {frame:1154, type:3}, {frame:1155, type:4}, {frame:1156, type:4}, {frame:1296, type:2}, {frame:1297, type:2}, {frame:1298, type:3}, {frame:1299, type:4}, {frame:1300, type:4}, {frame:1440, type:2}, {frame:1441, type:2}, {frame:1442, type:3}, {frame:1443, type:4}, {frame:1444, type:4}, {frame:1584, type:1}, {frame:1585, type:2}, {frame:1586, type:3}, {frame:1587, type:4}, {frame:1588, type:4}, {frame:1728, type:1}, {frame:1729, type:2}, {frame:1730, type:2}, {frame:1731, type:3}, {frame:1732, type:4}, {frame:1733, type:4}, {frame:1872, type:2}, {frame:1873, type:2}, {frame:1874, type:3}, {frame:1875, type:3}, {frame:1876, type:4}, {frame:1877, type:4}, {frame:1878, type:4}];
_local2.powerUp_array = [0, 1, 2, 3];
_local2.framesPowerUpCreate = 360;
_local2.maxZombiesOnScreen = 11;
_local2.mapId = 0;
level24 = {};
_local2 = level24;
_local2.enemy_array = [{frame:0, type:1}, {frame:1, type:2}, {frame:2, type:2}, {frame:3, type:3}, {frame:4, type:3}, {frame:144, type:1}, {frame:145, type:2}, {frame:146, type:2}, {frame:147, type:3}, {frame:148, type:3}, {frame:288, type:1}, {frame:289, type:2}, {frame:290, type:2}, {frame:291, type:3}, {frame:292, type:3}, {frame:432, type:1}, {frame:433, type:2}, {frame:434, type:2}, {frame:435, type:4}, {frame:436, type:4}, {frame:576, type:1}, {frame:577, type:3}, {frame:578, type:3}, {frame:579, type:4}, {frame:580, type:4}, {frame:720, type:2}, {frame:721, type:3}, {frame:722, type:3}, {frame:723, type:4}, {frame:724, type:4}, {frame:864, type:2}, {frame:865, type:2}, {frame:866, type:3}, {frame:867, type:3}, {frame:1008, type:1}, {frame:1009, type:1}, {frame:1010, type:1}, {frame:1011, type:1}, {frame:1012, type:1}, {frame:1152, type:2}, {frame:1153, type:2}, {frame:1154, type:2}, {frame:1155, type:2}, {frame:1156, type:2}, {frame:1296, type:3}, {frame:1297, type:3}, {frame:1298, type:3}, {frame:1299, type:3}, {frame:1300, type:3}, {frame:1301, type:3}, {frame:1440, type:1}, {frame:1441, type:1}, {frame:1442, type:3}, {frame:1443, type:3}, {frame:1444, type:4}, {frame:1445, type:4}, {frame:1584, type:2}, {frame:1585, type:2}, {frame:1586, type:3}, {frame:1587, type:3}, {frame:1588, type:4}, {frame:1589, type:4}, {frame:1728, type:1}, {frame:1729, type:1}, {frame:1730, type:2}, {frame:1731, type:2}, {frame:1732, type:4}, {frame:1733, type:4}, {frame:1872, type:2}, {frame:1873, type:2}, {frame:1874, type:3}, {frame:1875, type:3}, {frame:1876, type:4}, {frame:1877, type:4}, {frame:1878, type:4}];
_local2.powerUp_array = [0, 1, 2, 3];
_local2.framesPowerUpCreate = 360;
_local2.maxZombiesOnScreen = 11;
_local2.mapId = 0;
level25 = {};
_local2 = level25;
_local2.enemy_array = [{frame:0, type:2}, {frame:1, type:2}, {frame:2, type:3}, {frame:3, type:3}, {frame:4, type:4}, {frame:5, type:4}, {frame:144, type:2}, {frame:145, type:2}, {frame:146, type:3}, {frame:147, type:3}, {frame:148, type:4}, {frame:149, type:4}, {frame:288, type:1}, {frame:289, type:2}, {frame:290, type:3}, {frame:291, type:3}, {frame:292, type:4}, {frame:293, type:4}, {frame:432, type:1}, {frame:433, type:2}, {frame:434, type:3}, {frame:435, type:4}, {frame:576, type:1}, {frame:577, type:1}, {frame:578, type:2}, {frame:579, type:2}, {frame:580, type:3}, {frame:581, type:3}, {frame:720, type:1}, {frame:721, type:1}, {frame:722, type:2}, {frame:723, type:2}, {frame:724, type:3}, {frame:725, type:3}, {frame:864, type:1}, {frame:865, type:1}, {frame:866, type:2}, {frame:867, type:2}, {frame:868, type:3}, {frame:869, type:3}, {frame:1008, type:1}, {frame:1009, type:1}, {frame:1010, type:2}, {frame:1011, type:2}, {frame:1012, type:3}, {frame:1013, type:4}, {frame:1152, type:1}, {frame:1153, type:1}, {frame:1154, type:1}, {frame:1155, type:2}, {frame:1156, type:2}, {frame:1157, type:2}, {frame:1296, type:1}, {frame:1297, type:1}, {frame:1298, type:1}, {frame:1299, type:2}, {frame:1300, type:2}, {frame:1301, type:2}, {frame:1440, type:3}, {frame:1441, type:3}, {frame:1442, type:3}, {frame:1443, type:4}, {frame:1444, type:4}, {frame:1445, type:4}, {frame:1584, type:3}, {frame:1585, type:3}, {frame:1586, type:3}, {frame:1587, type:4}, {frame:1588, type:4}, {frame:1589, type:4}, {frame:1728, type:1}, {frame:1729, type:1}, {frame:1730, type:2}, {frame:1731, type:2}, {frame:1732, type:3}, {frame:1733, type:3}, {frame:1872, type:2}, {frame:1873, type:2}, {frame:1874, type:3}, {frame:1875, type:3}, {frame:1876, type:4}, {frame:1877, type:4}, {frame:2016, type:1}, {frame:2017, type:1}, {frame:2018, type:2}, {frame:2019, type:2}, {frame:2020, type:3}, {frame:2021, type:3}, {frame:2022, type:4}, {frame:2023, type:4}];
_local2.powerUp_array = [0, 1, 2, 3];
_local2.framesPowerUpCreate = 360;
_local2.maxZombiesOnScreen = 11;
_local2.mapId = 0;
level88 = {};
_local2 = level88;
_local2.enemy_array = [{frame:0, type:1}, {frame:1, type:2}, {frame:2, type:3}];
_local2.powerUp_array = [0, 1, 2, 3];
_local2.framesPowerUpCreate = 100;
_local2.maxZombiesOnScreen = 10;
_local2.mapId = 0;
var _local3 = 0;
var _local1 = 1;
while (_local1 <= 25) {
_local2 = main["level" + _local1];
_local3 = _local3 + _local2.enemy_array.length;
trace((("Level " + _local1) + " ") + _local2.enemy_array.length);
_local1++;
}
trace("total zombies " + _local3);
}
function initialGameVariables() {
depth = {};
depth.action = 1;
depth.mapBG = 100;
depth.powerUp = 500;
depth.ballShadowMin = 1000;
depth.itemInit = 2000;
depth.itemMin = 2001;
game = {};
game.actionClip = "";
game.gravity = 0.25;
game.startLevel = 1;
game.currentLevel = world.currentLevel;
game.levelEnemiesTotal = 0;
game.levelEnemiesKilled = 0;
game.friends = 2;
game.nextPowerUpCreateFrame = 0;
game.status = "ready";
game.frames = 0;
field = {};
field.clip = field_mc;
field.bgClip = "";
field.maxZ = -200;
player = {};
player.clip = "";
player.clip.meterClip = "";
player.clip.meterBarClip = "";
player.minX = 20;
player.maxX = 110;
player.minZ = -510;
player.maxZ = -170;
player.height = 56;
player.healthMax = 45;
player.extraHealthMax = 60;
player.health = 0;
player.framesPerThrow = 4;
player.framesMaxThrowSpeed = 24;
player.powerUpThrowZSpeed = 10;
player.framesDown = 1;
player.backToNormalFrame = 0;
player.framesShowToNormal = 24;
player.toNormalFrame = 0;
player.framesDead = 20;
player.quitFrame = 0;
player.nextThrowFrame = 0;
player.threeWayShotsLeft = 0;
player.throwHeight = 70;
player.speed = 10;
player.extraSpeed = 15;
player.strength = 10;
player.throwSpeedMinRatio = 0.25;
player.throwSpeedMax = 30;
player.throwSpeedMin = player.throwSpeedMax * player.throwSpeedMinRatio;
player.throwSpeed = 0;
player.ballRadius = 40;
player.ballClipScale = 100;
player.initx = 80;
player.inity = 0;
player.initz = -350;
player.xmov = 0;
player.ymov = 0;
player.zmov = 0;
player.tempx = 0;
player.tempy = 0;
player.tempz = 0;
player.x = 0;
player.y = 0;
player.z = 0;
player.flashx = 0;
player.flashy = 0;
player.powerUpType = "none";
player.nextClipLabel = "none";
player.status = "dead";
player.moveStatus = "rest";
player.lastMoveStatus = "rest";
enemy = {};
enemy.item_array = [];
enemy.currentId = 0;
enemy.maxId = 100;
ball = {};
ball.minX = -50;
ball.maxX = 600;
ball.item_array = [];
ball.currentId = 0;
ball.maxId = 500;
}
function initialGameButtons() {
soundControl_btn.onRelease = function () {
if (world.soundOn) {
world.soundOn = false;
stopMusic(music.currentMusic);
this.gotoAndStop("off");
} else {
world.soundOn = true;
playMusic("gameLoop");
this.gotoAndStop("on");
}
};
}
function initialMaps() {
map0 = [];
map_obj = map0;
map_obj.id = 0;
map_obj.minX = 0;
map_obj.maxX = 400;
map_obj.minY = 0;
map_obj.maxY = 350;
}
function loadLevel(level) {
game.currentLevel = level;
var _local1 = main["level" + level];
var _local2 = _local1.mapId;
game.nextPowerUpCreateFrame = game.frames + _local1.framesPowerUpCreate;
game.levelEnemiesKilled = 0;
game.levelEnemiesTotal = _local1.enemy_array.length;
loadMap(_local2);
loadPlayer();
showPlayer();
}
function loadMap(id) {
var _local3 = main["map" + id];
var _local2 = "mapBG" + _local3.id;
var _local4 = "mapBG_mc";
var _local1 = depth.mapBG;
field.bgClip = field.clip.attachMovie(_local2, _local4, _local1);
field.bgClip._x = 0;
field.bgClip._y = 0;
}
function startGame() {
playMusic("gameLoop");
loadLevel(game.currentLevel);
loadFriends();
updateStats();
createActionControl();
game.status = "play";
}
function gameOver() {
game.status = "over";
game.actionClip.onEnterFrame = undefined;
game.actionClip.removeMovieClip();
gotoAndPlay ("gameOver");
}
function updateStats() {
playerx_txt.text = player.x;
playery_txt.text = player.y;
playerz_txt.text = player.z;
playerFlashx_txt.text = player.flashx;
playerFlashy_txt.text = player.flashy;
var _local1 = 101 - Math.round((player.health / player.healthMax) * 100);
playerHealthMeter_mc.gotoAndStop(_local1);
playerLives_txt.text = world.lives;
gameScore_txt.text = world.score;
enemiesKilledRatio_txt.text = (game.levelEnemiesKilled + "/") + game.levelEnemiesTotal;
currentLevel_txt.text = game.currentLevel;
}
function updateLevel() {
if (isNoEnemiesLeft()) {
game.status = "nextLevel";
game.actionClip.onEnterFrame = undefined;
game.actionClip.removeMovieClip();
world.currentLevel++;
if (world.currentLevel > world.totalLevels) {
gotoAndPlay ("gameWin");
} else {
gotoAndPlay ("levelComplete");
}
} else if (player.status == "quited") {
world.lives--;
if (world.lives <= 0) {
removePlayer();
gameOver();
} else {
resetPlayerStatus();
showPlayer();
}
}
}
function createActionControl() {
var _local2 = "action_mc";
var _local1 = depth.action;
game.actionClip = createEmptyMovieClip("action_mc", _local1);
game.actionClip.onEnterFrame = function () {
captureMouse();
preUpdatePlayer();
updatePowerUp();
updateBalls();
updateEnemies();
checkCollision();
updateFriends();
updatePlayer();
checkRemoveEnemies();
checkCreateEnemies();
checkCreatePowerUp();
updateEnemiesClip();
rearrangeItemClipsDepth();
updateStats();
updateLevel();
game.frames++;
};
}
stop();
main = this;
initialGameVariables();
initialGameButtons();
initialIsoWorld();
initialMaps();
initialLevels();
initialEnemyType();
initialFriends();
initialPowerUp();
startGame();
Symbol 24 MovieClip Frame 1
stop();
Symbol 24 MovieClip Frame 11
stop();
Symbol 24 MovieClip Frame 19
Symbol 26 MovieClip Frame 30
gotoAndPlay ("normal");
Symbol 26 MovieClip Frame 36
stop();
Symbol 26 MovieClip Frame 54
gotoAndPlay ("readyToThrowMove");
Symbol 26 MovieClip Frame 65
gotoAndPlay ("normal");
Symbol 26 MovieClip Frame 66
Symbol 26 MovieClip Frame 83
gotoAndPlay ("move");
Symbol 26 MovieClip Frame 88
gotoAndPlay ("normal");
Symbol 26 MovieClip Frame 105
stop();
Symbol 61 MovieClip Frame 22
gotoAndPlay ("normal");
Symbol 61 MovieClip Frame 56
gotoAndPlay ("move");
Symbol 65 MovieClip Frame 1
stop();
Symbol 65 MovieClip Frame 30
gotoAndPlay ("normal");
Symbol 65 MovieClip Frame 36
Symbol 65 MovieClip Frame 47
gotoAndPlay ("normal");
Symbol 65 MovieClip Frame 48
Symbol 65 MovieClip Frame 65
gotoAndPlay ("move");
Symbol 65 MovieClip Frame 70
gotoAndPlay ("normal");
Symbol 74 MovieClip [powerUp0] Frame 7
gotoAndPlay ("roll");
Symbol 74 MovieClip [powerUp0] Frame 15
stop();
Symbol 75 MovieClip [powerUp1] Frame 7
gotoAndPlay ("roll");
Symbol 75 MovieClip [powerUp1] Frame 15
stop();
Symbol 76 MovieClip [powerUp3] Frame 7
gotoAndPlay ("roll");
Symbol 76 MovieClip [powerUp3] Frame 15
stop();
Symbol 77 MovieClip [powerUp2] Frame 7
gotoAndPlay ("roll");
Symbol 77 MovieClip [powerUp2] Frame 15
stop();
Symbol 86 MovieClip Frame 20
gotoAndPlay ("normal");
Symbol 86 MovieClip Frame 54
gotoAndPlay ("move");
Symbol 91 MovieClip Frame 22
gotoAndPlay ("normal");
Symbol 91 MovieClip Frame 56
gotoAndPlay ("move");
Symbol 97 MovieClip [ball0] Frame 61
if (this.score == 0) {
score_mc.score_txt.text = "";
} else {
score_mc.score_txt.text = this.score;
}
Symbol 97 MovieClip [ball0] Frame 62
if (this.score == 0) {
score_mc.score_txt.text = "";
} else {
score_mc.score_txt.text = this.score;
}
Symbol 97 MovieClip [ball0] Frame 63
if (this.score == 0) {
score_mc.score_txt.text = "";
} else {
score_mc.score_txt.text = this.score;
}
Symbol 97 MovieClip [ball0] Frame 75
stop();
Symbol 100 MovieClip Frame 22
gotoAndPlay ("normal");
Symbol 100 MovieClip Frame 56
gotoAndPlay ("move");
Symbol 105 MovieClip [ball1] Frame 61
if (this.score == 0) {
score_mc.score_txt.text = "";
} else {
score_mc.score_txt.text = this.score;
}
Symbol 105 MovieClip [ball1] Frame 62
if (this.score == 0) {
score_mc.score_txt.text = "";
} else {
score_mc.score_txt.text = this.score;
}
Symbol 105 MovieClip [ball1] Frame 63
if (this.score == 0) {
score_mc.score_txt.text = "";
} else {
score_mc.score_txt.text = this.score;
}
Symbol 105 MovieClip [ball1] Frame 75
stop();
Symbol 132 MovieClip Frame 1
Symbol 132 MovieClip Frame 10
this.gotoAndPlay("default");
Symbol 132 MovieClip Frame 15
this.gotoAndPlay("default");
Symbol 132 MovieClip Frame 16
Symbol 132 MovieClip Frame 23
this.gotoAndPlay("move");
Symbol 164 MovieClip Frame 1
stop();
Symbol 164 MovieClip Frame 11
stop();
Symbol 173 MovieClip Frame 7
gotoAndPlay ("powerUp0");
Symbol 173 MovieClip Frame 14
gotoAndPlay ("powerUp1");
Symbol 173 MovieClip Frame 21
gotoAndPlay ("powerUp2");
Symbol 173 MovieClip Frame 29
stop();
Symbol 230 MovieClip Frame 1
stop();
Symbol 230 MovieClip Frame 19
trace("BACKKKKKKKKKKKKK");
this.gotoAndPlay("glow");