Frame 1
function gameMenu(menu, obj) {
getURL (_root.authorsSite, "_blank");
}
_root.externalMusic = 0;
_root.gameTitle = "lunchBox";
_root.gameDesc = "Game Description goes here";
_root.vNum = "Version 1.0";
_root.flashVersionsNeeded = 7;
_root.legalDomain = "file:///D";
_root.authorName = "Terry Paton";
_root.authorContact = "terry@terrypaton.com";
_root.authorsSite = "http://www.terrypaton.com";
_root.gameLocation = _root._url.substr(0, legalDomain.length);
_root.gameQuality = "HIGH";
var menu_cm = new ContextMenu();
menu_cm.customItems.push(new ContextMenuItem(gameTitle, gameMenu));
menu_cm.hideBuiltInItems();
_root.menu = menu_cm;
fscommand ("fullscreen", true);
Instance of Symbol 108 MovieClip in Frame 4
onClipEvent (load) {
var flashVersion = System.capabilities.version;
_root.flashVersionsinstalled = flashVersion.substr(4, 1);
if (_root.flashVersionsNeeded > _root.flashVersionsinstalled) {
_root.stop();
this.gotoAndStop(2);
} else if (_root.gameLocation != _root.legalDomain) {
}
}
Frame 6
sound1 = new Sound();
sound1.attachSound("sound1");
sound2 = new Sound();
sound2.attachSound("sound2");
sound3 = new Sound();
sound3.attachSound("sound3");
sound4 = new Sound();
sound4.attachSound("sound4");
sound9 = new Sound();
sound9.attachSound("sound9");
sound10 = new Sound();
sound10.attachSound("sound10");
if (_root.externalMusic == 0) {
} else {
var intromusic = new Sound();
var optionsmusic = new Sound();
var music1 = new Sound();
var music2 = new Sound();
var music3 = new Sound();
var gamefinishedmusic = new Sound();
var gameovermusic = new Sound();
music1.loadSound("audio/music/music_1.mp3", false);
music2.loadSound("audio/music/music_2.mp3", false);
music3.loadSound("audio/music/music_3.mp3", false);
gamefinishedmusic.loadSound("audio/music/game_finished_music.mp3", false);
intromusic.loadSound("audio/music/intro_music.mp3", false);
gameovermusic.loadSound("audio/music/game_over_music.mp3", false);
optionsmusic.loadSound("audio/music/options_music.mp3", false);
}
Frame 7
function stopmusic() {
music1.stop();
music2.stop();
music3.stop();
optionsmusic.stop();
intromusic.stop();
gameovermusic.stop();
gamefinishedmusic.stop();
}
function playmusic() {
if (musicstate == 1) {
stopmusic();
trace("playing music");
switch (gameScene) {
case "INTRO" :
intromusic.start(0, 90);
return;
case "GAME" :
b = level - (int(level / 3) * 3);
switch (b) {
case 0 :
music1.start(0, 30);
break;
case 1 :
music2.start(0, 30);
break;
case 2 :
music3.start(0, 30);
break;
default :
music1.start(0, 30);
}
return;
case "GAME OVER" :
gameovermusic.start(0, 9);
return;
case "OPTIONS" :
optionsmusic.start(0, 90);
return;
case "HOW TO PLAY" :
optionsmusic.start(0, 90);
return;
case "GAME FINISHED" :
gamefinishedmusic.start(0, 90);
return;
}
}
}
storage = SharedObject.getLocal("store");
level = storage.data.uptolevel;
if (level == undefined) {
storage.data.uptolevel = 1;
level = 1;
}
yourhigh = storage.data.myhighscore;
if (yourhigh == undefined) {
storage.data.myhighscore = 0;
yourhigh = 0;
}
musicstate = storage.data.musicsetting;
if ((musicstate == undefined) || (musicstate == 2)) {
musicstate = 1;
storage.data.musicsetting = 1;
}
Frame 8
gotoAndPlay (29);
Frame 9
function gomain() {
_root.state = "start again";
gotoAndPlay (29);
}
if (musicstate == 0) {
this.options.on_off.gotoAndStop(2);
}
gameScene = "HOW TO PLAY";
trace(gameScene);
playmusic();
Frame 28
stop();
Frame 29
function playgame() {
gotoAndPlay (49);
}
function resetlevel() {
_root.resetclip.gotoAndPlay(2);
storage.data.myhighscore = 0;
yourhigh = 0;
storage.flush();
}
function goHowtoPlay() {
gotoAndPlay (9);
}
delete state;
_quality = "HIGH";
gameScene = "INTRO";
playmusic();
Frame 48
stop();
Frame 49
function object1Class() {
}
object1Class.prototype = new MovieClip();
object1Class.prototype.onLoad = function () {
this.x = this._x;
this.y = this._y;
this.startx = this.x;
this.starty = this.y;
this.maxSpeed = 5;
this.yspeed = 0;
this.xspeed = 0;
this.starttime = getTimer();
this.state = "normal";
};
object1Class.prototype.onEnterFrame = function () {
if (_root.state == "paused") {
}
if (this.state == "remove") {
removeMovieClip(this);
}
if (_root.state == "playing") {
this.i = 0;
while (this.i < 100) {
this.i++;
}
this.timeTemp = getTimer();
if ((this.timeTemp - this.lastTime) > 200) {
this.lastTime = this.timeTemp;
}
if (this.varName == 0) {
}
switch (this.varName) {
case 1 :
break;
case 2 :
break;
case 3 :
break;
case 4 :
break;
case 5 :
break;
case 6 :
break;
}
switch (this.varName) {
case 10 :
_root.tellplayer(1);
break;
case 20 :
_root.tellplayer(2);
break;
case 30 :
_root.tellplayer(3);
break;
case 40 :
_root.tellplayer(4);
break;
case 50 :
_root.tellplayer(5);
break;
case 60 :
_root.tellplayer(6);
}
if (this.hitTest(_root.objectName) == true) {
}
if (_root.object.hitTest(this.x, this.y, true) == true) {
}
if ((this.y < -10) || (this.y > 490)) {
removeMovieClip(this);
}
if ((this.x < -10) || (this.x > 640)) {
removeMovieClip(this);
}
if (this.xspeed > this.maxSpeed) {
this.xspeed = this.maxSpeed;
} else if (this.xspeed < (-this.maxSpeed)) {
this.xspeed = -this.maxSpeed;
}
if (this.yspeed > this.maxSpeed) {
this.yspeed = this.maxSpeed;
} else if (this.yspeed < (-this.maxSpeed)) {
this.yspeed = -this.maxSpeed;
}
this.y = this.y + this.yspeed;
this.x = this.x + this.xspeed;
this._x = int(this.x);
this._y = int(this.y);
}
};
Object.registerClass("object", object1Class);
function customFunction(varName) {
if (_root.state == "paused") {
}
if (_root.state == "playing") {
i = 0;
while (i < 100) {
i++;
}
if (varName == 3) {
}
switch (varName) {
case 1 :
break;
case 2 :
break;
case 3 :
break;
case 4 :
break;
case 5 :
break;
case 6 :
break;
}
savegame.flush();
i = 1;
while (i < 500) {
removeMovieClip(eval ("holder.clip" + i));
i++;
}
switch (varName) {
case 10 :
tellplayer(1);
break;
case 20 :
tellplayer(2);
break;
case 30 :
tellplayer(3);
break;
case 40 :
tellplayer(4);
break;
case 50 :
tellplayer(5);
break;
case 60 :
tellplayer(6);
}
attachMovie("clip", "clip", clipLevel);
with (clip) {
_x = 320;
_y = 430;
}
state = "begin";
if ((score > 30000) && (extralives == 0)) {
extralives++;
lives++;
tellplayer(9);
}
if ((score > 60000) && (extralives == 1)) {
extralives++;
lives++;
tellplayer(9);
}
if ((score > 90000) && (extralives == 2)) {
extralives++;
lives++;
tellplayer(9);
}
if ((score > 120000) && (extralives == 3)) {
extralives++;
lives++;
tellplayer(9);
}
if ((score > 150000) && (extralives == 4)) {
extralives++;
lives++;
tellplayer(9);
}
score = score + 500;
if (lives < 0) {
state = "game over";
} else {
state = "paused";
}
}
}
function tellplayer(num) {
attachMovie("tell_player", "tellPlayer", 9);
with (tellPlayer) {
_x = 320;
_y = 240;
clip.gotoAndStop(num);
}
_root.playerscore.gotoAndPlay(2);
if (num == 9) {
extralife_snd.start();
}
switch (num) {
case 1 :
_root.score = _root.score + 500;
_root.sound1.start();
return;
case 2 :
_root.score = _root.score + 750;
_root.sound2.start();
return;
case 3 :
_root.score = _root.score + 1000;
_root.sound3.start();
return;
case 4 :
_root.score = _root.score + 2000;
_root.sound4.start();
return;
case 5 :
_root.score = _root.score + 3000;
_root.sound5.start();
return;
case 6 :
_root.score = _root.score + 4000;
_root.sound6.start();
return;
}
}
function pausebtnpress() {
if (_root.state == "playing") {
_root.state = "paused";
attachMovie("paused_clip", "tellPlayer", 9);
tellPlayer._x = 320;
tellPlayer._y = 240;
} else if (_root.state == "paused") {
removeMovieClip("tellPlayer");
_root.state = "playing";
}
}
function juiceDrop() {
trace("juice drop");
tempBallN = enemyHolder.getNextHighestDepth();
enemyHolder.attachMovie("juiceDrop", "b" + tempBallN, tempBallN);
eval ("enemyHolder.b" + tempBallN)._x = enemyHolder.blender._x;
eval ("enemyHolder.b" + tempBallN)._y = enemyHolder.blender._y;
}
function blenderClass() {
}
blenderClass.prototype = new MovieClip();
blenderClass.prototype.onLoad = function () {
this.bState = "wait";
this.x = 680;
this.y = 48;
this.dir = 0;
this._y = this.y;
this._x = this.x;
this.xspeed = 3;
};
blenderClass.prototype.onEnterFrame = function () {
if (this.bState == "move") {
if (this.dir == 0) {
this.x = this.x - this.xspeed;
} else {
this.x = this.x + this.xspeed;
}
if (this.x > 630) {
this.dir = 0;
} else if (this.x < 230) {
this.dir = 1;
}
this._x = this.x;
}
};
Object.registerClass("blender", blenderClass);
enemyHolder.attachMovie("blender", "blender", enemyHolder.getNextHighestDepth());
function juiceClass() {
}
juiceClass.prototype = new MovieClip();
juiceClass.prototype.onLoad = function () {
trace("GGHJGHJJHGJHGJH");
this.x = enemyHolder.blender._x;
this.y = enemyHolder.blender._y;
this.yspeed = 0;
};
juiceClass.prototype.onEnterFrame = function () {
if (state == "playing") {
this.yspeed = this.yspeed + 1;
this.yspeed = this.yspeed * 1.01;
this.y = this.y + this.yspeed;
if (this.yspeed > 20) {
this.yspeed = 20;
}
if (this.y > (500 - ballwidth)) {
if (this._x > 445) {
score = score + 2;
sound9.start();
playerscore.play();
}
removeMovieClip(this);
}
this._x = Math.floor(this.x);
this._y = Math.floor(this.y);
}
};
Object.registerClass("juiceDrop", juiceClass);
function ballClass() {
}
ballClass.prototype = new MovieClip();
ballClass.prototype.onLoad = function () {
this.x = random(380) + 20;
this.y = -20;
this.yspeed = 0;
this.xspeed = 0;
this._rotation = random(360);
this.typeOfBall = random(18) + 1;
this.typeOfBall = random(9) + 1;
this.gotoAndStop(this.typeOfBall);
};
ballClass.prototype.onEnterFrame = function () {
if (state == "playing") {
if ((this.typeOfBall < 9) && (this.yspeed < 0)) {
this.tSpinX = Math.abs(this.x - enemyHolder.blender._x);
this.tSpinY = Math.abs(this.y - enemyHolder.blender._y);
if ((this.tSpinX < 60) && (this.tSpinY < 60)) {
enemyHolder.blender.gotoAndPlay(2);
juiceDrop();
removeMovieClip(this);
}
}
this.yspeed = this.yspeed + 1;
this.yspeed = this.yspeed * 1.01;
this.y = this.y + this.yspeed;
if ((this.y > 430) && (this.x < 420)) {
if (this.x < (px + 55)) {
if (this.x > (px - 55)) {
if (this.yspeed > 0) {
this.yspeed = (-Math.abs(prot)) * 0.5;
if (this.yspeed < 10) {
this.yspeed = this.yspeed - 10;
}
if (this.yspeed > 0) {
this.yspeed = -25;
}
this.xspeed = this.xspeed + (prot + (Math.random() * 2));
this.y = 350;
this.ts = random(4);
if (this.ts == 0) {
sound1.start();
}
if (this.ts == 1) {
sound2.start();
}
if (this.ts == 2) {
sound3.start();
}
if (this.ts == 3) {
sound4.start();
}
_root.player.gotoAndPlay(2);
}
}
}
}
if (this.xspeed > 20) {
this.xspeed = 20;
}
if (this.xspeed < -20) {
this.xspeed = -20;
}
if (this.yspeed > 20) {
this.yspeed = 20;
}
if (this.yspeed < -30) {
this.yspeed = -30;
}
if (this.y > (500 - ballwidth)) {
if (this._x > 420) {
if ((this.typeOfBall == 9) || (this.typeOfBall == 18)) {
_root.start_time = _root.start_time + 10000;
}
score = score + 1;
sound10.start();
playerscore.play();
}
removeMovieClip(this);
}
if (this.y < 20) {
this.y = 20;
this.yspeed = 0;
}
this.x = this.x + this.xspeed;
if (this.x < (20 + ballwidth)) {
this.x = 20 + ballwidth;
this.xspeed = this.xspeed * -0.5;
}
if (this.x > (630 - ballwidth)) {
this.x = 630 - ballwidth;
this.xspeed = this.xspeed * -0.25;
}
if ((((this._y > (280 + ballwidth)) && (this.x > (420 - ballwidth))) && (this.lastx < 420)) && (this._y < 400)) {
this.x = 420 - ballwidth;
this.xspeed = this.xspeed * -0.5;
}
if (this.xspeed > 0) {
this._rotation = this._rotation + 5;
}
if (this.xspeed < 0) {
this._rotation = this._rotation - 5;
}
if (((this._y > (280 + ballwidth)) && (this.x < 420)) && (this.lastx > 420)) {
this.x = 420 + ballwidth;
this.xspeed = this.xspeed * -0.5;
}
this._x = Math.floor(this.x);
this._y = Math.floor(this.y);
this.lastx = this.x;
}
};
Object.registerClass("ball", ballClass);
function frameaction() {
if (state == "start again") {
attachMovie("ready_announce", "tellPlayer", 9);
tellPlayer._x = 320;
tellPlayer._y = 240;
_global.playerState = 1;
attachMovie("player", "player", 199);
player._x = 320;
player._y = 430;
this.state = "paused";
}
if (state == "paused") {
}
if (state == "begin") {
if (level > 50) {
removeMovieClip(player);
i = 0;
while (i < 100) {
i++;
}
gotoAndPlay (49);
} else {
setuplevel();
}
state = "paused";
start_time = getTimer();
}
if (state == "playing") {
if (score > 9) {
enemyHolder.blender.bState = "move";
}
_root.now_time = getTimer();
_root.temp_time = _root.limit_time - ((_root.now_time - _root.start_time) / 1000);
_root.remaining_time = Math.ceil(_root.temp_time);
if (remaining_time < 5) {
if (timeWarnPlay == 0) {
timeWarnPlay = 1;
timeWarn.gotoAndPlay(2);
}
} else {
timeWarnPlay = 0;
timeWarn.gotoAndStop(1);
}
if (_root.temp_time <= 0) {
_root.remaining_time = 0;
state = "game over";
}
ballCount++;
if (ballCount > ballDelay) {
ballCount = 0;
tempBallN = enemyHolder.getNextHighestDepth();
enemyHolder.attachMovie("ball", "b" + tempBallN, tempBallN);
eval ("enemyHolder.b" + tempBallN)._y = -30;
ballDelay = 20 + random(25);
}
if (playerState == 5) {
}
tx = Math.floor(_root._xmouse);
acl = px - tx;
px = px - (acl / 5);
if (px < 60) {
px = 60;
}
if (px > 400) {
px = 400;
}
prot = (-acl) / 2;
if (prot > 30) {
prot = 30;
}
if (prot < -30) {
prot = -30;
}
lastprot = prot;
player._x = px;
player._y = py;
player._rotation = prot;
}
if (state == "game over") {
removeMovieClip(player);
gotoAndPlay ("GAMEOVER");
}
}
_global.prot = 0;
_global.px = 200;
_global.py = 350;
acl = 0;
_global.ballwidth = 15.5;
function setup() {
timeWarnPlay = 0;
_quality = _root.gameQuality;
var _local3 = new Object();
_local3.onMouseDown = function () {
if ((playerState == 1) && (state == "playing")) {
trace("mouse clicked");
}
};
Mouse.addListener(_local3);
extralives = 0;
_root.lives = 2;
_root.score = 0;
_global.playerState = 1;
_global.px = 200;
_global.py = 430;
_global.state = "begin";
acl = 0;
_global.prot = 0;
_root.pnum = 2;
gameScene = "GAME";
ballDelay = 45;
ballCount = 0;
limit_time = 35;
juicer._x = 670;
juicer._y = 48;
}
function musicon() {
this.on_off.gotoAndStop(1);
musicstate = 1;
storage.data.musicsetting = 1;
playmusic();
}
function musicoff() {
stopmusic();
this.on_off.gotoAndStop(2);
musicstate = 0;
storage.data.musicsetting = 0;
}
if (musicstate == 0) {
this.on_off.gotoAndStop(2);
}
function setuplevel() {
_root.state = "paused";
_root.levelann = "Level " + level;
trace("LEVEL START" + level);
attachMovie("ready_announce", "tellPlayer", 9);
tellPlayer._x = 320;
tellPlayer._y = 240;
background.gotoAndStop(level);
i = 0;
while (i < 500) {
i++;
}
attachMovie("player", "player", 199);
player._x = 320;
player._y = 430;
playerState = 1;
temparray = eval (("level" + level) + "data");
_root.enemyLevelStart = 1;
_root.enemyLevel = _root.enemyLevelStart;
_root.gameArray = new Array();
playmusic();
}
Instance of Symbol 149 MovieClip in Frame 49
onClipEvent (enterFrame) {
_root.frameaction();
}
Frame 68
setup();
stop();
Frame 70
if (score > yourhigh) {
yourhigh = score;
newscore.gotoAndStop(2);
storage.data.myhighscore = score;
}
storage.data.uptolevel = level;
storage.flush();
gamescene = "game over";
playmusic();
Frame 98
stop();
Symbol 45 MovieClip Frame 1
_root.stop();
PercentLoaded = Math.floor((_root.getBytesLoaded() / _root.getBytesTotal()) * 100);
if (PercentLoaded != 100) {
setProperty(bar, _xscale , PercentLoaded);
} else {
_root.play();
}
Symbol 45 MovieClip Frame 2
gotoAndPlay (1);
Symbol 59 MovieClip Frame 1
stop();
Symbol 60 MovieClip [tell_player] Frame 65
removeMovieClip(this);
Symbol 65 MovieClip [ready_announce] Frame 76
_root.state = "playing";
removeMovieClip(this);
Symbol 68 MovieClip [player] Frame 1
stop();
Symbol 68 MovieClip [player] Frame 7
gotoAndStop (1);
Symbol 68 MovieClip [player] Frame 19
removeMovieClip(this);
Symbol 79 MovieClip Frame 1
stop();
Symbol 95 Button
on (release) {
getURL ("http://www.macromedia.com/go/getflashplayer/", "_blank");
}
Symbol 98 Button
on (release) {
_root.play();
}
Symbol 107 Button
on (release) {
getURL (((("mailto:" + _root.authorContact) + "?subject=") + _root.gameTitle) + " licensing");
}
Symbol 108 MovieClip Frame 1
stop();
Symbol 111 MovieClip Frame 1
stop();
Symbol 119 MovieClip Frame 23
stop();
Symbol 121 Button
on (release) {
_root.gomain();
}
Symbol 127 Button
on (release) {
_root.goHowtoPlay();
}
Symbol 131 Button
on (release) {
fscommand ("quit");
}
Symbol 133 MovieClip Frame 1
stop();
Symbol 137 Button
on (release) {
_root.resetlevel();
}
Symbol 143 Button
on (release) {
_root.playgame();
}
Symbol 146 MovieClip Frame 1
stop();
Symbol 146 MovieClip Frame 20
gotoAndPlay (2);
Symbol 154 MovieClip Frame 1
stop();
Symbol 160 MovieClip Frame 16
stop();
Symbol 164 MovieClip Frame 1
stop();
Symbol 169 Button
on (release) {
_root.state = "start again";
gotoAndPlay (29);
}