From 7bc26ead50b573a9f2b3e9998501f5af6e5fcbbb Mon Sep 17 00:00:00 2001 From: Robert Chen Date: Sat, 30 Nov 2013 17:55:14 -0800 Subject: [PATCH] Score screen laid out --- js/dialogue.js | 12 ++- js/main.js | 39 +++++-- js/model.js | 7 +- js/screens.js | 156 ++++++++++++++++++++++++---- js/soundmanager.js | 1 + js/ui.js | 136 +++++++++++++----------- res/items/.DS_Store | Bin 15364 -> 15364 bytes res/screens/.DS_Store | Bin 12292 -> 12292 bytes res/screens/KitchenScreen/.DS_Store | Bin 15364 -> 15364 bytes res/screens/ScoreScreen/.DS_Store | Bin 6148 -> 6148 bytes res/sound/.DS_Store | Bin 12292 -> 12292 bytes res/sound/Events/.DS_Store | Bin 6148 -> 6148 bytes res/sound/Events/Fire/.DS_Store | Bin 6148 -> 6148 bytes res/sound/GUI/.DS_Store | Bin 6148 -> 6148 bytes res/sound/Kitchen/.DS_Store | Bin 6148 -> 6148 bytes 15 files changed, 257 insertions(+), 94 deletions(-) diff --git a/js/dialogue.js b/js/dialogue.js index 9f814c5..5e7134d 100644 --- a/js/dialogue.js +++ b/js/dialogue.js @@ -65,7 +65,10 @@ function DialogUI( stage, gameState ){ this.textContent.addEventListener( "mouseout", function(){ document.body.style.cursor='default'; } ); this.textContent.addEventListener( "click", function(){ setTimeout( clickEvent, 100); }); + this.endFunc = function(){}; + this.showDialog= function( textSeq ){ + console.log("showing"+ textSeq); if( !peopleImg["Me"] ){ peopleImg["Me"] = peopleImg[gameState.gender]; } @@ -90,6 +93,8 @@ function DialogUI( stage, gameState ){ that.currDialogueSeq = new DialogueSequence( textSeq.seq ); var nextDialogue = that.currDialogueSeq.next(); + that.endFunc = textSeq.endFunc || function(){}; + that.textContent.text=nextDialogue[1]; that.currentFace.y = 250; that.currentFace = peopleImg[nextDialogue[0]] || that.currentFace; @@ -137,9 +142,12 @@ function DialogUI( stage, gameState ){ that.currentFace.y = 0; }else{ // pause and close dialog - setTimeout( function(){that.dialogMotionQueue.push(DIALOG_RECEDING)}, 250 ); + setTimeout( function(){ + that.dialogMotionQueue.push(DIALOG_RECEDING); + if( that.endFunc ) + that.endFunc(); + }, 250 ); } - delayCounter = 0; oldTime = new Date().getTime(); } diff --git a/js/main.js b/js/main.js index a0f5bd0..fdb67cc 100644 --- a/js/main.js +++ b/js/main.js @@ -3,9 +3,10 @@ function GameState(){ this.pubsub = {}; BindPubSub( this.pubsub ); - this.currentTime = new Date().getTime(); - this.oldTime = new Date().getTime(); - this.oldDialogueTime = new Date().getTime(); + this.currentTime = Date.now(); //new Date().getTime(); + this.startTime = Date.now();//new Date().getTime() + this.oldTime = Date.now();// new Date().getTime(); + this.oldDialogueTime = Date.now();//new Date().getTime(); this.gameStarted = false; this.name = ""; @@ -18,13 +19,21 @@ function GameState(){ this.turkeyCooking = false; this.turkeyType = ""; this.alarmTimer = 0; + this.alarmBought = false; + this.alarmActivated = false; // stats this.storeVisits = 0; this.dialogHeard = 0; this.ovenOpened = 0; -// Game State flags + // modifiers + this.turkeyTypeModifier = 1; + this.stuffingTypeModifier = 1; + this.frillsModifier = 1; + this.hardcoreModifier = 1; + + // Game State flags this.turkeyBought = false; var randomWeight = [ (UtilityFunctions.randRange(10,22)+"."+UtilityFunctions.randRange(10,99)), (UtilityFunctions.randRange(10,22)+"."+UtilityFunctions.randRange(10,99)), @@ -74,8 +83,8 @@ function GameState(){ queue.loadFile( {id: "HelpP7P8", src:"res/screens/HelpCreditsScreen/HelpP7P8.png" } ); - - queue.loadFile( {id: "ScoreScreenFile", src:"res/screens/ScoreScreen/Score-Tally.png" } ); + queue.loadFile( {id: "ScoreScreenFile", src:"res/screens/ScoreScreen/Score-Evaluation-1.png" } ); + queue.loadFile( {id: "ScoreScreenFile", src:"res/screens/ScoreScreen/Score-Evaluation-2.png" } ); queue.loadFile( {id: "HelpScreenFile", src:"res/screens/HelpCreditsScreen/Credits.png" } ); queue.loadFile( {id: "MarketScreenfile", src:"res/screens/MarketScreen/MarketScreen.png"} ); @@ -146,6 +155,7 @@ function GameState(){ queue.loadFile( {id: "res/sound/Kitchen/Close_Cookbook.mp3", src:"res/sound/Kitchen/Close_Cookbook.mp3"}); queue.loadFile( {id: "res/sound/Kitchen/Open_Cookbook.mp3", src:"res/sound/Kitchen/Open_Cookbook.mp3"}); queue.loadFile( {id: "res/sound/Kitchen/sizzle.mp3", src:"res/sound/Kitchen/sizzle.mp3"} ); + queue.loadFile( {id: "res/sound/Kitchen/Double_Beep.mp3", src:"res/sound/Kitchen/Double_Beep.mp3"} ); // Market Items queue.loadFile( {id: "res/screens/MarketScreen/MarketTopShelf.png", src:"res/screens/MarketScreen/MarketTopShelf.png"}); @@ -262,6 +272,19 @@ function GameState(){ "General Turkey": new MarketItem( this, "General Turkey", 378,426, randomWeight[4]*0.80, "res/items/Turkey1.png", "res/items/Turkey1Glow.png",null,null, "100% General Satisfaction Guaranteed", parseFloat(randomWeight[4]) ) }; + // Important Model, dummy placeholder + this.ovenModel = { secondTick:function(){}, setRawTemp:function(){}, getRawTemp:function(){}, getCookTime:function(){return 1000;} }; + + + /* all turkeys */ + this.turkeyStates = [ + new createjs.Bitmap( "res/screens/KitchenScreen/TurkeyState1Small.svg" ), + new createjs.Bitmap( "res/screens/KitchenScreen/TurkeyState2Small.svg" ), + new createjs.Bitmap( "res/screens/KitchenScreen/TurkeyState3Small.svg" ), + new createjs.Bitmap( "res/screens/KitchenScreen/TurkeyState4Small.svg" ), + new createjs.Bitmap( "res/screens/KitchenScreen/TurkeyState5Small.svg" ) + ]; + this.purchasedItems = []; // did we already show the player the kitchen intro? @@ -325,7 +348,7 @@ function GameUI( canvasElem, gameState ){ var soundManager = new SoundManager( gameState ); - this.activeScreenObj = new KitchenScreen( this.stage, gameState ); + this.activeScreenObj = new LoadingScreen( this.stage, gameState ); var textContent = new createjs.Text( "", "20px Arial", "#00000000" ); textContent.x = 750; textContent.y = 30; @@ -357,7 +380,7 @@ function GameUI( canvasElem, gameState ){ gameState.pubsub.subscribe( "ActuallySwitchScreen", this.actuallySwitchScreen ); // Allow items to be removed if they don't have access to stage - gameState.pubsub.subscribe("RemoveItems", function(items){ + gameState.pubsub.subscribe( "RemoveItems", function(items){ for (var index in items ){ that.stage.removeChild(items[index]); } diff --git a/js/model.js b/js/model.js index 37f9554..657b0cd 100644 --- a/js/model.js +++ b/js/model.js @@ -93,9 +93,9 @@ function OvenModel( turkeyWeight, gameState ) { if (this.steadyTimer>=80) { //Reset the model's time calculation if there are major changes in the tolerance of the temperature or the steady timer expires this.steadyTimer = 0; + this.globalTime = 0; this.steadyTemp = this.tempInfini turkey.resetLayerTemps(); - this.globalTime = 0; } return(true); } @@ -128,6 +128,9 @@ function OvenModel( turkeyWeight, gameState ) { }, getRawTemp: function(){ return that.tempInfini; + }, + getCookTime: function(){ + return that.globalTime; }, secondTick: function(){ that.globalTime = that.globalTime + 1; @@ -290,7 +293,7 @@ UtilityFunctions = { cookCondition: function(cookValue,volume){ var multiplier = 1; if (cookValue>=multiplier*600000) { - return ["House Fire", (cookValue-600000)/(multiplier*600000),"on fire"]; + return ["Fire", (cookValue-600000)/(multiplier*600000),"like it's on fire"]; } else if(cookValue>=multiplier*250000) { return ["Burnt", (cookValue-250000)/(multiplier*600000), "burnt"]; diff --git a/js/screens.js b/js/screens.js index 38aea9e..a80cce9 100644 --- a/js/screens.js +++ b/js/screens.js @@ -256,7 +256,9 @@ function KitchenScreen( stage, gameState ){ this.uiElems.push( gameState.ovenUI ? gameState.ovenUI.render() : ( gameState.ovenUI = new OvenUI( stage, gameState ) ).render() ); this.uiElems.push( new ClockUI( stage, gameState ) ); - this.uiElems.push( new AlarmUI(stage, gameState) ); + + if( gameState.alarmBought ) + this.uiElems.push( new AlarmUI(stage, gameState) ); stage.addChild( new Button( stage, gameState, 14, 17, 73, 45, null,null, function(){ gameState.pubsub.publish("ShowHelp","");} ) ); @@ -389,22 +391,144 @@ function MarketScreen( stage, gameState ){ function ScoreScreen( stage, gameState ){ var that = this; + // All the text for the entries + var totalCookTime = gameState.ovenModel.getCookTime(); + var realTimeElapsed = Date.now() - gameState.startTime; + + var turkeyState = gameState.ovenModel.getTurkeyState(); + var finalCoreTemperature; + var totalScore; + gameState.pubsub.publish( "FadeOut", "" ); - this.background = new createjs.Bitmap( "res/screens/ScoreScreen/Score-Tally.png" ); + this.background = new createjs.Bitmap( "res/screens/ScoreScreen/Score-Evaluation-1.png" ); + this.background.alpha = 0; stage.addChild( this.background ); + + background1 = new createjs.Bitmap( "res/screens/ScoreScreen/Score-Evaluation-2.png" ); + background1.alpha = 1; + stage.addChild( background1 ); + + for (i in gameState.turkeyStates){ + gameState.turkeyStates[i].scaleX = gameState.turkeyStates[i].scaleY = 1; + gameState.turkeyStates[i].x = 490; + gameState.turkeyStates[i].y = 110; + stage.addChild(gameState.turkeyStates[i]); + } + gameState.pubsub.publish( "BackgroundLoop", {name:"TitleMusic", pos:5650, volume:0.7} ); - // + gameState.pubsub.publish( "ShowDialog", {seq:"NoMoney", autoAdvance:true, endFunc:function(){ + background1.alpha=1; - // Retry button - stage.addChild( new Button( stage, gameState, 590, 350, 200, 55, null, null, function(){ document.location.reload(); } ) ); + }} ); - // All the text for the entries - var totalCookTime; - var realTimeElapsed; - var finalCoreTemperature; - var totalScore; + stage.addChild( new Button( stage, gameState, 590, 540, 190, 50, null, null, function(){ document.location.reload(); } ) ); + + + // Cooking stats + var hours = parseInt( totalCookTime / 3600 ) % 24 + var minutes = parseInt( totalCookTime / 60 ) % 60; + var timeText = hours + ":" + minutes; + + var totalCookTimeText = new createjs.Text( timeText, "20px Arial", "#00000000" ); + totalCookTimeText.x = 270; + totalCookTimeText.y = 107; + + realTimeElapsed /= 1000; + hours = parseInt( realTimeElapsed / 3600 ) % 24 + minutes = parseInt( realTimeElapsed / 60 ) % 60; + timeText = hours + ":" + minutes; + + var realtimeElapsedText = new createjs.Text( timeText, "20px Arial", "#00000000" ); + realtimeElapsedText.x = 270; + realtimeElapsedText.y = 127; + + var ovenOpenedText = new createjs.Text( gameState.ovenOpened, "20px Arial", "#00000000" ); + ovenOpenedText.x = 270; + ovenOpenedText.y = 147; + + var dialogueHeardText = new createjs.Text( gameState.dialogHeard, "20px Arial", "#00000000" ); + dialogueHeardText.x = 270; + dialogueHeardText.y = 167; + + + stage.addChild( totalCookTimeText ); + stage.addChild( realtimeElapsedText ); + stage.addChild( ovenOpenedText ); + stage.addChild( dialogueHeardText ); + + // Cookedness Score + var outerConditionText = new createjs.Text( "100", "20px Arial", "#00000000" ); + outerConditionText.x = 310; + outerConditionText.y = 320; + + var coreConditionText = new createjs.Text( "200", "20px Arial", "#00000000" ); + coreConditionText.x = 310; + coreConditionText.y = 340; + + var outerConditionDesc = new createjs.Text( "RAW", "20px Arial", "#00000000" ); + outerConditionDesc.x = 150; + outerConditionDesc.y = 320; + + var coreConditionDesc = new createjs.Text( "COOKED", "20px Arial", "#00000000" ); + coreConditionDesc.x = 150; + coreConditionDesc.y = 340; + + stage.addChild( coreConditionText ); + stage.addChild( outerConditionText ); + + stage.addChild( coreConditionDesc ); + stage.addChild( outerConditionDesc ); + + // Temperature Score + var outerTemp = UtilityFunctions.C2F(turkeyState.skin.temp).toFixed(2); + var coreTemp = UtilityFunctions.C2F(turkeyState.core.temp).toFixed(2); + + var outerTemperatureText = new createjs.Text( "100", "20px Arial", "#00000000" ); + outerTemperatureText.x = 680; + outerTemperatureText.y = 320; + + var coreTemperatureText = new createjs.Text( "200", "20px Arial", "#00000000" ); + coreTemperatureText.x = 680; + coreTemperatureText.y = 340; + + var outerTemperatureDesc = new createjs.Text( outerTemp + " F", "20px Arial", "#00000000" ); + outerTemperatureDesc.x = 530; + outerTemperatureDesc.y = 320; + + var coreTemperatureDesc = new createjs.Text( coreTemp + " F", "20px Arial", "#00000000" ); + coreTemperatureDesc.x = 530; + coreTemperatureDesc.y = 340; + + stage.addChild( outerTemperatureText ); + stage.addChild( coreTemperatureText ); + + stage.addChild( coreTemperatureDesc ); + stage.addChild( outerTemperatureDesc ); + + + // Modifiers + var turkeyTypeModifierText = new createjs.Text( "x"+"1", "20px Arial", "#00000000" ); + turkeyTypeModifierText.x = 310; + turkeyTypeModifierText.y = 437; + + var stuffingTypeModifierText = new createjs.Text( "x"+"1", "20px Arial", "#00000000" ); + stuffingTypeModifierText.x = 310 + stuffingTypeModifierText.y = 457; + + var frillsModifierText = new createjs.Text( "x"+"1", "20px Arial", "#00000000" ); + frillsModifierText.x = 310 + frillsModifierText.y = 477; + + var hardcoreModifierText = new createjs.Text( "x"+"10", "20px Arial", "#00000000" ); + hardcoreModifierText.x = 310 + hardcoreModifierText.y = 497; + + stage.addChild( stuffingTypeModifierText ); + stage.addChild( turkeyTypeModifierText ); + stage.addChild( frillsModifierText ); + stage.addChild( hardcoreModifierText ); // Optimal Temperature to be served at this.scoreDistribution= function(inputTemp) { @@ -413,19 +537,9 @@ function ScoreScreen( stage, gameState ){ return(Math.exp(-(Math.pow((inputTemp-desiredAverage),2)/(2*variance)))) }; - - this.uiElems = []; return { - blit : function(){ - - // Draw all the uiElements - for( var index in that.uiElems ){ - that.uiElems[ index ].tick(); - } - } + blit : function(){} } - - // Retry Button } function CreditsScreen( stage, gameState ){ diff --git a/js/soundmanager.js b/js/soundmanager.js index 4ef98f1..6248fce 100644 --- a/js/soundmanager.js +++ b/js/soundmanager.js @@ -22,6 +22,7 @@ function SoundManager( gameState ){ createjs.Sound.registerSound("res/sound/Store/buy.mp3", "Buy"); createjs.Sound.registerSound("res/sound/Store/entrance.mp3", "Entrance"); createjs.Sound.registerSound("res/sound/GUI/ding.mp3", "Ding"); + createjs.Sound.registerSound("res/sound/Kitchen/Double_Beep.mp3", "BeepBeep"); // Kitchen sound createjs.Sound.registerSound("res/sound/Kitchen/Oven_Door_Full_Open.mp3", "Oven_Door_Full_Open"); diff --git a/js/ui.js b/js/ui.js index bf4f595..8398ff3 100644 --- a/js/ui.js +++ b/js/ui.js @@ -152,28 +152,31 @@ function AlarmUI(stage, gameState){ var that = this; this.showingConfirm = false; - var finalImg = new createjs.Bitmap("res/screens/KitchenScreen/AlarmKitchen.png"); - + var oldTime = Date.now(); + var showColon = true; var timerText = new createjs.Text("00:00", "24px Arial", "#ffffffff" ); timerText.x = 372; timerText.y = 290; var clearButton = new Button( stage, gameState, 364, 327, 17, 13, null, null, function(){ gameState.alarmTimer = 0; + gameState.alarmActivated = false; that.updateTimer(); } ); var hourButton = new Button( stage, gameState, 386, 327, 24, 13, null, null, function(){ gameState.alarmTimer +=3600; + gameState.alarmActivated = true; that.updateTimer(); } ); var minuteButton = new Button( stage, gameState, 414, 327, 24, 13, null, null, function(){ gameState.alarmTimer +=300; + gameState.alarmActivated = true; that.updateTimer(); } ); this.updateTimer = function(){ - var colon = gameState.currentTime%2 ? ":" : " "; + var colon = showColon ? ":" : " "; var totalSec = gameState.alarmTimer; var hours = parseInt( totalSec / 3600 ) % 24 var minutes = parseInt( totalSec / 60 ) % 60; @@ -181,22 +184,38 @@ function AlarmUI(stage, gameState){ timerText.text = timeText; } + this.activateTimer = function(){ + gameState.alarmActivated = true; + } + // Show core temperature - //this.showAlarmUI = function(){ - stage.addChild( finalImg ); - stage.addChild( timerText ); - stage.addChild( clearButton ); - stage.addChild( hourButton ); - stage.addChild( minuteButton ); - //}; - //alarmTimer + + stage.addChild( timerText ); + stage.addChild( clearButton ); + stage.addChild( hourButton ); + stage.addChild( minuteButton ); + + this.updateTimer(); return{ - secondTick: function(){ - that.updateTimer(); - }, - tick:function(){ + tick: function(){ + // IMPORTANT: SECOND TIMER + var diff = Date.now() - oldTime; + if( diff > 1000 ){ + if( gameState.alarmActivated && gameState.alarmTimer <=0 ){ + gameState.alarmTimer = 0; + gameState.pubsub.publish("Play", "BeepBeep") + } + + that.updateTimer(); + showColon = !showColon; + + if( gameState.alarmActivated ) + gameState.alarmTimer --; + + oldTime = Date.now(); + } } } @@ -272,10 +291,6 @@ function OvenUI( stage, gameState ){ var OVEN_OPEN = 2; this.ovenDoor = OVEN_CLOSED; - - // Important Model, dummy placeholder - var ovenModel = { secondTick:function(){}, setRawTemp:function(){}, getRawTemp:function(){} }; - var ovenLight = new createjs.Shape(); ovenLight.graphics.beginFill( "black" ).drawCircle( 181, 126, 2 ); @@ -289,20 +304,13 @@ function OvenUI( stage, gameState ){ } } this.doneSkipTime = true; - var turkeyStates = [ - new createjs.Bitmap( "res/screens/KitchenScreen/TurkeyState1Small.svg" ), - new createjs.Bitmap( "res/screens/KitchenScreen/TurkeyState2Small.svg" ), - new createjs.Bitmap( "res/screens/KitchenScreen/TurkeyState3Small.svg" ), - new createjs.Bitmap( "res/screens/KitchenScreen/TurkeyState4Small.svg" ), - new createjs.Bitmap( "res/screens/KitchenScreen/TurkeyState5Small.svg" ) - ]; // place turkeys in oven - for (i in turkeyStates){ - turkeyStates[i].alpha = 0; - turkeyStates[i].scaleX = turkeyStates[i].scaleY =1; - turkeyStates[i].x = 75; - turkeyStates[i].y = 258; + for (i in gameState.turkeyStates){ + gameState.turkeyStates[i].alpha = 0; + gameState.turkeyStates[i].scaleX = gameState.turkeyStates[i].scaleY =1; + gameState.turkeyStates[i].x = 75; + gameState.turkeyStates[i].y = 258; } var temperatureText = new createjs.Text( "OFF", "40px Arial", "#ff7700" ); @@ -346,6 +354,10 @@ function OvenUI( stage, gameState ){ temp = temp < 150 ? temp = "OFF" : temp; // Check upper bound + if( temp > 500 ){ + redState.alpha = ( temp - 500 )/( 1100 - 500 ); + } + // if over 1100 F, burn house down if( temp > 1100 ){ console.log("You have died in a fire"); @@ -356,7 +368,7 @@ function OvenUI( stage, gameState ){ } // Tell our model to set the actual temperature - ovenModel.changeTemp( UtilityFunctions.F2C( temperatureText.text == "OFF" ? 125 : parseInt( temperatureText.text ) ) ); + gameState.ovenModel.changeTemp( UtilityFunctions.F2C( temperatureText.text == "OFF" ? 125 : parseInt( temperatureText.text ) ) ); } else{ gameState.pubsub.publish("ShowDialog",{seq:"EmptyOven", autoAdvance: true}); @@ -382,8 +394,8 @@ function OvenUI( stage, gameState ){ } this.startTurkeyModel = function(){ - console.log("weight is" + gameState.turkeyWeight) - ovenModel = new OvenModel( gameState.turkeyWeight, gameState ); + console.log("weight is" + gameState.turkeyWeight); + gameState.ovenModel = new OvenModel( gameState.turkeyWeight, gameState ); } var handleBar = new createjs.Shape(); @@ -405,10 +417,10 @@ function OvenUI( stage, gameState ){ handleBar.alpha = 0.5; if( gameState.turkeyBought ){ - var state = ovenModel.getTurkeyState(); + var state = gameState.ovenModel.getTurkeyState(); gameState.pubsub.publish( "ShowDialog", {seq:"custom", autoAdvance:true, customText:"Hmm... Looks " + turkeyState["skin"]["cond"][2] + "." } ); gameState.pubsub.publish( "AddRecord", {type:"Open ", text:"The turkey looked " + turkeyState["skin"]["cond"][2]} ); - ovenModel.setRawTemp( (ovenModel.getRawTemp() - 25) < 150 ? 150 : ovenModel.getRawTemp() - 25 ); + gameState.ovenModel.setRawTemp( (gameState.ovenModel.getRawTemp() - 25) < 150 ? 150 : gameState.ovenModel.getRawTemp() - 25 ); } gameState.pubsub.publish( "Play", "Oven_Door_Full_Open" ); @@ -436,7 +448,7 @@ function OvenUI( stage, gameState ){ handleBar.y = 48; if( gameState.turkeyBought ){ - var state = ovenModel.getTurkeyState(); + var state = gameState.ovenModel.getTurkeyState(); gameState.pubsub.publish( "ShowDialog", {seq:"custom", autoAdvance:true, customText:"Looks " + turkeyState["skin"]["cond"][2] } ); gameState.pubsub.publish( "AddRecord", {type:"Peek ", text:"The turkey looked " + turkeyState["skin"]["cond"][2]} ); that.ovenOpened++; @@ -460,7 +472,7 @@ function OvenUI( stage, gameState ){ gameState.pubsub.publish("ShowDialog", {seq:"OpenDoor", autoAdvance:true}); } else{ - state = ovenModel.getTurkeyState(); + state = gameState.ovenModel.getTurkeyState(); gameState.pubsub.publish( "ShowDialog", {seq:"custom", autoAdvance:true, customText:"The core temperature of the turkey reads " + UtilityFunctions.C2F(state.core.temp).toFixed(2) + " F" } ); gameState.pubsub.publish( "AddRecord", {type:"Probe", text:"Core temperature measured: " + UtilityFunctions.C2F(state.core.temp).toFixed(2) + " F"} ); that.ovenOpened++; @@ -482,9 +494,9 @@ function OvenUI( stage, gameState ){ if( that.ovenDoor == OVEN_OPEN ){ // incur -25 upon door open and penalty -5 degrees a second for opening the oven. - ovenModel.setRawTemp( (ovenModel.getRawTemp() - 5) < 150 ? 150 : ovenModel.getRawTemp() - 5 ); + gameState.ovenModel.setRawTemp( (gameState.ovenModel.getRawTemp() - 5) < 150 ? 150 : gameState.ovenModel.getRawTemp() - 5 ); } - ovenModel.secondTick(); + gameState.ovenModel.secondTick(); gameState.currentTime += diff; } @@ -507,18 +519,18 @@ function OvenUI( stage, gameState ){ if( gameState.turkeyBought ){ // what's the state of the turkey - turkeyState = ovenModel.getTurkeyState(); - turkeyStates[0].alpha = 1; + turkeyState = gameState.ovenModel.getTurkeyState(); + gameState.turkeyStates[0].alpha = 1; if( turkeyState["skin"]["cond"][0] == "Undercooked" ) - turkeyStates[1].alpha = turkeyState["skin"]["cond"][1]; + gameState.turkeyStates[1].alpha = turkeyState["skin"]["cond"][1]; if( turkeyState["skin"]["cond"][0] == "Cooked" ) - turkeyStates[2].alpha = turkeyState["skin"]["cond"][1]; + gameState.turkeyStates[2].alpha = turkeyState["skin"]["cond"][1]; if( turkeyState["skin"]["cond"][0] == "Dry" ) - turkeyStates[3].alpha = turkeyState["skin"]["cond"][1]; + gameState.turkeyStates[3].alpha = turkeyState["skin"]["cond"][1]; if( turkeyState["skin"]["cond"][0] == "Burnt" ) - turkeyStates[4].alpha = turkeyState["skin"]["cond"][1]; - if( turkeyState["skin"]["cond"][0] == "House Fire" ) - turkeyStates[4].alpha = 1; + gameState.turkeyStates[4].alpha = turkeyState["skin"]["cond"][1]; + if( turkeyState["skin"]["cond"][0] == "Fire" ) + gameState.turkeyStates[4].alpha = 1; } gameState.oldTime = Date.now(); } @@ -528,34 +540,33 @@ function OvenUI( stage, gameState ){ } }, render: function(){ - + stage.addChild( redState ); stage.addChild( ovenLight ); stage.addChild( temperatureText ); - stage.addChild( this.text ); stage.addChild( lightPressedImg); // Turkey goes here // did the player actually buy a turkey? if so, determine its cooked state if( gameState.turkeyBought ){ // what's the state of the turkey - turkeyState = ovenModel.getTurkeyState(); - turkeyStates[0].alpha = 1; + turkeyState = gameState.ovenModel.getTurkeyState(); + gameState.turkeyStates[0].alpha = 1; if( turkeyState["skin"]["cond"] == "Undercooked" ) - turkeyStates[1].alpha = turkeyState["skin"]["cond"][1]; + gameState.turkeyStates[1].alpha = turkeyState["skin"]["cond"][1]; if( turkeyState["skin"]["cond"] == "Cooked" ) - turkeyStates[2].alpha = turkeyState["skin"]["cond"][1]; + gameState.turkeyStates[2].alpha = turkeyState["skin"]["cond"][1]; if( turkeyState["skin"]["cond"] == "Dry" ) - turkeyStates[3].alpha = turkeyState["skin"]["cond"][1]; + gameState.turkeyStates[3].alpha = turkeyState["skin"]["cond"][1]; if( turkeyState["skin"]["cond"] == "Burnt" ) - turkeyStates[4].alpha = turkeyState["skin"]["cond"][1]; - if( turkeyState["skin"]["cond"] == "House Fire" ) - turkeyStates[4].alpha = 1; + gameState.turkeyStates[4].alpha = turkeyState["skin"]["cond"][1]; + if( turkeyState["skin"]["cond"] == "Fire" ) + gameState.turkeyStates[4].alpha = 1; panFront.alpha = 1; - stage.addChild(turkeyStates[0]); - for(i in turkeyStates){ - stage.addChild(turkeyStates[i]); + stage.addChild(gameState.turkeyStates[0]); + for(i in gameState.turkeyStates){ + stage.addChild(gameState.turkeyStates[i]); } stage.addChild(panFront); } @@ -757,6 +768,9 @@ function MarketItem( gameState, name, x, y, cost, mouseOutImg, mouseOverImg, mou // if we bought an oven light, enable it! if( that.name.indexOf("Light") != -1 ) gameState.boughtOvenLight = true; + // if we bought a clock, enable it! + if( that.name.indexOf("Alarm") != -1 ) gameState.alarmBought = true; + gameState.purchasedItems.push( objReturn ); gameState.marketItems[ that.name ].delete(); that.bought = true; diff --git a/res/items/.DS_Store b/res/items/.DS_Store index 6870db637d8bec6160e2fc851d4e41cd1c013388..6d3921fa1d3a2114f660c0cd091055dd4149004b 100644 GIT binary patch delta 44 zcmZpvXsMXsI9U^hRb(qtY1)6MMy4g3=u+%~f-{9)PbDaypWSw!Q5@Wcjw09%3% A{{R30 delta 101 zcmZpvXsMXsgHU^hRb@?;(XQ)^)cJ%$j542D#OP=-8)M1~@UWFRk-p$sTe1e8f- z$Ym&CF!0RDPfp6oPhwzT5MW?n3<6?~&1M4K{F~Vo{;+J`E5gXUSy1D%@WcjQ0O0)? A-~a#s diff --git a/res/screens/.DS_Store b/res/screens/.DS_Store index 1be77443561cb5cc7e46bb560f58b1dcdd283c13..4f560cda09417eaf4f25ef651e47d7c779b25cef 100644 GIT binary patch delta 100 zcmZokXi3=cP?R<5|9=LC$s0taCW#d@T24M7e*=J0t}F delta 94 zcmZokXi3=cP?R<7|9=LC$s0taCW#eKzAoUkd9TB)qu~2NHo+2a5!~pBf0*noeKvs{bsu)8sLo!1?LlHwNgD!(BLm5LN zLk>eJkSt-y1d8VYMGYt3koRTz|DOQ_h|yrgpvO=E)SB*@lb@WFlb;0CC&0kK7zCv4 zftY*ZE)yok8yi3TXW7io!OsD7-DXC{@640=MGOTPfeIRc7)XPd44VT)wlD(#<#;Js delta 74 zcmZoMXfc=|#>CJ*u~2NHo+2aD!~pBb1|lqz`I(F+-(=FAT*JhrVs)F_>-s*h5<3NFA)O)0s-`sG!lT5E)h$U{}Q7D0r``p6NmvZ MlP?iUvv(AY8xmd;+W-In delta 56 zcmV-80LTA?V1!_>rVs)EIFqOlhLf}sOOtsKxdH(8lQa^50yQ#|FcC?U{}Q7D0Q8fj O6Nr;M6-%>s6pb5G?-Z{9 diff --git a/res/sound/Events/.DS_Store b/res/sound/Events/.DS_Store index 8f1690367ba715f41b948c9aacf4e0697441d25e..5cd71052028a5bd4f9f47619d4ef73f45400933c 100644 GIT binary patch delta 14 VcmZoMXffFEgo)8`^HU~yQ2;4}1pfd4 delta 14 VcmZoMXffFEgo)8)^HU~yQ2;5G1p)v7 diff --git a/res/sound/Events/Fire/.DS_Store b/res/sound/Events/Fire/.DS_Store index 29225a23534507187cb70739fb8d0e3b213b55de..d91f526f30ccc55b5016e3f39248fded76c3c4e0 100644 GIT binary patch delta 23 ecmZoMXffFEgOQDafr0V=|ILg{Y;22JI0OJ&>IRqq delta 23 bcmZoMXffFEgOTk&7;I)_Vq;s(!XW?vk*Erj diff --git a/res/sound/GUI/.DS_Store b/res/sound/GUI/.DS_Store index cdeb3efafb48d9006caa65162f1c6043e7fca271..d2d7c3b8b68ba533f4f1c7e5011a963e0946338d 100644 GIT binary patch delta 46 zcmZoMXfc@J&&akhU^gQp+hiUl)5+CLjaJAnF diff --git a/res/sound/Kitchen/.DS_Store b/res/sound/Kitchen/.DS_Store index dc28d22c7cbbf8c9a2d03475e39d15304cc34a13..b8af1c98ec69194d52778b10900b0edcb1978c91 100644 GIT binary patch delta 66 zcmZoMXfc@J&&atkU^g=(=VTt1N^yP$7lwR>Qiddk9EMbecm^jRnaWTwS%6KP^9%z6 T!wevn++4@v&AgeN<1aq|3Ih)+ delta 31 ncmZoMXfc@J&&aVcU^g=($7CLs%FTyaT$m>|*llL#_{$Ffp1KMX