Frame 1
function gameloop() {
mouseChar();
if (boxCollision(char, collect) == true) {
_root.attachMovie("collecting_mc", "collecting", 5006, {_x:collect._x, _y:collect._y});
changeSound.start();
_root.collect.removeMovieClip();
scoreGet();
reload();
}
pointBoxCollision();
if ((gravityUpBool == true) && (gravityBool == true)) {
gravityBoth();
} else if (gravityBool == true) {
gravityOn();
} else if (gravityUpBool == true) {
gravityUpOn();
}
if (movingSceneBool == true) {
movingSceneOn();
}
if (shootBool == true) {
shootOn();
}
}
function boxCollision(colA, colB) {
if ((((colA._x > (colB._x - (colB._width / 2))) && (colA._x < (colB._x + (colB._width / 2)))) && (colA._y > (colB._y - (colB._height / 2)))) && (colA._y < (colB._y + (colB._height / 2)))) {
return(true);
}
}
function pointBoxCollision() {
c = 0;
while (c < (level * 5)) {
if ((((char._x > ((ins2[c]._x + 5) - (ins2[c]._width / 2))) && (char._x < ((ins2[c]._x - 5) + (ins2[c]._width / 2)))) && (char._y > ((ins2[c]._y + 5) - (ins2[c]._height / 2)))) && (char._y < ((ins2[c]._y - 5) + (ins2[c]._height / 2)))) {
_root.char.removeMovieClip();
if (musicBool == true) {
gameSound.stop();
}
collideSound.start();
soundStart.start();
Mouse.show();
deleteAvoid();
_root.attachMovie("menu_mc", "men", 350, {_x:350, _y:200});
_root.men.scoreShow.text = (("Last score: " + score) + " You collected: ") + completed;
testLocalHighscore();
if (musicBool == true) {
menuSound.start(0, 1024);
}
movingSceneBool = false;
wallBoostBool = false;
gravityUpBool = false;
gravityBool = false;
_root.projectiles._alpha = 0;
shootBool = false;
}
c++;
}
}
function testCollision(colA, colB) {
c = 0;
while (c < (level * 5)) {
if ((((colA._x > (colB._x - 40)) && (colA._x < (colB._x + 40))) && (colA._y > (colB._y - 40))) && (colA._y < (colB._y + 40))) {
ci = true;
} else {
ci = false;
}
c++;
}
}
function scoreGet() {
score = score + Math.floor(1000 / ((getTimer() - swfTimer) / 1000));
scorePut.text = score;
swfTimer = getTimer();
}
function mouseChar() {
char._x = _root._xmouse;
char._y = _root._ymouse;
}
function reload() {
c = 0;
while (c < localPlayerHighscores.length) {
if (score > localPlayerHighscores[c]) {
localRank.text = "Local Rank: " + (c + 1);
c = localPlayerHighscores.length;
}
c++;
}
completed = completed + 1;
timerText.text = completed;
if (level < (completed / 10)) {
levelDoc = levelDoc + 1;
if (level > 10) {
wallBoostBool = false;
gravityUpBool = false;
gravityBool = false;
}
if (level <= 10) {
if (level == 1) {
movingSceneBool = true;
_root.projectiles._alpha = 100;
_root.choirSound.start();
soundStart.start();
}
if (level == 2) {
movingSceneBool = false;
gravityBool = true;
_root.projectiles._alpha = 100;
_root.choirSound2.start();
soundStart.start();
}
if (level == 3) {
gravityBool = false;
gravityUpBool = true;
_root.projectiles._alpha = 100;
_root.choirSound3.start();
soundStart.start();
}
if (level == 4) {
shootBool = true;
wallBoostBool = true;
gravityUpBool = true;
gravityBool = true;
_root.projectiles._alpha = 100;
_root.choirSound2.start();
_root.shotSound.start();
_root.collisionSound2.start();
soundStart.start();
}
if (level == 5) {
wallBoostBool = true;
gravityUpBool = true;
gravityBool = true;
movingSceneBool = true;
_root.projectiles._alpha = 100;
_root.choirSound.start();
_root.choirSound3.start();
soundStart.start();
}
if (level == 6) {
gravityUpBool = false;
gravityBool = true;
movingSceneBool = true;
_root.projectiles._alpha = 100;
_root.choirSound.start();
_root.choirSound2.start();
sirenSound.start();
soundStart.start();
}
}
if (level < 20) {
level = level + 1;
}
}
deleteAvoid();
createAvoid();
createCollect();
if (gravityBool == true) {
createGravVel();
}
if (gravityUpBool == true) {
createGravUpVel();
}
}
function deleteAvoid() {
c = 0;
while (c < ins2.length) {
removeMovieClip(ins2[c]);
c++;
}
}
function createAvoid() {
c = 0;
while (c < (level * 5)) {
rand_x = random(690) + 5;
rand_y = random(390) + 5;
if ((((rand_x < (_root._xmouse + 60)) && (rand_x > (_root._xmouse - 60))) && (rand_y < (_root._ymouse + 60))) && (rand_y > (_root._ymouse - 60))) {
rand_x = random(690) + 5;
rand_y = random(390) + 5;
}
ins = "avoid" + c;
depth = depth + 1;
ins2[c] = _root.attachMovie("avoid_mc", ins, depth, {_x:rand_x, _y:rand_y});
c++;
}
}
function createCollect() {
while (ci == true) {
if (testCollisionValue == true) {
}
testCollect._x = (rand_x = random(690) + 5);
testCollect._x = (rand_y = random(390) + 5);
testCollision(testCollect, ins2[c]);
}
_root.attachMovie("collect_mc", "collect", 220, {_x:rand_x, _y:rand_y});
ci = true;
}
function enterCollecting() {
_root.collecting.removeMovieClip();
}
function createGravVel() {
c = 0;
while (c < (level * 5)) {
gravityVel[c] = 0;
c++;
}
}
function createGravUpVel() {
c = 0;
while (c < (level * 5)) {
gravityUpVel[c] = 0;
c++;
}
}
function gravityOn() {
c = 0;
while (c < (level * 5)) {
if ((ins2[c]._y > 400) && (gravityVel[c] > 0)) {
gravityVel[c] = -(gravityVel[c] + wallBoostVar);
} else {
gravityVel[c] = gravityVel[c] + 0.01;
}
ins2[c]._y = ins2[c]._y + gravityVel[c];
c++;
}
}
function gravityBoth() {
c = 0;
while (c < (level * 5)) {
if (ins2[c]._y < 200) {
if ((ins2[c]._y < 0) && (gravityUpVel[c] < 0)) {
gravityUpVel[c] = -(gravityUpVel[c] - wallBoostVar);
} else {
gravityUpVel[c] = gravityUpVel[c] - 0.01;
}
ins2[c]._y = ins2[c]._y + gravityUpVel[c];
}
if (ins2[c]._y >= 200) {
if ((ins2[c]._y > 400) && (gravityVel[c] > 0)) {
gravityVel[c] = -(gravityVel[c] + wallBoostVar);
} else {
gravityVel[c] = gravityVel[c] + 0.01;
}
ins2[c]._y = ins2[c]._y + gravityVel[c];
}
c++;
}
}
function gravityUpOn() {
c = 0;
while (c < (level * 5)) {
if ((ins2[c]._y < 0) && (gravityUpVel[c] < 0)) {
gravityUpVel[c] = -(gravityUpVel[c] - wallBoostVar);
} else {
gravityUpVel[c] = gravityUpVel[c] - 0.01;
}
ins2[c]._y = ins2[c]._y + gravityUpVel[c];
c++;
}
}
function movingSceneOn() {
c = 0;
while (c < (level * 5)) {
ins2[c]._y = ins2[c]._y + movingSceneVar;
if (ins2[c]._y > 400) {
removeMovieClip(ins2[c]);
depth = depth + 1;
rand_x = random(690) + 5;
ins2[c] = _root.attachMovie("avoid_mc", ins, depth, {_x:rand_x, _y:0});
depan = ins2[c]._x / 3.5;
if (depan >= 100) {
var _local2 = depan - 100;
_root.popSound.setPan(_local2);
}
if (depan < 100) {
_root.popSound.setPan(-100 + depan);
}
_root.popSound.start();
}
c++;
}
}
function shootOn() {
if (_root.projectiles == eval("NULL")) {
depth = depth + 1;
_root.createEmptyMovieClip("projectiles", depth);
trace("created projectiles MC");
}
if (Key.isDown(16)) {
shootTimer = Math.floor(getTimer() / 300);
if (shootVar < shootTimer) {
depth = depth + 1;
if (shootCounter > 10) {
shootCounter = 0;
}
shootA[shootCounter] = _root.projectiles.attachMovie("projectile01_mc", "shot01", depth, {_x:_root._xmouse, _y:_root._ymouse});
_root.shotSound.start();
shootCounter = shootCounter + 1;
}
shootVar = Math.floor(getTimer() / 300);
}
c = 0;
while (c < shootA.length) {
if (shootA[c] != "EMPTY") {
if (shootA[c]._y < 0) {
removeMovieClip(shootA[c]);
shootA[c] = "EMPTY";
}
shootA[c]._y = shootA[c]._y - 3;
}
loop = 0;
while (loop < (level * 5)) {
if (boxCollision(shootA[c], ins2[loop]) == true) {
trace("through");
depan = ins2[loop]._x / 3.5;
if (depan >= 100) {
var _local2 = depan - 100;
_root.collideSound2.setPan(_local2);
}
if (depan < 100) {
_root.collideSound2.setPan(-100 + depan);
}
_root.collideSound2.start();
removeMovieClip(ins2[loop]);
}
loop++;
}
c++;
}
}
function getHighscore() {
if (my_so.data.nameArray == undefined) {
my_so.data.nameArray = localPlayerNames;
my_so.data.highscoresArray = localPlayerHighscores;
} else {
LPposition = 0;
localPlayerNames = my_so.data.nameArray;
localPlayerHighscores = my_so.data.highscoresArray;
_root.men.highscoreSave.text = (((LPposition + ": ") + localPlayerName[LPposition]) + " ") + localPlayerHighscores[LPposition];
}
}
function testLocalHighscore() {
localPlayerHighscores = my_so.data.highscoresArray;
localPlayerNames = my_so.data.nameArray;
c = 0;
while (c < localPlayerHighscores.length) {
scoreFail++;
if (score > localPlayerHighscores[c]) {
LPposition = c;
c = 20;
saveNewHighscore();
}
c++;
}
trace(scoreFail);
if (scoreFail > localPlayerHighscores.length) {
resetVariables();
trace("hitscoreFail");
}
_root.men.highscoreSave.text = (((LPposition + ": ") + localPlayerNames[LPposition]) + " ") + localPlayerHighscores[LPposition];
}
function saveNewHighscore() {
putArray(localPlayerNames, LPposition, playerName);
putArray(localPlayerHighscores, LPposition, score);
my_so.data.nameArray = localPlayerNames;
my_so.data.highscoresArray = localPlayerHighscores;
my_so.flush();
_root.newHighscore.removeMovieClip();
_root.attachMovie("menu_mc", "men", 350, {_x:350, _y:200});
_root.men.highscoreSave.text = (((LPposition + ": ") + localPlayerNames[LPposition]) + " ") + localPlayerHighscores[LPposition];
resetVariables();
}
function newgame() {
if ((playerName == "") || (men.PEN_MC._visible == true)) {
men.PEN_MC._visible = true;
} else {
_root.men.removeMovieClip();
_root.attachMovie("character_mc", "char", 100, {_x:350, _y:200});
createAvoid();
createCollect();
swfTimer = getTimer();
Mouse.hide();
if (gravityBool == true) {
createGravVel();
}
if (gravityUpBool == true) {
createGravUpVel();
}
if (wallBoostBool == true) {
wallBoostVar = 0.1;
}
menuSound.stop();
gameSound.start(0, 126);
soundStart.start();
}
}
function resetVariables() {
scoreFail = 0;
level = 1;
completed = 0;
score = 0;
wallBoostVar = 0;
localRank.text = "Local Rank: None";
trace("reseted variables");
}
function putArray(array, index, newVariable) {
var _local4;
var _local3;
var _local2 = 1;
_local3 = index;
while (_local3 < (array.length - 1)) {
_local4 = array[(array.length - _local2) - 1];
array[array.length - _local2] = _local4;
_local2 = _local2 + 1;
_local3++;
}
array[index] = newVariable;
}
function settings() {
_root.men.removeMovieClip();
_root.attachMovie("settings_mc", "settings_men", 10220, {_x:350, _y:200});
}
function backMen() {
_root.settings_men.removeMovieClip();
_root.attachMovie("menu_mc", "men", 350, {_x:350, _y:200});
}
function backSettings() {
_root.physics_men.removeMovieClip();
_root.attachMovie("settings_mc", "settings_men", 10220, {_x:350, _y:200});
}
function physics() {
_root.settings_men.removeMovieClip();
_root.attachMovie("physics_mc", "physics_men", 10221, {_x:350, _y:200});
if (_root.gravityUpBool == true) {
_root.physics_men.tickGravityUp._alpha = 100;
}
if (_root.gravityBool == true) {
_root.physics_men.tickGravity._alpha = 100;
}
if (_root.wallBoostBool == true) {
_root.physics_men.tickWallBoost._alpha = 100;
}
if (_root.movingSceneBool == true) {
_root.physics_men.tickMovingScene._alpha = 100;
}
if (_root.shootBool == true) {
_root.physics_men.tickShoot._alpha = 100;
}
if (_root.randomFallBool == true) {
_root.physics_men.tickRandomFall._alpha = 100;
}
}
function gravity() {
if (_root.gravityBool == false) {
_root.physics_men.tickGravity._alpha = 100;
}
if (_root.gravityBool == true) {
_root.physics_men.tickGravity._alpha = 0;
}
if (gravityBool == true) {
gravityBool = false;
} else {
gravityBool = true;
}
}
function gravityUp() {
if (_root.gravityUpBool == false) {
_root.physics_men.tickGravityUp._alpha = 100;
}
if (_root.gravityUpBool == true) {
_root.physics_men.tickGravityUp._alpha = 0;
}
if (gravityUpBool == true) {
gravityUpBool = false;
} else {
gravityUpBool = true;
}
}
function wallBoost() {
if (_root.wallBoostBool == false) {
_root.physics_men.tickWallBoost._alpha = 100;
}
if (_root.wallBoostBool == true) {
_root.physics_men.tickWallBoost._alpha = 0;
}
if (_root.wallBoostBool == true) {
_root.wallBoostBool = false;
} else {
_root.wallBoostBool = true;
}
}
function movingScene() {
if (_root.movingSceneBool == false) {
_root.physics_men.tickMovingScene._alpha = 100;
}
if (_root.movingSceneBool == true) {
_root.physics_men.tickMovingScene._alpha = 0;
}
if (_root.movingSceneBool == true) {
_root.movingSceneBool = false;
} else {
_root.movingSceneBool = true;
}
}
function shoot() {
if (_root.shootBool == false) {
_root.physics_men.tickShoot._alpha = 100;
}
if (_root.shootBool == true) {
_root.physics_men.tickShoot._alpha = 0;
}
if (_root.shootBool == true) {
_root.shootBool = false;
} else {
_root.shootBool = true;
}
}
function randomFall() {
if (_root.randomFallBool == false) {
_root.physics_men.tickRandomFall._alpha = 100;
}
if (_root.randomFallBool == true) {
_root.physics_men.tickRandomFall._alpha = 0;
}
if (_root.randomFallBool == true) {
_root.randomFallBool = false;
} else {
_root.randomFallBool = true;
}
}
function highscores() {
_root.attachMovie("localHighscoresMen_mc", "local_highscores", 10220, {_x:350, _y:200});
_root.local_highscores.LPHPut.text = "";
c = 0;
while (c < localPlayerHighscores.length) {
_root.local_highscores.LPHPut.text = _root.local_highscores.LPHPut.text + ((((((c + 1) + ": ") + localPlayerNames[c]) + " ") + localPlayerHighscores[c]) + newline);
c++;
}
}
function backHighscores() {
_root.local_highscores.removeMovieClip();
_root.attachMovie("menu_mc", "men", 350, {_x:350, _y:200});
}
function credits() {
_root.men.removeMovieClip();
_root.attachMovie("credits_mc", "credits_men", 350, {_x:350, _y:200});
}
function backCredits() {
_root.credits_men.removeMovieClip();
_root.attachMovie("menu_mc", "men", 350, {_x:350, _y:200});
}
function manual() {
_root.men.removeMovieClip();
_root.attachMovie("manual_mc", "manual_men", 350, {_x:350, _y:200});
}
function backManual() {
_root.manual_men.removeMovieClip();
_root.attachMovie("menu_mc", "men", 350, {_x:350, _y:200});
}
function music() {
if (musicBool == true) {
musicBool = false;
menuSound.stop();
} else {
musicBool = true;
menuSound.start(0, 1024);
}
}
function okay() {
if (men.PN_I.text == "") {
men.PEN_MC._visible = true;
} else {
playerName = men.PN_I.text;
men.PN_D.text = playerName;
men.PN_I.text = "";
men.PN_MC._visible = false;
men.CP_MC._visible = true;
men.PEN_MC._visible = false;
}
}
function menEnter() {
men.PEN_MC._visible = false;
if (playerName != "") {
men.PN_D.text = playerName;
men.PN_MC._visible = false;
} else {
men.CP_MC._visible = false;
}
}
function changePlayer() {
men.CP_MC._visible = false;
men.PN_D.text = "...........";
men.PN_MC._visible = true;
}
var gameStart = 1;
var rand = 0;
var timer = setInterval(gameloop, 5);
var timerA = [0, 0, 0, 0, 0];
var level = 1;
var levelDoc = 1;
var completed = 0;
var c = 0;
var ins = "";
var depth = 6000;
var ins2 = [];
var colA;
var colB;
var swfTimer = 0;
var score = 0;
var scoreFail = 0;
var ci = true;
var gravityBool = false;
var gravityUpBool = false;
var gravityVel = [];
var gravityUpVel = [];
var grav = 0;
var gravUp = 0;
var wallBoostBool = false;
var wallBoostVar = 0;
var movingSceneBool = false;
var movingSceneVar = 0.5;
var shootBool = false;
var shootA = ["EMPTY", "EMPTY", "EMPTY", "EMPTY", "EMPTY", "EMPTY", "EMPTY", "EMPTY", "EMPTY", "EMPTY"];
var shootVar = 0;
var shootTimer = 0;
var shootCounter = 0;
var shootStartBool = false;
var loop = 0;
var localPlayerNames = ["EMPTY", "EMPTY", "EMPTY", "EMPTY", "EMPTY", "EMPTY", "EMPTY", "EMPTY", "EMPTY", "EMPTY"];
var localPlayerHighscores = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var LPposition = 0;
var my_so = SharedObject.getLocal("savedText", "/");
var musicBool = true;
var playerName = "";
var menuSound = new Sound(menusound_mc);
var gameSound = new Sound(gamesound_mc);
var movingsceneSound = new Sound(movingscenesound_mc);
var changeSound = new Sound(changesound_mc);
var collideSound = new Sound(collidesound_mc);
var collideSound2 = new Sound(collidesound2_mc);
var soundStart = new Sound(soundstart_mc);
var choirSound = new Sound(choirsound_mc);
var choirSound2 = new Sound(choirsound2_mc);
var choirSound3 = new Sound(choirsound3_mc);
var shotSound = new Sound(shotsound_mc);
var popSound = new Sound(popsound_mc);
var popSound2 = new Sound(popsound2_mc);
var sirenSound = new Sound(sirensound_mc);
menuSound.attachSound("menu_sound");
gameSound.attachSound("game_sound");
movingsceneSound.attachSound("movingscene_sound");
changeSound.attachSound("change_sound");
collideSound.attachSound("collide_sound");
collideSound2.attachSound("collide_sound2");
soundStart.attachSound("sound_start");
choirSound.attachSound("choir_sound");
choirSound2.attachSound("choir_sound2");
choirSound3.attachSound("choir_sound3");
shotSound.attachSound("shot_sound");
popSound.attachSound("pop_sound");
popSound2.attachSound("pop_sound2");
sirenSound.attachSound("siren_sound");
soundStart.start();
menuSound.start(0, 1024);
onEnterFrame = function () {
var _local2 = _xmouse / 3.5;
if (_local2 >= 100) {
var _local3 = _local2 - 100;
_root.collideSound.setPan(_local3);
_root.changeSound.setPan(_local3);
_root.shotSound.setPan(_local3);
_root.choirSound.setPan(_local3);
_root.choirSound2.setPan(_local3);
_root.choirSound3.setPan(_local3);
}
if (_local2 < 100) {
_root.collideSound.setPan(-100 + _local2);
_root.changeSound.setPan(-100 + _local2);
_root.shotSound.setPan(-100 + _local2);
_root.choirSound.setPan(-100 + _local2);
_root.choirSound2.setPan(-100 + _local2);
_root.choirSound3.setPan(-100 + _local2);
}
};
_root.attachMovie("menu_mc", "men", 350, {_x:350, _y:200});
_root.attachMovie("testCollect_mc", "testCollect", 500);
getHighscore();
Symbol 18 MovieClip [testCollect_mc] Frame 15
stop();
Symbol 44 MovieClip [collect_mc] Frame 8
stop();
Symbol 55 MovieClip [avoid_mc] Frame 15
stop();
Symbol 91 Button
on (release) {
_root.highscores();
}
Symbol 95 Button
on (release) {
_root.credits();
}
Symbol 99 Button
on (release) {
_root.manual();
}
Symbol 104 Button
on (release) {
_root.newgame();
}
Symbol 114 Button
on (release) {
_root.okay();
}
Symbol 121 Button
on (release) {
_root.changePlayer();
}
Symbol 123 MovieClip [menu_mc] Frame 1
_root.menEnter();
Symbol 130 Button
on (release) {
_root.backHighscores();
}
Symbol 133 Button
on (release) {
_root.backCredits();
}
Symbol 138 MovieClip [credits_mc] Frame 25
stop();
Symbol 142 Button
on (release) {
_root.backManual();
}
Symbol 147 MovieClip [collecting_mc] Frame 20
_root.enterCollecting();
Symbol 149 MovieClip Frame 1
stop();