Frame 1
function initialMusic() {
music = {};
music.lastMusic = "none";
music.currentMusic = "none";
music.menuLoop = new Sound();
music.menuLoop.attachSound("musicLoopMenu");
music.gameLoop = new Sound();
music.gameLoop.attachSound("musicLoopGame");
}
function initialSFX() {
sfx = {};
sfx.buttonRelease = new Sound();
sfx.buttonRelease.attachSound("sfxButtonRelease");
sfx.buttonRollOver = new Sound();
sfx.buttonRollOver.attachSound("sfxButtonRollOver");
sfx.enemyEscape = new Sound();
sfx.enemyEscape.attachSound("sfxEnemyEscape");
sfx.shoot = new Sound();
sfx.shoot.attachSound("sfxShoot");
sfx.bossEscape = new Sound();
sfx.bossEscape.attachSound("sfxBossEscape");
sfx.player0Hit = new Sound();
sfx.player0Hit.attachSound("sfxPlayer0Hit");
sfx.player1Hit = new Sound();
sfx.player1Hit.attachSound("sfxPlayer1Hit");
sfx.bossLaugh = new Sound();
sfx.bossLaugh.attachSound("sfxBossLaugh");
}
function playMusic(name) {
if (music.currentMusic != "none") {
stopMusic(music.currentMusic);
}
music.currentMusic = name;
var _local1 = music[name];
_local1.start();
_local1.onSoundComplete = function () {
playMusic(music.currentMusic);
};
if (world.soundOn) {
_local1.setVolume(100);
} else {
_local1.setVolume(0);
}
}
function stopMusic(name) {
music.currentMusic = "none";
var _local1 = music[name];
_local1.stop();
}
function playSFX(name) {
if (world.soundOn) {
if (name == "enemyEscape") {
stopSFX(name);
}
var _local2 = sfx[name];
_local2.start();
}
}
function stopSFX(name) {
var _local1 = sfx[name];
_local1.stop();
}
function initialWorldVariables() {
world = {};
world.gameId = 227;
world.fps = 30;
world.path = this._url.substr(0, this._url.indexOf(".com") + 5);
world.playerId = -1;
world.currentLevel = 1;
world.totalLevels = 12;
world.playerName = null;
world.score = 0;
world.soundOn = true;
world.player0Speed = 8;
world.player0FramesShoot = 18;
world.player1Speed = 7.4;
world.player1FramesShoot = 12;
}
function resetWorldVariables() {
world.playerId = -1;
world.currentLevel = 1;
world.totalLevels = 10;
world.score = 0;
}
function initialSoundButton() {
sound_btn.onRelease = function () {
if (world.soundOn) {
world.soundOn = false;
music.menuLoop.setVolume(0);
music.gameLoop.setVolume(0);
music.lastMusic = music.currentMusic;
this.gotoAndStop("off");
} else {
world.soundOn = true;
music.menuLoop.setVolume(100);
music.gameLoop.setVolume(100);
this.gotoAndStop("on");
}
};
}
function initialLevels() {
var _local1 = (level1 = {});
_local1.framesBonus = 480;
_local1.totalEnemies = 3;
_local1.maxEnemiesOnField = 3;
_local1.enemyMinWalkSpeed = 0.7;
_local1.enemyMaxWalkSpeed = 1;
_local1.enemyMinRunSpeed = 0.7;
_local1.enemyMaxRunSpeed = 1.2;
_local1.enemyMinFramesRest = 90;
_local1.enemyMaxFramesRest = 240;
_local1.framesBossShoot = 210;
_local1.bossShootSpeed = 3;
_local1.framesCreatePowerItem = 999999 /* 0x0F423F */;
_local1.powerUp3Way = false;
_local1.powerUpChange = false;
_local1.powerUpSpeed = false;
_local1.powerUpMachineGun = false;
_local1.powerUp4Way = false;
_local1 = (level2 = {});
_local1.framesBonus = 600;
_local1.totalEnemies = 6;
_local1.maxEnemiesOnField = 4;
_local1.enemyMinWalkSpeed = 1.2;
_local1.enemyMaxWalkSpeed = 1.5;
_local1.enemyMinRunSpeed = 1.5;
_local1.enemyMaxRunSpeed = 2;
_local1.enemyMinFramesRest = 90;
_local1.enemyMaxFramesRest = 180;
_local1.framesBossShoot = 150;
_local1.bossShootSpeed = 4;
_local1.framesCreatePowerItem = 300;
_local1.powerUp3Way = true;
_local1.powerUpChange = false;
_local1.powerUpSpeed = false;
_local1.powerUpMachineGun = false;
_local1.powerUp4Way = false;
_local1 = (level3 = {});
_local1.framesBonus = 900;
_local1.totalEnemies = 10;
_local1.maxEnemiesOnField = 4;
_local1.enemyMinWalkSpeed = 1.6;
_local1.enemyMaxWalkSpeed = 2.2;
_local1.enemyMinRunSpeed = 2.2;
_local1.enemyMaxRunSpeed = 2.8;
_local1.enemyMinFramesRest = 80;
_local1.enemyMaxFramesRest = 160;
_local1.framesBossShoot = 110;
_local1.bossShootSpeed = 5;
_local1.framesCreatePowerItem = 300;
_local1.powerUp3Way = false;
_local1.powerUpChange = true;
_local1.powerUpSpeed = false;
_local1.powerUpMachineGun = false;
_local1.powerUp4Way = false;
_local1 = (level4 = {});
_local1.framesBonus = 1200;
_local1.totalEnemies = 15;
_local1.maxEnemiesOnField = 4;
_local1.enemyMinWalkSpeed = 2;
_local1.enemyMaxWalkSpeed = 2.6;
_local1.enemyMinRunSpeed = 2.6;
_local1.enemyMaxRunSpeed = 3.2;
_local1.enemyMinFramesRest = 70;
_local1.enemyMaxFramesRest = 140;
_local1.framesBossShoot = 80;
_local1.bossShootSpeed = 6;
_local1.framesCreatePowerItem = 270;
_local1.powerUp3Way = true;
_local1.powerUpChange = true;
_local1.powerUpSpeed = false;
_local1.powerUpMachineGun = false;
_local1.powerUp4Way = false;
_local1 = (level5 = {});
_local1.framesBonus = 1500;
_local1.totalEnemies = 20;
_local1.maxEnemiesOnField = 5;
_local1.enemyMinWalkSpeed = 2;
_local1.enemyMaxWalkSpeed = 2.6;
_local1.enemyMinRunSpeed = 2.6;
_local1.enemyMaxRunSpeed = 3.2;
_local1.enemyMinFramesRest = 70;
_local1.enemyMaxFramesRest = 140;
_local1.framesBossShoot = 80;
_local1.bossShootSpeed = 6;
_local1.framesCreatePowerItem = 270;
_local1.powerUp3Way = false;
_local1.powerUpChange = false;
_local1.powerUpSpeed = true;
_local1.powerUpMachineGun = false;
_local1.powerUp4Way = false;
_local1 = (level6 = {});
_local1.framesBonus = 1800;
_local1.totalEnemies = 25;
_local1.maxEnemiesOnField = 5;
_local1.enemyMinWalkSpeed = 2.2;
_local1.enemyMaxWalkSpeed = 2.8;
_local1.enemyMinRunSpeed = 2.8;
_local1.enemyMaxRunSpeed = 3.4;
_local1.enemyMinFramesRest = 60;
_local1.enemyMaxFramesRest = 120;
_local1.framesBossShoot = 70;
_local1.bossShootSpeed = 6.5;
_local1.framesCreatePowerItem = 270;
_local1.powerUp3Way = false;
_local1.powerUpChange = true;
_local1.powerUpSpeed = true;
_local1.powerUpMachineGun = false;
_local1.powerUp4Way = false;
_local1 = (level7 = {});
_local1.framesBonus = 2100;
_local1.totalEnemies = 30;
_local1.maxEnemiesOnField = 5;
_local1.enemyMinWalkSpeed = 2.4;
_local1.enemyMaxWalkSpeed = 3;
_local1.enemyMinRunSpeed = 3;
_local1.enemyMaxRunSpeed = 3.6;
_local1.enemyMinFramesRest = 50;
_local1.enemyMaxFramesRest = 100;
_local1.framesBossShoot = 65;
_local1.bossShootSpeed = 7;
_local1.framesCreatePowerItem = 240;
_local1.powerUp3Way = false;
_local1.powerUpChange = false;
_local1.powerUpSpeed = true;
_local1.powerUpMachineGun = true;
_local1.powerUp4Way = false;
_local1 = (level8 = {});
_local1.framesBonus = 2400;
_local1.totalEnemies = 35;
_local1.maxEnemiesOnField = 6;
_local1.enemyMinWalkSpeed = 2.4;
_local1.enemyMaxWalkSpeed = 3;
_local1.enemyMinRunSpeed = 3;
_local1.enemyMaxRunSpeed = 3.6;
_local1.enemyMinFramesRest = 50;
_local1.enemyMaxFramesRest = 100;
_local1.framesBossShoot = 65;
_local1.bossShootSpeed = 7;
_local1.framesCreatePowerItem = 240;
_local1.powerUp3Way = false;
_local1.powerUpChange = true;
_local1.powerUpSpeed = true;
_local1.powerUpMachineGun = true;
_local1.powerUp4Way = false;
_local1 = (level9 = {});
_local1.framesBonus = 2700;
_local1.totalEnemies = 40;
_local1.maxEnemiesOnField = 6;
_local1.enemyMinWalkSpeed = 2.4;
_local1.enemyMaxWalkSpeed = 3;
_local1.enemyMinRunSpeed = 3.2;
_local1.enemyMaxRunSpeed = 3.8;
_local1.enemyMinFramesRest = 40;
_local1.enemyMaxFramesRest = 80;
_local1.framesBossShoot = 60;
_local1.bossShootSpeed = 7.5;
_local1.framesCreatePowerItem = 240;
_local1.powerUp3Way = false;
_local1.powerUpChange = true;
_local1.powerUpSpeed = true;
_local1.powerUpMachineGun = true;
_local1.powerUp4Way = true;
_local1 = (level10 = {});
_local1.framesBonus = 3600;
_local1.totalEnemies = 50;
_local1.maxEnemiesOnField = 7;
_local1.enemyMinWalkSpeed = 3;
_local1.enemyMaxWalkSpeed = 3.6;
_local1.enemyMinRunSpeed = 3.5;
_local1.enemyMaxRunSpeed = 4;
_local1.enemyMinFramesRest = 20;
_local1.enemyMaxFramesRest = 60;
_local1.framesBossShoot = 50;
_local1.bossShootSpeed = 8;
_local1.framesCreatePowerItem = 240;
_local1.powerUp3Way = true;
_local1.powerUpChange = true;
_local1.powerUpSpeed = true;
_local1.powerUpMachineGun = true;
_local1.powerUp4Way = true;
_local1 = (level11 = {});
_local1.framesBonus = 4200;
_local1.totalEnemies = 60;
_local1.maxEnemiesOnField = 7;
_local1.enemyMinWalkSpeed = 3.2;
_local1.enemyMaxWalkSpeed = 3.8;
_local1.enemyMinRunSpeed = 3.7;
_local1.enemyMaxRunSpeed = 4.2;
_local1.enemyMinFramesRest = 15;
_local1.enemyMaxFramesRest = 50;
_local1.framesBossShoot = 45;
_local1.bossShootSpeed = 9;
_local1.framesCreatePowerItem = 240;
_local1.powerUp3Way = true;
_local1.powerUpChange = true;
_local1.powerUpSpeed = true;
_local1.powerUpMachineGun = true;
_local1.powerUp4Way = true;
_local1 = (level12 = {});
_local1.framesBonus = 4800;
_local1.totalEnemies = 70;
_local1.maxEnemiesOnField = 7;
_local1.enemyMinWalkSpeed = 3.4;
_local1.enemyMaxWalkSpeed = 4;
_local1.enemyMinRunSpeed = 3.8;
_local1.enemyMaxRunSpeed = 4.4;
_local1.enemyMinFramesRest = 15;
_local1.enemyMaxFramesRest = 45;
_local1.framesBossShoot = 45;
_local1.bossShootSpeed = 10;
_local1.framesCreatePowerItem = 240;
_local1.powerUp3Way = true;
_local1.powerUpChange = true;
_local1.powerUpSpeed = true;
_local1.powerUpMachineGun = true;
_local1.powerUp4Way = true;
}
function gotoAndNextLevel() {
world.currentLevel++;
gotoAndPlay ("game");
}
funcHITBOX = function (arEvent, arAction) {
lString = ((("javascript: _hbLink ('/flash/" + arEvent.toLowerCase()) + "/") + arAction.toLowerCase()) + "','left','0,0,0,0')";
getURL (lString);
};
main = this;
initialWorldVariables();
initialLevels();
initialMusic();
initialSFX();
initialSoundButton();
Frame 2
function initialTitleButtons() {
play_btn.onRollOver = function () {
playSFX("buttonRollOver");
};
play_btn.onRelease = function () {
playSFX("buttonRelease");
_root.funcHITBOX("play_activity", "play_from_title");
gotoAndPlay ("options");
};
instructions_btn.onRollOver = function () {
playSFX("buttonRollOver");
};
instructions_btn.onRelease = function () {
playSFX("buttonRelease");
_root.funcHITBOX("misc", "instructions");
gotoAndPlay ("instructions");
};
highScores_btn.onRollOver = function () {
playSFX("buttonRollOver");
};
highScores_btn.onRelease = function () {
playSFX("buttonRelease");
_root.funcHITBOX("misc", "high_scores");
gotoAndPlay ("highScores");
};
}
function updateTitleMusic() {
if (music.currentMusic != "menuLoop") {
playMusic("menuLoop");
}
}
stop();
updateTitleMusic();
initialTitleButtons();
Frame 10
function initialInstructionButtons() {
play_btn.onRollOver = function () {
playSFX("buttonRollOver");
};
play_btn.onRelease = function () {
_root.funcHITBOX("play_activity", "play_from_instructions");
playSFX("buttonRelease");
gotoAndPlay ("options");
};
}
stop();
initialInstructionButtons();
Frame 20
function initialOptionsButtons() {
player0_btn.onRollOver = function () {
playSFX("buttonRollOver");
};
player0_btn.onRelease = function () {
playSFX("buttonRelease");
_root.funcHITBOX("misc", "select_abby");
world.playerId = 0;
gotoAndPlay ("game");
};
player1_btn.onRollOver = function () {
playSFX("buttonRollOver");
};
player1_btn.onRelease = function () {
playSFX("buttonRelease");
_root.funcHITBOX("misc", "select_ty");
world.playerId = 1;
gotoAndPlay ("game");
};
}
stop();
initialOptionsButtons();
Frame 30
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);
_local3 = boss;
_local1.push(_local3);
var _local2 = 0;
while (_local2 < enemy.currentId) {
_local3 = main["enemy" + _local2];
_local1.push(_local3);
_local2++;
}
_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 isCollision(circle1_obj, circle2_obj) {
var _local1 = circle1_obj.x - circle2_obj.x;
var _local2 = circle1_obj.z - circle2_obj.z;
var _local6 = Math.sqrt((_local1 * _local1) + (_local2 * _local2));
var _local5 = circle1_obj.radius + circle2_obj.radius;
return(_local6 < _local5);
}
function checkCollisions() {
if (game.mode == "catch") {
if (player.status == "normal") {
checkPlayerGetBoss();
checkBossBulletsGetPlayer();
checkEnemiesGetPlayer();
}
} else if (game.mode == "shoot") {
if (player.status == "normal") {
checkPlayerGetPowerItems();
checkPlayerBulletsGetEnemies();
checkEnemiesGetPlayer();
}
}
}
function checkPlayerGetPowerItems() {
var _local2 = 0;
while (_local2 < powerItem.currentId) {
var _local1 = main["powerItem" + _local2];
if (_local1.status == "normal") {
var _local3 = isCollision(player, _local1);
if (_local3) {
removePowerItem(_local1);
if (player.powerUpStatus == "change") {
changePlayerToBoss();
}
playerPowerUp(_local1.type);
}
}
_local2++;
}
}
function checkBossBulletsGetPlayer() {
var _local2 = 0;
while (_local2 < bossBullet.currentId) {
var _local1 = main["bossBullet" + _local2];
if (_local1.status == "air") {
var _local3 = isCollision(_local1, player);
if (_local3) {
playSFX(("player" + world.playerId) + "Hit");
game.mode = "gameLose";
playerDie();
removeBossBullet(_local1);
}
}
_local2++;
}
}
function checkEnemiesGetPlayer() {
var _local2 = 0;
while (_local2 < enemy.currentId) {
var _local1 = main["enemy" + _local2];
if ((_local1.status != "removed") && (_local1.status != "hit")) {
var _local3 = isCollision(_local1, player);
if (_local3) {
playSFX(("player" + world.playerId) + "Hit");
game.mode = "gameLose";
playerDie();
}
}
_local2++;
}
}
function checkPlayerBulletsGetEnemies() {
var _local5 = 0;
while (_local5 < playerBullet.currentId) {
var _local3 = main["playerBullet" + _local5];
if (_local3.status == "air") {
var _local2 = 0;
while (_local2 < enemy.currentId) {
var _local1 = main["enemy" + _local2];
if ((_local1.status != "removed") && (_local1.status != "hit")) {
var _local4 = isCollision(_local3, _local1);
if (_local4) {
playSFX("enemyEscape");
addLevelScore(score.enemy);
removePlayerBullet(_local3);
hitEnemy(_local1);
game.enemiesKilled++;
game.enemiesOnField--;
}
}
_local2++;
}
}
_local5++;
}
}
function checkPlayerGetBoss() {
if (player.status != "hit") {
var _local1 = isCollision(player, boss);
if (_local1) {
playSFX("bossEscape");
addLevelScore(score.boss);
changeGameModeTo("bossEscape");
}
}
}
function loadPlayer() {
player.speed = world[("player" + world.playerId) + "Speed"];
player.framesShoot = world[("player" + world.playerId) + "FramesShoot"];
player.clip = field.clip.attachMovie("player" + world.playerId, "player_mc", depth.player);
player.animationsClip = player.clip.animations_mc;
player.x = player.initx;
player.y = player.inity;
player.z = player.initz;
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.clip._xscale = field.minClipScale + (((player.z - field.maxz) / field.minz) * (100 - field.minClipScale));
player.clip._yscale = field.minClipScale + (((player.z - field.maxz) / field.minz) * (100 - field.minClipScale));
player.status = "normal";
player.powerUpStatus = "none";
player.direction = "right";
}
function playerPowerUp(type) {
hideEnemiesQuestionSymbols();
player.powerUpStatus = type;
if (player.powerUpStatus == "change") {
changePlayerToBossLook();
showEnemiesQuestionSymbols();
player.powerUpEndFrame = game.frames + player.framesPowerUp;
trace("power boss");
} else if (player.powerUpStatus == "speed") {
player.powerUpEndFrame = game.frames + player.framesPowerUp;
trace("power speed");
} else if (player.powerUpStatus == "machineGun") {
player.powerUpEndFrame = game.frames + player.framesPowerUp;
trace("power machineGun");
} else if (player.powerUpStatus == "3Way") {
player.powerUpEndFrame = game.frames + player.framesPowerUp;
trace("power 3Way");
} else if (player.powerUpStatus == "4Way") {
player.powerUpEndFrame = game.frames + player.framesPowerUp;
trace("power 4Way");
} else if (player.powerUpStatus == "bomb") {
trace("power bomb");
}
}
function changePlayerToBossLook() {
player.clip.removeMovieClip();
player.clip = field.clip.attachMovie("boss", "player_mc", depth.player);
player.animationsClip = player.clip.animations_mc;
}
function changePlayerToBoss() {
player.clip.removeMovieClip();
player.clip = field.clip.attachMovie("player" + world.playerId, "player_mc", depth.player);
player.animationsClip = player.clip.animations_mc;
}
function playerDie() {
trace("die");
player.xmov = 0;
player.zmov = 0;
player.status = "hit";
player.animationsClip.gotoAndStop(player.direction);
player.animationsClip.char_mc.gotoAndPlay("hit");
}
function captureKeys() {
if (((game.mode == "catch") || (game.mode == "bossEscape")) || (game.mode == "shoot")) {
if (player.status == "normal") {
var _local3 = Key.isDown(37);
var _local1 = Key.isDown(39);
var _local2 = Key.isDown(38);
var _local4 = Key.isDown(40);
var _local5 = Key.isDown(32);
if ((((!_local3) && (!_local1)) && (!_local2)) && (!_local4)) {
player.xmov = 0;
player.zmov = 0;
} else if (_local3) {
player.direction = "left";
player.xmov = -player.speed;
if (player.powerUpStatus == "speed") {
player.xmov = player.xmov * 2;
}
player.zmov = 0;
} else if (_local1) {
player.direction = "right";
player.xmov = player.speed;
if (player.powerUpStatus == "speed") {
player.xmov = player.xmov * 2;
}
player.zmov = 0;
} else if (_local2) {
player.xmov = 0;
player.zmov = player.speed;
if (player.powerUpStatus == "speed") {
player.zmov = player.zmov * 2;
}
} else if (_local4) {
player.xmov = 0;
player.zmov = -player.speed;
if (player.powerUpStatus == "speed") {
player.zmov = player.zmov * 2;
}
}
}
}
if (game.mode == "shoot") {
if (player.status == "normal") {
if (_local5) {
if (game.frames > player.nextShootFrame) {
playSFX("shoot");
playerShoot(player.direction);
}
}
}
}
}
function playerShoot() {
var _local1 = 0;
if (player.direction == "left") {
if (player.powerUpStatus == "3Way") {
createPlayerBullet(player.shootDamage, player.x - 25, player.y - 55, player.z, -player.shootSpeed, 0, -5);
createPlayerBullet(player.shootDamage, player.x - 25, player.y - 55, player.z, -player.shootSpeed, 0, 5);
createPlayerBullet(player.shootDamage, player.x - 25, player.y - 55, player.z, -player.shootSpeed, 0, 0);
player.nextShootFrame = game.frames + player.framesShoot;
} else if (player.powerUpStatus == "4Way") {
createPlayerBullet(player.shootDamage, player.x - 25, player.y - 55, player.z, player.shootSpeed, 0, 0);
createPlayerBullet(player.shootDamage, player.x - 25, player.y - 55, player.z, -player.shootSpeed, 0, 0);
createPlayerBullet(player.shootDamage, player.x - 25, player.y - 55, player.z, 0, 0, player.shootSpeed);
createPlayerBullet(player.shootDamage, player.x - 25, player.y - 55, player.z, 0, 0, -player.shootSpeed);
player.nextShootFrame = game.frames + player.framesShoot;
} else if (player.powerUpStatus == "machineGun") {
createPlayerBullet(player.shootDamage, player.x - 25, player.y - 55, player.z, -player.shootSpeed, 0, 0);
player.nextShootFrame = game.frames + player.framesPowerUpShoot;
} else {
createPlayerBullet(player.shootDamage, player.x - 25, player.y - 55, player.z, -player.shootSpeed, 0, 0);
player.nextShootFrame = game.frames + player.framesShoot;
}
} else if (player.powerUpStatus == "3Way") {
createPlayerBullet(player.shootDamage, player.x + 25, player.y - 55, player.z, player.shootSpeed, 0, -5);
createPlayerBullet(player.shootDamage, player.x + 25, player.y - 55, player.z, player.shootSpeed, 0, 5);
createPlayerBullet(player.shootDamage, player.x + 25, player.y - 55, player.z, player.shootSpeed, 0, 0);
player.nextShootFrame = game.frames + player.framesShoot;
} else if (player.powerUpStatus == "4Way") {
createPlayerBullet(player.shootDamage, player.x + 25, player.y - 55, player.z, player.shootSpeed, 0, 0);
createPlayerBullet(player.shootDamage, player.x + 25, player.y - 55, player.z, -player.shootSpeed, 0, 0);
createPlayerBullet(player.shootDamage, player.x + 25, player.y - 55, player.z, 0, 0, player.shootSpeed);
createPlayerBullet(player.shootDamage, player.x + 25, player.y - 55, player.z, 0, 0, -player.shootSpeed);
player.nextShootFrame = game.frames + player.framesShoot;
} else if (player.powerUpStatus == "machineGun") {
createPlayerBullet(player.shootDamage, player.x + 25, player.y - 55, player.z, player.shootSpeed, 0, 0);
player.nextShootFrame = game.frames + player.framesPowerUpShoot;
} else {
createPlayerBullet(player.shootDamage, player.x + 25, player.y - 55, player.z, player.shootSpeed, 0, 0);
player.nextShootFrame = game.frames + player.framesShoot;
}
player.animationsClip.char_mc.gotoAndPlay("shoot");
}
function createPlayerBullet(damage, x, y, z, xmov, ymov, zmov) {
var _local1 = (main["playerBullet" + playerBullet.currentId] = {});
_local1.clip = field.clip.attachMovie("player bullet", ("playerBullet" + playerBullet.currentId) + "_mc", depth.playerBullets + playerBullet.currentId);
_local1.damage = damage;
_local1.radius = playerBullet.radius;
_local1.x = x;
_local1.y = y;
_local1.z = z;
_local1.xmov = xmov;
_local1.ymov = ymov;
_local1.zmov = zmov;
var _local2 = mapToScreen(_local1.x, _local1.y, _local1.z);
_local1.flashx = _local2[0];
_local1.flashy = _local2[1];
_local1.clip._x = _local1.flashx;
_local1.clip._y = _local1.flashy;
_local1.clip._xscale = field.minClipScale + (((_local1.z - field.maxz) / field.minz) * (100 - field.minClipScale));
_local1.clip._yscale = field.minClipScale + (((_local1.z - field.maxz) / field.minz) * (100 - field.minClipScale));
_local1.status = "air";
playerBullet.currentId++;
}
function removePlayerBullet(bullet_obj) {
bullet_obj.clip.removeMovieClip();
bullet_obj.status = "removed";
bullet_obj = {};
}
function updatePlayerBullet() {
var _local2 = 0;
while (_local2 < playerBullet.currentId) {
var _local1 = main["playerBullet" + _local2];
if (_local1.status == "air") {
_local1.x = _local1.x + _local1.xmov;
_local1.y = _local1.y + _local1.ymov;
_local1.z = _local1.z + _local1.zmov;
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._xscale = field.minClipScale + (((_local1.z - field.maxz) / field.minz) * (100 - field.minClipScale));
_local1.clip._yscale = field.minClipScale + (((_local1.z - field.maxz) / field.minz) * (100 - field.minClipScale));
}
_local2++;
}
}
function updatePlayer() {
var _local4 = field.minx + player.radius;
var _local2 = field.maxx - player.radius;
var _local3 = field.minz + player.radius;
var _local1 = field.maxz - player.radius;
player.x = player.x + player.xmov;
player.y = player.y + player.ymov;
player.z = player.z + player.zmov;
if (player.x < _local4) {
player.x = _local4;
} else if (player.x > _local2) {
player.x = _local2;
}
if (player.z < _local3) {
player.z = _local3;
} else if (player.z > _local1) {
player.z = _local1;
}
var _local5 = mapToScreen(player.x, player.y, player.z);
player.flashx = _local5[0];
player.flashy = _local5[1];
player.clip._x = player.flashx;
player.clip._y = player.flashy;
player.clip._xscale = field.minClipScale + (((player.z - field.maxz) / field.minz) * (100 - field.minClipScale));
player.clip._yscale = field.minClipScale + (((player.z - field.maxz) / field.minz) * (100 - field.minClipScale));
if (game.mode == "catch") {
if (player.status == "normal") {
player.animationsClip.gotoAndStop(player.direction);
} else if (player.status == "hit") {
if (player.animationsClip.char_mc._currentframe == player.animationsClip.char_mc._totalframes) {
gameOver();
}
}
} else if (game.mode == "bossEscape") {
if (player.status == "normal") {
player.animationsClip.gotoAndStop(player.direction + "Gun");
}
} else if (game.mode == "shoot") {
if (player.powerUpStatus != "none") {
if (game.frames > player.powerUpEndFrame) {
if (player.powerUpStatus == "change") {
changePlayerToBoss();
hideEnemiesQuestionSymbols();
}
player.powerUpStatus = "none";
}
}
if (player.status == "normal") {
player.animationsClip.gotoAndStop(player.direction + "Gun");
}
} else if (game.mode == "gameLose") {
if (player.status == "hit") {
if (player.animationsClip.char_mc._currentframe == player.animationsClip.char_mc._totalframes) {
gameOver();
}
}
}
}
function loadBoss() {
boss.clip = field.clip.attachMovie("boss", "boss_mc", depth.boss);
boss.animationsClip = boss.clip.animations_mc;
boss.x = boss.initx;
boss.y = boss.inity;
boss.z = boss.initz;
var _local1 = mapToScreen(boss.x, boss.y, boss.z);
boss.flashx = _local1[0];
boss.flashy = _local1[1];
boss.clip._x = boss.flashx;
boss.clip._y = boss.flashy;
boss.clip._xscale = field.minClipScale + (((boss.z - field.maxz) / field.minz) * (100 - field.minClipScale));
boss.clip._yscale = field.minClipScale + (((boss.z - field.maxz) / field.minz) * (100 - field.minClipScale));
boss.nextShootFrame = game.frames + (boss.framesShoot / 3);
boss.direction = "left";
boss.status = "rest";
boss.animationsClip.gotoAndStop(boss.direction + "Gun");
}
function bossShoot() {
var _local4 = player.x - boss.x;
var _local5 = player.z - boss.z;
var _local7 = Math.sqrt((_local4 * _local4) + (_local5 * _local5));
var _local1 = (boss.shootSpeed * _local4) / _local7;
var _local6 = (boss.shootSpeed * _local5) / _local7;
var _local3 = 0;
var _local2 = 0.3;
_local1 = _local1 * ((((_local2 * 2) * Math.random()) - _local2) + 1);
_local3 = _local3 * ((((_local2 * 2) * Math.random()) - _local2) + 1);
if (_local1 > 0) {
playSFX("shoot");
boss.direction = "right";
createBossBullet(boss.shootDamage, boss.x + 20, boss.y - 35, boss.z, _local1, _local3, _local6);
} else {
playSFX("shoot");
boss.direction = "left";
createBossBullet(boss.shootDamage, boss.x - 20, boss.y - 35, boss.z, _local1, _local3, _local6);
}
boss.animationsClip.gotoAndStop(boss.direction + "Gun");
boss.animationsClip.char_mc.gotoAndPlay("shoot");
}
function createBossBullet(damage, x, y, z, xmov, ymov, zmov) {
var _local1 = (main["bossBullet" + bossBullet.currentId] = {});
_local1.clip = field.clip.attachMovie("boss bullet", ("bossBullet" + bossBullet.currentId) + "_mc", depth.bossBullets + bossBullet.currentId);
_local1.damage = damage;
_local1.radius = bossBullet.radius;
_local1.x = x;
_local1.y = y;
_local1.z = z;
_local1.xmov = xmov;
_local1.ymov = ymov;
_local1.zmov = zmov;
var _local2 = mapToScreen(_local1.x, _local1.y, _local1.z);
_local1.flashx = _local2[0];
_local1.flashy = _local2[1];
_local1.clip._x = _local1.flashx;
_local1.clip._y = _local1.flashy;
_local1.clip._xscale = field.minClipScale + (((_local1.z - field.maxz) / field.minz) * (100 - field.minClipScale));
_local1.clip._yscale = field.minClipScale + (((_local1.z - field.maxz) / field.minz) * (100 - field.minClipScale));
_local1.status = "air";
bossBullet.currentId++;
}
function removeAllBossBullets() {
var _local1 = 0;
while (_local1 < bossBullet.currentId) {
var _local2 = main["bossBullet" + _local1];
if (_local2.status == "air") {
removeBossBullet(_local2);
}
_local1++;
}
}
function removeBossBullet(bullet_obj) {
bullet_obj.clip.removeMovieClip();
bullet_obj.status = "removed";
bullet_obj = {};
}
function updateBossBullet() {
var _local2 = 0;
while (_local2 < bossBullet.currentId) {
var _local1 = main["bossBullet" + _local2];
if (_local1.status == "air") {
_local1.x = _local1.x + _local1.xmov;
_local1.y = _local1.y + _local1.ymov;
_local1.z = _local1.z + _local1.zmov;
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._xscale = field.minClipScale + (((_local1.z - field.maxz) / field.minz) * (100 - field.minClipScale));
_local1.clip._yscale = field.minClipScale + (((_local1.z - field.maxz) / field.minz) * (100 - field.minClipScale));
}
_local2++;
}
}
function updateBoss() {
if (game.mode == "catch") {
if (game.frames > boss.nextShootFrame) {
bossShoot();
boss.nextShootFrame = game.frames + boss.framesShoot;
}
} else if (game.mode == "shoot") {
if (boss.status == "escape") {
}
}
}
function createEnemy(type, radius, health, walkSpeed, runSpeed, maxWalkRadius, minFramesRest, maxFramesRest, x, y, z) {
var _local1 = (main["enemy" + enemy.currentId] = {});
_local1.id = enemy.currentId;
_local1.type = type;
_local1.clip = field.clip.attachMovie("enemy" + _local1.type, ("enemy_" + _local1.id) + "_mc", depth.enemies + _local1.id);
_local1.animationsClip = _local1.clip.animations_mc;
_local1.radius = radius;
_local1.walkSpeed = walkSpeed;
_local1.runSpeed = runSpeed;
_local1.maxWalkRadius = maxWalkRadius;
_local1.minFramesRest = minFramesRest;
_local1.maxFramesRest = maxFramesRest;
_local1.initx = x;
_local1.inity = y;
_local1.initz = z;
_local1.xmov = 0;
_local1.ymov = 0;
_local1.zmov = 0;
_local1.x = _local1.initx;
_local1.y = _local1.inity;
_local1.z = _local1.initz;
_local1.targetx = 0;
_local1.targety = 0;
_local1.targetz = 0;
_local1.flashx = 0;
_local1.flashy = 0;
_local1.nextWalkFrame = 0;
var _local2 = mapToScreen(_local1.x, _local1.y, _local1.z);
_local1.flashx = _local2[0];
_local1.flashy = _local2[1];
_local1.clip._x = _local1.flashx;
_local1.clip._y = _local1.flashy;
_local1.clip._xscale = field.minClipScale + (((_local1.z - field.maxz) / field.minz) * (100 - field.minClipScale));
_local1.clip._yscale = field.minClipScale + (((_local1.z - field.maxz) / field.minz) * (100 - field.minClipScale));
_local1.clip.animations_mc.question_mc._visible = false;
_local1.status = "rest";
_local1.direction = "left";
game.enemiesOnField++;
enemy.currentId++;
}
function checkCreateEnemy() {
if ((game.enemiesOnField < game.maxEnemiesOnField) && (enemy.currentId < game.totalEnemies)) {
var _local1 = main["level" + world.currentLevel];
var _local17 = 0;
var _local2 = 15;
var _local11 = 10;
var _local9 = _local1.enemyMinWalkSpeed + ((_local1.enemyMaxWalkSpeed - _local1.enemyMinWalkSpeed) * Math.random());
var _local12 = _local1.enemyMinRunSpeed + ((_local1.enemyMaxRunSpeed - _local1.enemyMinRunSpeed) * Math.random());
var _local6 = 150;
var _local10 = _local1.enemyMinFramesRest;
var _local7 = _local1.enemyMaxFramesRest;
if (enemy.currentId < game.maxEnemiesOnField) {
var _local5 = field.minx + 100;
var _local3 = field.maxx - 100;
var _local18 = _local3 - _local5;
var _local15 = Math.floor(_local5 + (Math.random() * _local18));
var _local4 = field.minz + 100;
var _local8 = field.maxz - 100;
var _local16 = _local8 - _local4;
var _local13 = Math.floor(_local4 + (Math.random() * _local16));
} else {
var _local5 = field.minx - 20;
var _local3 = field.maxx + 20;
var _local18 = _local3 - _local5;
if (Math.random() < 0.5) {
var _local15 = _local5;
} else {
var _local15 = _local3;
}
var _local4 = field.minz + _local2;
var _local8 = field.maxz - _local2;
var _local16 = _local8 - _local4;
var _local13 = Math.floor(_local4 + (Math.random() * _local16));
}
var _local14 = 0;
createEnemy(_local17, _local2, _local11, _local9, _local12, _local6, _local10, _local7, _local15, _local14, _local13);
}
}
function hitEnemy(enemy_obj) {
enemy_obj.status = "hit";
enemy_obj.animationsClip.gotoAndStop(enemy_obj.direction + "Hit");
}
function removeEnemy(enemy_obj) {
enemy_obj.clip.removeMovieClip();
enemy_obj.status = "removed";
enemy_obj = {};
}
function enemySetNextTarget(enemy_obj) {
var _local4 = field.minx + enemy_obj.radius;
var _local7 = field.maxx - enemy_obj.radius;
var _local8 = _local7 - _local4;
var _local3 = field.minz + enemy_obj.radius;
var _local6 = field.maxz - enemy_obj.radius;
var _local9 = _local6 - _local3;
var _local2 = Math.floor(_local4 + (Math.random() * _local8));
var _local1 = Math.floor(_local3 + (Math.random() * _local9));
if (_local2 < _local4) {
_local2 = _local4;
} else if (_local2 > _local7) {
_local2 = _local7;
}
if (_local1 < _local3) {
_local1 = _local3;
} else if (_local1 > _local6) {
_local1 = _local6;
}
enemy_obj.targetx = _local2;
enemy_obj.targetz = _local1;
}
function enemyWalkToTarget(enemy_obj) {
var _local2 = enemy_obj.targetx - enemy_obj.x;
var _local3 = enemy_obj.targetz - enemy_obj.z;
var _local4 = Math.sqrt((_local2 * _local2) + (_local3 * _local3));
enemy_obj.xmov = (enemy_obj.walkSpeed * _local2) / _local4;
enemy_obj.zmov = (enemy_obj.walkSpeed * _local3) / _local4;
enemy_obj.status = "walk to target";
if (enemy_obj.xmov > 0) {
enemy_obj.direction = "right";
} else {
enemy_obj.direction = "left";
}
enemy_obj.animationsClip.gotoAndStop(enemy_obj.direction);
}
function enemyRunToPlayer(enemy_obj) {
var _local2 = player.x - enemy_obj.x;
var _local3 = player.z - enemy_obj.z;
var _local4 = Math.sqrt((_local2 * _local2) + (_local3 * _local3));
enemy_obj.xmov = (enemy_obj.runSpeed * _local2) / _local4;
enemy_obj.zmov = (enemy_obj.runSpeed * _local3) / _local4;
enemy_obj.status = "catch player";
}
function enemySetNextWalkFrame(enemy_obj) {
var _local2 = enemy_obj.maxFramesRest - enemy_obj.minFramesRest;
enemy_obj.nextWalkFrame = (game.frames + enemy_obj.minFramesRest) + random(_local2);
}
function enemyArriveTarget(enemy_obj) {
enemy_obj.x = enemy_obj.targetx;
enemy_obj.z = enemy_obj.targetz;
enemy_obj.status = "rest";
enemy_obj.animationsClip.gotoAndStop(enemy_obj.direction + "Rest");
enemySetNextWalkFrame(enemy_obj);
}
function showEnemiesQuestionSymbols() {
var _local2 = 0;
while (_local2 < enemy.currentId) {
var _local1 = main["enemy" + _local2];
if ((_local1.status != "hit") && (_local1.status != "removed")) {
_local1.clip.animations_mc.question_mc._visible = true;
}
_local2++;
}
}
function hideEnemiesQuestionSymbols() {
var _local1 = 0;
while (_local1 < enemy.currentId) {
var _local2 = main["enemy" + _local1];
_local2.clip.animations_mc.question_mc._visible = false;
_local1++;
}
}
function areAllEnemiesRemoved() {
var _local1 = 0;
while (_local1 < enemy.currentId) {
var _local2 = main["enemy" + _local1];
if (_local2.status != "removed") {
return(false);
}
_local1++;
}
return(true);
}
function updateEnemies() {
var _local2 = 0;
while (_local2 < enemy.currentId) {
var _local1 = main["enemy" + _local2];
if (game.mode == "ready") {
if (_local1.status == "rest") {
enemySetNextTarget(_local1);
enemyWalkToTarget(_local1);
game.mode = "search";
} else if (_local1.status == "walk to target") {
}
} else if (game.mode == "catch") {
if (_local1.status == "rest") {
if (game.frames > _local1.nextWalkFrame) {
enemySetNextTarget(_local1);
enemyWalkToTarget(_local1);
}
} else if (_local1.status == "walk to target") {
_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) {
enemyArriveTarget(_local1);
} else if (_local1.zmov > 0) {
if (_local1.z > _local1.targetz) {
enemyArriveTarget(_local1);
}
} else if (_local1.z < _local1.targetz) {
enemyArriveTarget(_local1);
}
} else if (_local1.xmov > 0) {
if (_local1.x > _local1.targetx) {
enemyArriveTarget(_local1);
}
} else if (_local1.x < _local1.targetx) {
enemyArriveTarget(_local1);
}
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._xscale = field.minClipScale + (((_local1.z - field.maxz) / field.minz) * (100 - field.minClipScale));
_local1.clip._yscale = field.minClipScale + (((_local1.z - field.maxz) / field.minz) * (100 - field.minClipScale));
}
} else if ((game.mode == "shoot") && (player.powerUpStatus == "change")) {
if (_local1.status == "catch player") {
if (game.frames > _local1.nextWalkFrame) {
enemySetNextTarget(_local1);
enemyWalkToTarget(_local1);
}
} else if (_local1.status == "rest") {
if (game.frames > _local1.nextWalkFrame) {
enemySetNextTarget(_local1);
enemyWalkToTarget(_local1);
}
} else if (_local1.status == "walk to target") {
_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) {
enemyArriveTarget(_local1);
} else if (_local1.zmov > 0) {
if (_local1.z > _local1.targetz) {
enemyArriveTarget(_local1);
}
} else if (_local1.z < _local1.targetz) {
enemyArriveTarget(_local1);
}
} else if (_local1.xmov > 0) {
if (_local1.x > _local1.targetx) {
enemyArriveTarget(_local1);
}
} else if (_local1.x < _local1.targetx) {
enemyArriveTarget(_local1);
}
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._xscale = field.minClipScale + (((_local1.z - field.maxz) / field.minz) * (100 - field.minClipScale));
_local1.clip._yscale = field.minClipScale + (((_local1.z - field.maxz) / field.minz) * (100 - field.minClipScale));
}
} else if (game.mode == "shoot") {
if (_local1.status == "rest") {
_local1.status = "catch player";
} else if (_local1.status == "walk to target") {
_local1.status = "catch player";
} else if (_local1.status == "catch player") {
enemyRunToPlayer(_local1);
_local1.x = _local1.x + _local1.xmov;
_local1.y = _local1.y + _local1.ymov;
_local1.z = _local1.z + _local1.zmov;
if (_local1.xmov > 0) {
_local1.direction = "right";
} else {
_local1.direction = "left";
}
_local1.animationsClip.gotoAndStop(_local1.direction);
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._xscale = field.minClipScale + (((_local1.z - field.maxz) / field.minz) * (100 - field.minClipScale));
_local1.clip._yscale = field.minClipScale + (((_local1.z - field.maxz) / field.minz) * (100 - field.minClipScale));
} else if (_local1.status == "hit") {
if (_local1.animationsClip.char_mc._currentframe == _local1.animationsClip.char_mc._totalframes) {
removeEnemy(_local1);
}
}
}
_local2++;
}
}
function createPowerItem(type, framesLast, x, y, z) {
var _local1 = (main["powerItem" + powerItem.currentId] = {});
_local1.type = type;
_local1.clip = field.clip.attachMovie("powerItem", ("powerItem" + powerItem.currentId) + "_mc", depth.powerItems + powerItem.currentId);
_local1.clip.type_mc.gotoAndStop(type);
_local1.radius = powerItem.radius;
_local1.removeFrame = game.frames + framesLast;
_local1.x = x;
_local1.y = y;
_local1.z = z;
var _local2 = mapToScreen(_local1.x, _local1.y, _local1.z);
_local1.flashx = _local2[0];
_local1.flashy = _local2[1];
_local1.clip._x = _local1.flashx;
_local1.clip._y = _local1.flashy;
_local1.clip._xscale = field.minClipScale + (((_local1.z - field.maxz) / field.minz) * (100 - field.minClipScale));
_local1.clip._yscale = field.minClipScale + (((_local1.z - field.maxz) / field.minz) * (100 - field.minClipScale));
_local1.status = "normal";
powerItem.currentId++;
}
function removePowerItem(powerItem_obj) {
powerItem_obj.clip.removeMovieClip();
powerItem_obj.status = "removed";
powerItem_obj = {};
}
function removeAllPowerItems() {
var _local1 = 0;
while (_local1 < powerItem.currentId) {
var _local2 = main["powerItem" + _local1];
if (_local2.status == "normal") {
removePowerItem(_local2);
}
_local1++;
}
}
function checkCreatePowerItem() {
if (game.frames > game.nextCreatePowerItemFrame) {
var _local1 = [];
if (game.powerUp3Way) {
_local1.push("3Way");
}
if (game.powerUpSpeed) {
_local1.push("speed");
}
if (game.powerUpChange) {
_local1.push("change");
}
if (game.powerUpMachineGun) {
_local1.push("machineGun");
}
if (game.powerUp4Way) {
_local1.push("4Way");
}
var _local11 = _local1[random(_local1.length)];
var _local3 = field.minx + 120;
var _local5 = field.maxx - 120;
var _local6 = _local5 - _local3;
var _local2 = field.minz + 120;
var _local4 = field.maxz - 120;
var _local9 = _local4 - _local2;
var _local10 = Math.floor(_local3 + (Math.random() * _local6));
var _local8 = 0;
var _local7 = Math.floor(_local2 + (Math.random() * _local9));
createPowerItem(_local11, 240, _local10, _local8, _local7);
game.nextCreatePowerItemFrame = game.frames + game.framesCreatePowerItem;
}
}
function updatePowerItems() {
var _local2 = 0;
while (_local2 < powerItem.currentId) {
var _local1 = main["powerItem" + _local2];
if (_local1.status == "normal") {
if (game.frames > _local1.removeFrame) {
removePowerItem(_local1);
}
}
_local2++;
}
}
function initialVariables() {
depth = {};
depth.action = 1;
depth.boss = 500;
depth.enemies = 700;
depth.player = 1000;
depth.bossBullets = 2000;
depth.playerBullets = 3000;
depth.powerItems = 4000;
depth.itemMin = 5000;
field = {};
field.clip = field_mc;
field.minx = 0;
field.maxx = 550;
field.minz = -430;
field.maxz = 0;
field.minClipScale = 70;
game = {};
game.mode = "none";
game.status = "ready";
game.framesBossEscape = 20;
game.framesBeforeLevelComplete = 120;
game.levelCompleteFrame = 0;
game.playerPickGun = 15;
game.shootModeStartFrame = 0;
game.maxEnemiesOnField = 0;
game.enemiesOnField = 0;
game.totalEnemies = 0;
game.enemiesKilled = 0;
game.powerUp3Way = false;
game.powerUpSpeed = false;
game.powerUpChange = false;
game.powerUpMachineGun = false;
game.powerUp4Way = false;
game.framesCreatePowerItem = 0;
game.nextCreatePowerItemFrame = 0;
game.levelScore = 0;
game.levelTimeBonus = 0;
game.levelTotalScore = 0;
game.framesTotal = 0;
game.framesLeft = 0;
game.frames = 0;
popUp = {};
popUp.clip = popUp_mc;
popUp.clip._visible = false;
score = {};
score.boss = 100;
score.enemy = 20;
score.levelBase = 100;
score.secondBonus = 8;
player = {};
player.clip = null;
player.animationsClip = null;
player.initx = 80;
player.inity = 0;
player.initz = -350;
player.speed = 5;
player.radius = 15;
player.framesIn = 10;
player.framesShoot = 0;
player.framesPowerUpShoot = 6;
player.framesPowerUp = 240;
player.shootSpeed = 15;
player.powerUpEndFrame = 0;
player.xmov = 0;
player.ymov = 0;
player.zmov = 0;
player.x = 0;
player.y = 0;
player.z = 0;
player.flashx = 0;
player.flashy = 0;
player.nextShootFrame = 0;
player.direction = "none";
player.powerUpStatus = "none";
player.status = "ready";
enemy = {};
enemy.currentId = 0;
boss = {};
boss.clip = null;
boss.animationsClip = null;
boss.framesShoot = 90;
boss.shootSpeed = 8;
boss.initx = 300;
boss.inity = 0;
boss.initz = -100;
boss.speed = 5;
boss.radius = 15;
boss.xmov = 0;
boss.ymov = 0;
boss.zmov = 0;
boss.x = 0;
boss.y = 0;
boss.z = 0;
boss.flashx = 0;
boss.flashy = 0;
boss.nextShootFrame = 0;
boss.direction = "none";
boss.status = "rest";
playerBullet = {};
playerBullet.radius = 5;
playerBullet.currentId = 0;
bossBullet = {};
bossBullet.radius = 5;
bossBullet.currentId = 0;
powerItem = {};
powerItem.radius = 30;
powerItem.currentId = 0;
}
function loadLevel() {
var _local1 = main["level" + world.currentLevel];
game.framesTotal = _local1.framesBonus;
game.framesLeft = _local1.framesBonus;
game.maxEnemiesOnField = _local1.maxEnemiesOnField;
game.totalEnemies = _local1.totalEnemies;
game.powerUp3Way = _local1.powerUp3Way;
game.powerUpSpeed = _local1.powerUpSpeed;
game.powerUpChange = _local1.powerUpChange;
game.powerUpMachineGun = _local1.powerUpMachineGun;
game.powerUp4Way = _local1.powerUp4Way;
game.framesCreatePowerItem = _local1.framesCreatePowerItem;
boss.framesShoot = _local1.framesBossShoot;
boss.shootSpeed = _local1.bossShootSpeed;
}
function addLevelScore(score) {
addScore(score);
game.levelScore = game.levelScore + score;
}
function addTimeBonus() {
var _local1 = Math.round(game.framesLeft / world.fps);
if (_local1 < 0) {
_local1 = 0;
}
addScore(_local1 * score.secondBonus);
game.levelTimeBonus = _local1 * score.secondBonus;
}
function addScore(score) {
world.score = world.score + score;
}
function showPopUp(type) {
popUp.clip._visible = true;
popUp.clip.gotoAndStop(type);
if (type == "goal") {
popUp.clip.level_txt.text = "LEVEL " + world.currentLevel;
popUp.clip.enemies_txt.text = game.totalEnemies;
popUp.clip.start_btn.onRollOver = function () {
playSFX("buttonRollOver");
};
popUp.clip.start_btn.onRelease = function () {
playSFX("buttonRelease");
hidePopUp();
startGame();
};
} else if (type == "gameOver") {
playSFX("bossLaugh");
popUp.clip.continue_btn.onRollOver = function () {
playSFX("buttonRollOver");
};
popUp.clip.continue_btn.onRelease = function () {
playSFX("buttonRelease");
hidePopUp();
gotoAndPlay ("enterInitial");
};
}
}
function hidePopUp() {
popUp.clip._visible = false;
}
function readyGame() {
loadLevel();
showPopUp("goal");
showStats();
loadBoss();
updateStats();
}
function startGame() {
game.mode = "playerIn";
game.status = "start";
game.gameStartFrame = game.frames + player.framesIn;
loadPlayer();
createActionControl();
}
function levelComplete() {
action_mc.onEnterFrame = null;
action_mc.removeMovieClip();
gotoAndPlay ("levelComplete");
}
function gameOver() {
action_mc.onEnterFrame = null;
action_mc.removeMovieClip();
showPopUp("gameOver");
trace("game overrr!");
}
function changeGameModeTo(mode) {
game.mode = mode;
if (game.mode == "bossEscape") {
boss.status = "escape";
game.shootModeStartFrame = game.frames + game.framesBossEscape;
boss.animationsClip.gotoAndStop("caught");
player.animationsClip.gotoAndStop(player.direction + "Gun");
player.animationsClip.char_mc.gotoAndPlay("pickGun");
} else if (game.mode == "shoot") {
game.nextCreatePowerItemFrame = game.frames + (game.framesCreatePowerItem / 3);
removeAllBossBullets();
}
}
function checkLevelComplete() {
if (game.enemiesKilled >= game.totalEnemies) {
if (game.mode != "levelComplete") {
game.levelCompleteFrame = game.frames + game.framesBeforeLevelComplete;
removeAllPowerItems();
game.mode = "levelComplete";
}
}
}
function showPositionText() {
x_txt.text = player.x;
y_txt.text = player.y;
z_txt.text = player.z;
flashx_txt.text = player.flashx;
flashy_txt.text = player.flashy;
}
function showStats() {
level_txt.text = world.currentLevel;
}
function updateStats() {
var _local1 = Math.round((game.framesLeft / game.framesTotal) * 100);
if (_local1 < 0) {
_local1 = 0;
}
timer_txt.text = _local1;
timer_mc.gotoAndStop(_local1 + 1);
enemiesLeft_txt.text = game.totalEnemies - game.enemiesKilled;
score_txt.text = world.score + " PTS";
}
function updateGameMusic() {
if (music.currentMusic != "gameLoop") {
playMusic("gameLoop");
}
}
function createActionControl() {
createEmptyMovieClip("action_mc", depth.action);
action_mc.onEnterFrame = function () {
checkCreateEnemy();
if (game.mode == "playerIn") {
if (game.frames > game.gameStartFrame) {
game.mode = "catch";
}
rearrangeItemClipsDepth();
game.framesLeft--;
updateStats();
game.frames++;
} else if (game.mode == "catch") {
checkCollisions();
captureKeys();
updatePlayer();
updateBoss();
updateEnemies();
updateBossBullet();
showPositionText();
rearrangeItemClipsDepth();
game.framesLeft--;
updateStats();
game.frames++;
} else if (game.mode == "bossEscape") {
captureKeys();
updatePlayer();
updateBoss();
updateBossBullet();
if (game.frames > game.shootModeStartFrame) {
changeGameModeTo("shoot");
}
rearrangeItemClipsDepth();
game.framesLeft--;
updateStats();
game.frames++;
} else if (game.mode == "shoot") {
if (game.enemiesKilled < game.totalEnemies) {
checkCreatePowerItem();
}
checkCollisions();
captureKeys();
updatePlayer();
updateEnemies();
updatePlayerBullet();
updatePowerItems();
showPositionText();
checkLevelComplete();
rearrangeItemClipsDepth();
game.framesLeft--;
updateStats();
game.frames++;
} else if (game.mode == "gameLose") {
updatePlayer();
updatePlayerBullet();
} else if (game.mode == "levelComplete") {
updatePlayerBullet();
if (game.frames > game.levelCompleteFrame) {
addLevelScore(score.levelBase * world.currentLevel);
addTimeBonus();
game.levelTotalScore = game.levelScore + game.levelTimeBonus;
levelComplete();
}
game.frames++;
}
};
}
updateGameMusic();
initialVariables();
initialIsoWorld();
readyGame();
Frame 39
stop();
Frame 40
function initialLevelCompleteButtons() {
nextLevel_btn.onRollOver = function () {
playSFX("buttonRollOver");
};
nextLevel_btn.onRelease = function () {
playSFX("buttonRelease");
if (world.currentLevel < world.totalLevels) {
gotoAndNextLevel();
} else {
gotoAndPlay ("enterInitial");
}
};
}
function showLevelCompleteStats() {
levelScore_txt.text = game.levelScore;
levelTimeBonus_txt.text = game.levelTimeBonus;
levelTotalScore_txt.text = game.levelTotalScore;
}
function updateLevelCompleteMusic() {
if (music.currentMusic != "menuLoop") {
playMusic("menuLoop");
}
}
stop();
showLevelCompleteStats();
updateLevelCompleteMusic();
initialLevelCompleteButtons();
Frame 50
function initialEnterInitialButtons() {
continue_btn.onRollOver = function () {
playSFX("buttonRollOver");
};
continue_btn.onRelease = function () {
playSFX("buttonRelease");
world.playerName = playerName_txt.text;
submitScore();
};
}
function submitScore() {
var _local2 = codeInput_txt.text;
var _local1 = new LoadVars();
_local1.onLoad = function (success) {
if (success) {
main.gotoAndPlay("highScores");
}
};
_local1.load((((((world.path + "gamepad/play/games/writeGameHighScore.asp?gameID=") + world.gameId) + "&name=") + world.playerName) + "&score=") + world.score);
}
function updateEnterInitialMusic() {
if (music.currentMusic != "menuLoop") {
playMusic("menuLoop");
}
}
stop();
Selection.setFocus(playerName_txt);
updateEnterInitialMusic();
initialEnterInitialButtons();
Frame 61
function initialHighScoresButtons() {
title_btn.onRollOver = function () {
playSFX("buttonRollOver");
};
title_btn.onRelease = function () {
playSFX("buttonRelease");
_root.funcHITBOX("play_activity", "play_game");
gotoAndPlay ("title");
};
}
function showHighScores() {
var _local4 = new LoadVars();
_local4.onLoad = function (success) {
temp_txt.text = temp_txt.text + ("load " + success);
if (success) {
i = 0;
while (i < 10) {
var _local2 = main[("score" + i) + "_mc"];
_local2.rank_txt.text = String(i + 1);
var _local3 = this["name" + i];
if ((_local3 == null) || (_local3 == undefined)) {
_local2.name_txt.text = "AA";
_local2.score_txt.text = 0;
} else {
_local2.name_txt.text = this["name" + i];
_local2.score_txt.text = this["score" + i];
}
_local2._visible = true;
temp_txt.text = temp_txt.text + (((((newline + i) + " ") + _local3) + " ") + this["score" + i]);
i++;
}
} else {
alert("NOMO");
}
};
_local4.load((world.path + "/gamepad/play/games/getGameHighScores.asp?gameID=") + world.gameId);
}
function updateLevelHighScoresMusic() {
if (music.currentMusic != "menuLoop") {
playMusic("menuLoop");
}
}
stop();
showHighScores();
resetWorldVariables();
initialHighScoresButtons();
updateLevelHighScoresMusic();
Symbol 86 MovieClip Frame 16
stop();
Symbol 87 MovieClip Frame 12
gotoAndPlay ("walk");
Symbol 88 MovieClip Frame 36
stop();
Symbol 89 MovieClip Frame 1
stop();
Symbol 103 MovieClip Frame 23
Symbol 131 MovieClip Frame 23
Symbol 139 MovieClip Frame 16
stop();
Symbol 142 MovieClip Frame 127
stop();
Symbol 143 MovieClip Frame 1
stop();
Symbol 261 MovieClip Frame 18
gotoAndPlay ("walk");
Symbol 261 MovieClip Frame 110
stop();
Symbol 315 MovieClip Frame 18
gotoAndPlay ("walk");
Symbol 315 MovieClip Frame 31
gotoAndPlay ("walk");
Symbol 315 MovieClip Frame 55
gotoAndPlay ("walk");
Symbol 316 MovieClip Frame 10
stop();
Symbol 414 MovieClip Frame 18
gotoAndPlay ("walk");
Symbol 414 MovieClip Frame 110
stop();
Symbol 462 MovieClip Frame 18
gotoAndPlay ("walk");
Symbol 462 MovieClip Frame 32
gotoAndPlay ("walk");
Symbol 462 MovieClip Frame 58
gotoAndPlay ("walk");
Symbol 463 MovieClip Frame 10
stop();
Symbol 468 MovieClip Frame 8
gotoAndPlay (1);
Symbol 477 MovieClip Frame 1
stop();
Symbol 498 MovieClip Frame 1
play();
Symbol 498 MovieClip Frame 5
stop();
Symbol 500 MovieClip Frame 6
stop();
Symbol 502 MovieClip Frame 6
stop();
Symbol 508 MovieClip Frame 6
stop();
Symbol 512 MovieClip Frame 6
stop();
Symbol 517 MovieClip Frame 1
stop();
Symbol 531 MovieClip Frame 18
stop();
Symbol 554 MovieClip Frame 1
play();
Symbol 554 MovieClip Frame 5
stop();
Symbol 556 MovieClip Frame 6
stop();
Symbol 557 MovieClip Frame 6
stop();
Symbol 566 MovieClip Frame 5
stop();
Symbol 569 MovieClip Frame 6
stop();
Symbol 577 MovieClip Frame 6
stop();
Symbol 618 MovieClip Frame 6
stop();
Symbol 624 MovieClip Frame 6
stop();
Symbol 626 MovieClip Frame 1
btStart.onRelease = function () {
gotoAndStop ("gameOver");
};
stop();
Symbol 626 MovieClip Frame 10
play();
Symbol 626 MovieClip Frame 15
stop();
btPlayAgain.onRelease = function () {
_root.gotoAndStop("levelComplete");
};
Symbol 630 MovieClip Frame 6
stop();
Symbol 652 MovieClip Frame 6
stop();