Frame 1
soundOn = true;
_root.rulesHit = false;
Frame 2
perc = (getBytesLoaded() / getBytesTotal()) * 100;
Frame 3
if (perc == 100) {
messageWinT.duplicateMovieClip("messageWin", getNextHighestDepth());
messageWin._x = 282;
messageWin._y = 220;
messageWin._visible = false;
doorAnimationT.duplicateMovieClip("doorAnimation", getNextHighestDepth());
doorAnimation._x = 105;
doorAnimation._y = 242;
doorAnimation._visible = false;
gotoAndPlay (3);
} else {
gotoAndPlay (2);
}
Frame 4
function showMessageWin(messTitle, messBody, arrows) {
messageWin.swapDepths(this.getNextHighestDepth());
_root.messB = messBody;
_root.messT = messTitle;
if (messTitle == "CONGRATULATIONS") {
messageWin.gotoAndPlay(5);
} else {
messageWin.gotoAndPlay(2);
}
messageWin._visible = true;
if (arrows == "upArrow") {
messageWin.arrows.gotoAndStop(2);
} else if (arrows == "downArrow") {
messageWin.arrows.gotoAndStop(3);
} else {
messageWin.arrows.gotoAndStop(1);
}
updateAfterEvent();
}
function showMessageWin2(messTitle, messBody) {
messageWin.swapDepths(this.getNextHighestDepth());
messageWin.messTitle = messTitle;
_root.messB = messBody;
messageWin._visible = true;
updateAfterEvent();
}
if (soundOn) {
speakerButt.gotoAndStop(2);
soundM.gotoAndStop(2);
}
stop();
Frame 7
function init() {
totalFoods = 50;
numFood = 4;
dayMeal = 0;
allowedCalsOff = 100;
food = new Array("toast", "apple1", "cinnamon", "watermelon", "eggs", "orange1", "pancakes", "bacon", "cereal", "yoghurt", "banana", "grapes", "salad", "soup", "spaghetti", "chicken", "taco", "macaroni", "chips", "choccake", "shrimp", "potato", "ribs", "springRoll", "peanuts", "fries", "pizza", "icecream", "carrot", "broccoli", "steak", "burger", "candy", "fish");
cals = new Array(69, 61, 80, 57, 168, 69, 350, 283, 156, 240, 210, 124, 90, 142, 299, 216, 190, 330, 150, 300, 274, 370, 420, 170, 208, 400, 290, 140, 50, 54, 928, 310, 460, 130);
level = 0;
theScore = 0;
}
function timerDown() {
if (roundOver) {
return(0);
}
timeS--;
if (timeS < 10) {
timeST = "0" + timeS;
} else {
timeST = timeS;
}
theTime = (timeM + ":") + timeST;
if (timeS == 0) {
timeS = 60;
timeM--;
if (timeM == -1) {
timeUp = true;
eval (draggedMovie).stopDrag();
clearInterval(intervalId);
gameOver = true;
roundOver = true;
doorAnimation.playReverse.gotoAndPlay(2);
messageWin.swapDepths(doorAnimation.getDepth());
sfxM.gotoAndPlay("close");
showMessageWin("GAME OVER", "\nYou did not enter the correct\namount of calories in time.\n\nPlease Try Again!");
}
}
}
function resetLevel() {
gameOver = false;
doorAnimation._visible = false;
eggs.gotoAndStop(1);
ii = 0;
while (ii <= totalFoods) {
eval (food[ii])._x = -500;
eval (food[ii])._y = 0;
eval (food[ii])._xscale = 100;
eval (food[ii])._yscale = 100;
if (eval (food[ii]).getDepth() > 0) {
eval (food[ii]).swapDepths(-1000 + ii);
}
ii++;
}
}
function nextLevel() {
submits = 0;
sfxM.gotoAndPlay("open");
roundOver = false;
doorAnimation._visible = true;
clearInterval(intervalId);
intervalId = setInterval(this, "timerDown", 1000);
dropped = new Array(false, false, false, false, false, false, false, false);
fridgeSlotTaken = new Array(false, false, false, false, false, false, false, false, false, false, false, false, false);
shown = new Array(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false);
totalCalories = 0;
targetCals = 0;
coOrdX = new Array();
coOrdY = new Array();
shownFood = 1;
numFood++;
level++;
targPerc = 20;
if (level < 10) {
theLevel = "0" + level;
} else {
theLevel = level;
}
minFood = 0;
maxFood = 9;
whichMeal = level % 3;
timeM = 1;
timeS = 30;
theTime = "1:30";
if (dayMeal == 0) {
theDay = "MONDAY";
} else if (dayMeal == 1) {
theDay = "TUESDAY";
} else if (dayMeal == 2) {
theDay = "WEDNESDAY";
} else if (dayMeal == 3) {
theDay = "THURSDAY";
timeM = 1;
timeS = 1;
theTime = "1:00";
} else if (dayMeal == 4) {
theDay = "FRIDAY";
timeM = 1;
timeS = 1;
theTime = "1:00";
}
if (whichMeal == 1) {
minFood = 0;
maxFood = 11;
targCalRange = 400 + random(150);
theMeal = "BREAKFAST";
} else if (whichMeal == 2) {
minFood = 12;
maxFood = 24;
targCalRange = 600 + random(150);
theMeal = "LUNCH";
} else if (whichMeal == 0) {
minFood = 12;
maxFood = 34;
targCalRange = 600 + random(200);
theMeal = "DINNER";
dayMeal++;
}
doorAnimation.play();
doorAnimation.playReverse.gotoAndStop(1);
ii = 1;
while (ii <= 12) {
eval ("p" + ii)._visible = false;
ii++;
}
targetCals = 0;
breakOut = 0;
while ((targetCals < targCalRange) || (shownFood <= 5)) {
if ((breakOut++) > 150) {
break;
}
randFridge = random(12) + 1;
while (fridgeSlotTaken[randFridge]) {
if ((breakOut++) > 150) {
break;
}
randFridge = random(12) + 1;
}
fridgeSlotTaken[randFridge] = true;
randNum = random(maxFood - minFood) + minFood;
while (shown[randNum]) {
if ((breakOut++) > 150) {
trace("STUCK 3");
break;
}
randNum = random(maxFood - minFood) + minFood;
if (shown[randNum] == false) {
shown[randNum] = true;
break;
}
}
shown[randNum] = true;
eval (food[randNum])._x = eval ("p" + randFridge)._x;
eval (food[randNum])._y = eval ("p" + randFridge)._y;
shownFood++;
if ((random(10) > 2) && (targetCals < targCalRange)) {
targetCals = targetCals + cals[lookup(food[randNum])];
}
}
ii = 0;
while (ii < totalFoods) {
coOrdX.push(eval (food[ii])._x);
coOrdY.push(eval (food[ii])._y);
ii++;
}
}
function lookup(incFood) {
ii = 0;
while (ii <= totalFoods) {
if (incFood == food[ii]) {
return(ii);
}
ii++;
}
}
function submitHit() {
submits++;
totalCalories = 0;
goodFoodBonus = 0;
messageWin.swapDepths(10000);
doorAnimation.swapDepths(9000);
ii = 0;
while (ii <= totalFoods) {
if (dropped[ii]) {
totalCalories = totalCalories + cals[ii];
theFruit = food[ii];
if (((((((((((theFruit == "toast") || (theFruit == "apple1")) || (theFruit == "watermelon")) || (theFruit == "orange1")) || (theFruit == "cereal")) || (theFruit == "salad")) || (theFruit == "soup")) || (theFruit == "celery")) || (theFruit == "carrot")) || (theFruit == "broccoli")) || (theFruit == "fish")) {
goodFoodBonus = goodFoodBonus + 1000;
}
}
ii++;
}
if (totalCalories == 0) {
showMessageWin("Try Again", "<font size='16'><br><br>Please place food from the refrigerator on the plate</font>");
return(0);
}
percOff = 100 - ((totalCalories / targetCals) * 100);
calsOff = totalCalories - targetCals;
trace("calsOff:" + calsOff);
roundOver = false;
if (allowedCalsOff >= Math.abs(calsOff)) {
roundOver = true;
theScore = theScore + Math.round(10 * (100 - percOff));
theScore = theScore + (10 * ((timeM * 60) + timeS));
theScore = theScore + goodFoodBonus;
oldallowedCalsOff = allowedCalsOff;
allowedCalsOff = allowedCalsOff - 5;
doorAnimation.playReverse.gotoAndPlay(2);
sfxM.gotoAndPlay("close");
rightM.gotoAndPlay(2);
trace((dayMeal + ":") + whichMeal);
if (calsOff == 0) {
if ((dayMeal == 5) && (whichMeal == 0)) {
showMessageWin("CONGRATULATIONS", "<font size='16'>You were spot on!<br><br>Bonus 1000 Points!</font><br><br>", "noArrow");
} else {
showMessageWin("CONGRATULATIONS", ("<font size='16'>You were spot on!<br><br>Bonus 1000 Points!</font><br><br>Next meal get within <br>" + allowedCalsOff) + " calories of the target", "noArrow");
}
theScore = theScore + 1000;
} else if ((dayMeal == 5) && (whichMeal == 0)) {
showMessageWin("CONGRATULATIONS", ((("<font size='16'>Total Calories: " + totalCalories) + "<br><br><font color='#FFFFFF'>You were within the<br>") + oldallowedCalsOff) + " calorie range.</font></font><br>", "noArrow");
} else {
showMessageWin("CONGRATULATIONS", ((((("<font size='16'>Total Calories: " + totalCalories) + "<br><br><font color='#FFFFFF'>You were within the<br>") + oldallowedCalsOff) + " calorie range.</font></font><br><br>Next meal get within<br>") + allowedCalsOff) + " calories of the target", "noArrow");
}
} else {
sfxM.gotoAndPlay("wrong");
if (submits == 5) {
submits = 0;
tryagainMess = "<font color='#CC1F19' size='14'><b>HINT:</b></font><font size='13'> Try placing a high calorie item first, then adding small side items one at a time observing the calorie count.</font>";
} else {
tryagainMess = "<br><font size='16'>Please Try Again</font>";
}
if (percOff > 0) {
showMessageWin("<font size='24' color='#CC1F19'>TOO LOW</font>", (("<br><font size='20'>You are <font color='#CC1F19'>" + (-calsOff)) + "</font> calories<br>under your limit</font><br><br>") + tryagainMess, "downArrow");
} else {
showMessageWin("<font size='24' color='#CC1F19'>TOO HIGH</font>", (("<br><font size='20'>You are <font color='#CC1F19'>" + calsOff) + "</font> calories<br>over your limit</font><br><br>") + tryagainMess, "upArrow");
}
theScore = theScore - Math.abs(calsOff);
}
}
function dragMe(incMovie) {
if (roundOver) {
return(0);
}
toolTip("off");
draggedMovie = incMovie;
index = lookup(draggedMovie);
origX = eval (incMovie)._x;
origY = eval (incMovie)._y;
eval (incMovie).swapDepths(1000);
hitT.swapDepths(getNextHighestDepth());
doorAnimation.swapDepths(getNextHighestDepth());
eval (incMovie).startDrag(true, 100, 50, 500, 400);
}
function toolTip(incMovie) {
if (!_root.doorDone) {
return(1);
}
if (incMovie == "toast") {
toolTipM.blurb = "1 Slice of Wheat Toast";
} else if (incMovie == "apple1") {
toolTipM.blurb = "1 Apple";
} else if (incMovie == "cinnamon") {
toolTipM.blurb = "1 Slice of Cinnamon Swirl";
} else if (incMovie == "watermelon") {
toolTipM.blurb = "1 1/4 Cups of Watermelon";
} else if (incMovie == "eggs") {
toolTipM.blurb = "2 Extra Large Poached Eggs";
} else if (incMovie == "orange1") {
toolTipM.blurb = "1 Orange";
} else if (incMovie == "pancakes") {
toolTipM.blurb = "2 6 inch Pancakes with Syrup & Butter";
} else if (incMovie == "bacon") {
toolTipM.blurb = "2 Oz of Cooked Bacon";
} else if (incMovie == "cereal") {
toolTipM.blurb = "3/4 Cup of Corn Flakes. 1 Cup of Skim Milk";
} else if (incMovie == "grapes") {
toolTipM.blurb = "2 Cups of Grapes";
} else if (incMovie == "banana") {
toolTipM.blurb = "1 Banana";
} else if (incMovie == "yoghurt") {
toolTipM.blurb = "1 Cup of Fruit Yogurt";
} else if (incMovie == "salad") {
toolTipM.blurb = "1 Cup of Spinach. 1 Tsp Ranch";
} else if (incMovie == "soup") {
toolTipM.blurb = "1 Cup of Beef with Barley";
} else if (incMovie == "spaghetti") {
toolTipM.blurb = "1 Cup of Spaghetti & Meatballs";
} else if (incMovie == "chicken") {
toolTipM.blurb = "1 Skinless Chicken Leg";
} else if (incMovie == "taco") {
toolTipM.blurb = "1 Taco with Cheese, Beef, Lettuce, Tomato";
} else if (incMovie == "macaroni") {
toolTipM.blurb = "1 Can of Macaroni and Cheese";
} else if (incMovie == "chips") {
toolTipM.blurb = "1 oz of Potato Chip";
} else if (incMovie == "choccake") {
toolTipM.blurb = "1 Piece of Chocolate Cake";
} else if (incMovie == "shrimp") {
toolTipM.blurb = "4 oz of Large Shrimp (Breaded & Fried)";
} else if (incMovie == "potato") {
toolTipM.blurb = "1 Baked Potato with Sour Cream and Chives";
} else if (incMovie == "ribs") {
toolTipM.blurb = "4 oz of Baby Back Ribs";
} else if (incMovie == "springRoll") {
toolTipM.blurb = "1 Panda Express Egg Roll";
} else if (incMovie == "peanuts") {
toolTipM.blurb = "1/4 Cups of Raw Valencia Peanuts";
} else if (incMovie == "pizza") {
toolTipM.blurb = "1 Slice of Domino's America's Favorite Feast";
} else if (incMovie == "fries") {
toolTipM.blurb = "1 Serving of Fries";
} else if (incMovie == "icecream") {
toolTipM.blurb = "1/2 Cup of French Vanilla Ice Cream";
} else if (incMovie == "carrot") {
toolTipM.blurb = "1 Cup Carrots";
} else if (incMovie == "steak") {
toolTipM.blurb = "16 oz Sirloin Strip";
} else if (incMovie == "burger") {
toolTipM.blurb = "1 McDonald's Cheeseburger";
} else if (incMovie == "broccoli") {
toolTipM.blurb = "1 Cup of Broccoli";
} else if (incMovie == "fish") {
toolTipM.blurb = "1 Fillet of Flounder";
} else if (incMovie == "candy") {
toolTipM.blurb = "1 Dark Chocolate Bar with Almonds";
}
if (incMovie == "off") {
toolTipM._visible = false;
toolTipOn = false;
} else {
toolTipOn = true;
toolTipM._x = _xmouse;
toolTipM._y = _ymouse;
toolTipM.swapDepths(getNextHighestDepth());
toolTipM._visible = true;
}
}
function dropMe() {
if (roundOver) {
return(0);
}
eval (draggedMovie).stopDrag();
if (eval (eval (draggedMovie)._droptarget) == hitT) {
dropped[index] = true;
if (draggedMovie == "eggs") {
eval (draggedMovie).gotoAndStop(2);
}
} else if (eval (eval (draggedMovie)._droptarget) == fridgeT) {
dropped[index] = false;
if (draggedMovie == "eggs") {
eval (draggedMovie).gotoAndStop(1);
}
eval (draggedMovie)._x = coOrdX[index];
eval (draggedMovie)._y = coOrdY[index];
eval (draggedMovie)._xscale = 100;
eval (draggedMovie)._yscale = 100;
} else {
dropped[index] = false;
eval (draggedMovie)._x = coOrdX[index];
eval (draggedMovie)._y = coOrdY[index];
eval (draggedMovie)._xscale = 100;
eval (draggedMovie)._yscale = 100;
eggs.gotoAndStop(1);
}
}
hitT._alpha = 0;
fridgeT._alpha = 0;
dragging = true;
messageWin._visible = false;
toolTipOn = false;
toolTipM._visible = false;
doorAnimation._visible = true;
if (soundOn) {
speakerButt.gotoAndStop(2);
}
this.onMouseMove = function () {
toolTipM._x = _xmouse;
toolTipM._y = _ymouse;
if (dragging) {
scaleUp = eval (draggedMovie)._x - coOrdX[index];
if (scaleUp > 200) {
scaleUp = 200;
}
if (scaleUp <= 0) {
scaleUp = 0;
}
eval (draggedMovie)._xscale = 100 + scaleUp;
eval (draggedMovie)._yscale = 100 + scaleUp;
}
};
this.onMouseDown = function () {
if (!roundOver) {
dragging = true;
}
};
this.onMouseUp = function () {
if (!roundOver) {
dragging = false;
}
};
if (rulesHit) {
init();
nextLevel();
} else {
messageWin.messBody = "Drag food items from the refrigerator to the plate, trying to match the calorie goal within the time limit.\n\nWhen you think you have placed the correct amount of calories on the plate, hit the \"SUBMIT\" button.\n\nYou score bonus points for healthier items and receive negative points when not within the calorie range.";
messageWin.swapDepths(_root.getNextHighestDepth());
messageWin.messTitle = "GAME RULES";
messageWin.gotoAndStop(1);
sfxM.gotoAndPlay("popup");
messageWin._visible = true;
stop();
}
Frame 8
doorAnimation.gotoAndPlay(2);
stop();
Frame 14
resetLevel();
stop();
Symbol 9 Button
on (press) {
this._visible = false;
if (!_root.rulesHit) {
_root.init();
_root.nextLevel();
_root.rulesHit = true;
}
}
Symbol 12 Button
on (press) {
if (_root.gameOver) {
_root.gotoAndPlay("CTA");
this._visible = false;
return(0);
}
if (_root.roundOver) {
if (_root.dayMeal == 5) {
trace("dayMeal" + _root.dayMeal);
_root.showMessageWin2("CONGRATULATIONS", "<font size='32' color='#B1D470'>YOU WON!</font><br><br><font size='14'>WAY TO COUNT THOSE CALORIES, YOU'LL BE ON<BR>YOUR WAY TO A HEALTHIER YOU IN NO TIME!</font>");
gotoAndPlay (4);
return(0);
}
_root.resetLevel();
_root.nextLevel();
}
messBodyT.text = "";
this._visible = false;
}
Symbol 15 MovieClip Frame 1
stop();
Symbol 15 MovieClip Frame 2
stop();
Symbol 15 MovieClip Frame 3
stop();
Symbol 23 Button
on (press) {
_root.gotoAndPlay("CTA");
_visible = false;
gotoAndStop (1);
}
Symbol 26 MovieClip Frame 1
stop();
Symbol 26 MovieClip Frame 3
messBodyT.htmlText = ("<b>" + _root.messB) + "</b>";
messTitleT.htmlText = ("<b>" + _root.messT) + "</b>";
stop();
Symbol 26 MovieClip Frame 4
messBodyT.htmlText = ("<b>" + _root.messB) + "</b>";
stop();
Symbol 26 MovieClip Frame 6
messBodyT.htmlText = ("<b>" + _root.messB) + "</b>";
messTitleT.htmlText = ("<b>" + _root.messT) + "</b>";
stop();
Symbol 30 MovieClip Frame 1
stop();
Symbol 37 MovieClip Frame 1
stop();
Symbol 37 MovieClip Frame 13
gotoAndStop (1);
Symbol 37 MovieClip Frame 36
gotoAndStop (1);
Symbol 37 MovieClip Frame 62
gotoAndStop (1);
Symbol 37 MovieClip Frame 79
gotoAndStop (1);
Symbol 37 MovieClip Frame 82
gotoAndStop (1);
Symbol 37 MovieClip Frame 102
gotoAndStop (1);
Symbol 40 MovieClip Frame 1
stop();
Symbol 40 MovieClip Frame 2
if (_root.doorDone) {
_parent.prevFrame();
} else {
gotoAndStop (1);
}
Symbol 40 MovieClip Frame 3
gotoAndPlay (2);
Symbol 46 MovieClip Frame 1
_root.doorDone = false;
stop();
Symbol 46 MovieClip Frame 30
_root.doorDone = true;
stop();
Symbol 49 MovieClip Frame 1
stop();
Symbol 49 MovieClip Frame 9
gotoAndStop (1);
Symbol 55 MovieClip Frame 1
stop();
Symbol 55 MovieClip Frame 2
stop();
Symbol 55 MovieClip Frame 3
stop();
Symbol 55 MovieClip Frame 4
stop();
Symbol 66 Button
on (press) {
sfxM.gotoAndPlay("click");
}
on (release) {
gotoAndPlay ("Game");
}
Symbol 68 Button
on (press) {
_root.rulesHit = true;
messageWin.messBody = "Drag food items from the refrigerator to the plate, trying to match the calorie goal within the time limit.\n\nWhen you think you have placed the correct amount of calories on the plate, hit the \"SUBMIT\" button.\n\nYou score bonus points for healthier items and receive negative points when not within the calorie range.";
messageWin.swapDepths(_root.getNextHighestDepth());
messageWin.messTitle = "GAME RULES";
messageWin.gotoAndStop(1);
sfxM.gotoAndPlay("popup");
messageWin._visible = true;
}
Symbol 69 Button
on (press) {
sfxM.gotoAndPlay("click");
_root.gotoAndPlay("CTA");
}
Symbol 72 Button
on (press) {
_root.soundOn = true;
_root.nosfxM._name = "sfxM";
_root.norightM._name = "rightM";
_root.soundM.gotoAndStop(2);
gotoAndStop (2);
}
Symbol 75 Button
on (press) {
_root.soundOn = false;
_root.sfxM._name = "nosfxM";
_root.soundM.gotoAndStop(1);
_root.rightM._name = "norightM";
stopAllSounds();
gotoAndStop (1);
}
Symbol 76 MovieClip Frame 1
stop();
Symbol 76 MovieClip Frame 2
stop();
Symbol 101 Button
on (rollOver) {
_root.toolTip(_name);
}
on (rollOut) {
_root.toolTip("off");
}
on (press) {
_root.dragMe(_name);
}
on (release, releaseOutside) {
_root.dropMe();
}
Symbol 103 Button
on (press) {
_root.submitHit();
sfxM.gotoAndPlay("click");
}
Symbol 104 Button
on (press) {
_root.gotoAndPlay("CTA");
}
Symbol 115 Button
on (rollOver) {
_root.toolTip(_name);
}
on (rollOut) {
_root.toolTip("off");
}
on (press) {
_root.dragMe(_name);
}
on (release) {
_root.dropMe();
}
Symbol 165 MovieClip Frame 1
stop();
Symbol 165 MovieClip Frame 2
stop();
Symbol 197 Button
on (press) {
gotoAndPlay ("Menu");
}
Symbol 200 Button
on (press) {
getURL (_root.tellFriendURL);
}
Symbol 203 Button
on (press) {
getURL (_root.registerURL);
}
Symbol 204 Button
on (press) {
getURL (_root.registerURL);
}
Symbol 205 Button
on (press) {
getURL ("http://www.questioneverything.com");
}