diff --git a/js/dialogue.js b/js/dialogue.js index 5e7134d..a648ca6 100644 --- a/js/dialogue.js +++ b/js/dialogue.js @@ -114,6 +114,7 @@ function DialogUI( stage, gameState ){ console.log("random story"); this.showDialog( {seq: dialogueList[ randomKey ] || "Dad Tells a bad Joke", autoAdvance:true } ); delete story[ dialogueList[ randomKey ] ]; + gameState.dialogueHeard++; } } diff --git a/js/main.js b/js/main.js index fdb67cc..77fc7ee 100644 --- a/js/main.js +++ b/js/main.js @@ -24,7 +24,7 @@ function GameState(){ // stats this.storeVisits = 0; - this.dialogHeard = 0; + this.dialogueHeard = 0; this.ovenOpened = 0; // modifiers diff --git a/js/model.js b/js/model.js index 657b0cd..86e3d4f 100644 --- a/js/model.js +++ b/js/model.js @@ -293,7 +293,7 @@ UtilityFunctions = { cookCondition: function(cookValue,volume){ var multiplier = 1; if (cookValue>=multiplier*600000) { - return ["Fire", (cookValue-600000)/(multiplier*600000),"like it's on fire"]; + return ["Fire", (cookValue-600000)/(multiplier*600000),"fire"]; } else if(cookValue>=multiplier*250000) { return ["Burnt", (cookValue-250000)/(multiplier*600000), "burnt"]; diff --git a/js/screens.js b/js/screens.js index a80cce9..c18d4f4 100644 --- a/js/screens.js +++ b/js/screens.js @@ -206,8 +206,8 @@ function DifficultyScreen( stage, gameState ){ stage.addChild( new Button( stage, gameState, 500, 235, 100, 55, "ChangeGender", "Male" ) ); stage.addChild( new Button( stage, gameState, 500, 300, 100, 55, "ChangeGender", "Female" ) ); - stage.addChild( new Button( stage, gameState, 503, 370, 200, 55, null, null, function(){ gameState.hard = false; gameState.gameStarted = true; gameState.pubsub.publish("SwitchScreen", "KitchenScreen"); } ) ); - stage.addChild( new Button( stage, gameState, 500, 495, 205, 55, null, null, function(){ gameState.hard = true; gameState.gameStarted = true; gameState.pubsub.publish("SwitchScreen", "KitchenScreen"); } ) ); + stage.addChild( new Button( stage, gameState, 503, 370, 200, 55, null, null, function(){ gameState.hard = false; gameState.gameStarted = true; gameState.hardcoreModifier=20; gameState.pubsub.publish("SwitchScreen", "KitchenScreen"); } ) ); + stage.addChild( new Button( stage, gameState, 500, 495, 205, 55, null, null, function(){ gameState.hard = true; gameState.gameStarted = true; gameState.hardcoreModifier=1; gameState.pubsub.publish("SwitchScreen", "KitchenScreen"); } ) ); stage.addChild( new Button( stage, gameState, 35, 495, 85, 55, "SwitchScreen", "MainScreen" ) ); @@ -396,17 +396,43 @@ function ScoreScreen( stage, gameState ){ var realTimeElapsed = Date.now() - gameState.startTime; var turkeyState = gameState.ovenModel.getTurkeyState(); - var finalCoreTemperature; - var totalScore; + var totalScore = 0; + + var skinScoreChart = { + "raw": 0, + "undercooked": -100, + "slightly cooked": 75, + "cooked": 500, + "overcooked": 200, + "dry": -300, + "burnt": -500 + }; + + var coreScoreChart = { + "raw": 0, + "undercooked": 125, + "slightly cooked": 750, + "cooked": 1000, + "overcooked": 1000, + "dry": 400, + "burnt": 0 + } + + // Optimal Temperature to be served at + this.scoreDistribution= function(inputTemp) { + desiredAverage = 162; + variance = 1000; //Std Deviation 31.62 + return(Math.exp(-(Math.pow((inputTemp-desiredAverage),2)/(2*variance)))) + }; gameState.pubsub.publish( "FadeOut", "" ); this.background = new createjs.Bitmap( "res/screens/ScoreScreen/Score-Evaluation-1.png" ); - this.background.alpha = 0; + this.background.alpha = 1; stage.addChild( this.background ); background1 = new createjs.Bitmap( "res/screens/ScoreScreen/Score-Evaluation-2.png" ); - background1.alpha = 1; + background1.alpha = 0; stage.addChild( background1 ); for (i in gameState.turkeyStates){ @@ -421,121 +447,144 @@ function ScoreScreen( stage, gameState ){ gameState.pubsub.publish( "ShowDialog", {seq:"NoMoney", autoAdvance:true, endFunc:function(){ background1.alpha=1; - }} ); + stage.addChild( new Button( stage, gameState, 590, 540, 190, 50, null, null, function(){ document.location.reload(); } ) ); - 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 seconds = totalCookTime % 60; + var timeText = ("00"+hours).slice(-2) + ":" + ("00"+minutes).slice(-2) + ":" + ("00"+seconds).slice(-2); + var totalCookTimeText = new createjs.Text( timeText, "20px Arial", "#00000000" ); + totalCookTimeText.x = 270; + totalCookTimeText.y = 107; - // Cooking stats - var hours = parseInt( totalCookTime / 3600 ) % 24 - var minutes = parseInt( totalCookTime / 60 ) % 60; - var timeText = hours + ":" + minutes; + realTimeElapsed /= 1000; + hours = parseInt( realTimeElapsed / 3600 ) % 24; + minutes = parseInt( realTimeElapsed / 60 ) % 60; + seconds = realTimeElapsed % 60; + timeText = ("00"+hours).slice(-2) + ":" + ("00"+minutes).slice(-2) + ":" + ("00"+seconds).slice(-2); - var totalCookTimeText = new createjs.Text( timeText, "20px Arial", "#00000000" ); - totalCookTimeText.x = 270; - totalCookTimeText.y = 107; + var realtimeElapsedText = new createjs.Text( timeText, "20px Arial", "#00000000" ); + realtimeElapsedText.x = 270; + realtimeElapsedText.y = 127; - realTimeElapsed /= 1000; - hours = parseInt( realTimeElapsed / 3600 ) % 24 - minutes = parseInt( realTimeElapsed / 60 ) % 60; - timeText = hours + ":" + minutes; + var ovenOpenedText = new createjs.Text( gameState.ovenOpened, "20px Arial", "#00000000" ); + ovenOpenedText.x = 270; + ovenOpenedText.y = 147; - var realtimeElapsedText = new createjs.Text( timeText, "20px Arial", "#00000000" ); - realtimeElapsedText.x = 270; - realtimeElapsedText.y = 127; + var dialogueHeardText = new createjs.Text( gameState.dialogueHeard, "20px Arial", "#00000000" ); + dialogueHeardText.x = 270; + dialogueHeardText.y = 167; - 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 - stage.addChild( totalCookTimeText ); - stage.addChild( realtimeElapsedText ); - stage.addChild( ovenOpenedText ); - stage.addChild( dialogueHeardText ); + var outerConditionDesc = new createjs.Text( turkeyState.skin.cond[2], "20px Arial", "#00000000" ); + outerConditionDesc.x = 150; + outerConditionDesc.y = 320; - // Cookedness Score - var outerConditionText = new createjs.Text( "100", "20px Arial", "#00000000" ); - outerConditionText.x = 310; - outerConditionText.y = 320; + totalScore += parseInt(skinScoreChart[ turkeyState.skin.cond[2]]); - var coreConditionText = new createjs.Text( "200", "20px Arial", "#00000000" ); - coreConditionText.x = 310; - coreConditionText.y = 340; + var coreConditionDesc = new createjs.Text( turkeyState.core.cond[2], "20px Arial", "#00000000" ); + coreConditionDesc.x = 150; + coreConditionDesc.y = 340; - var outerConditionDesc = new createjs.Text( "RAW", "20px Arial", "#00000000" ); - outerConditionDesc.x = 150; - outerConditionDesc.y = 320; + totalScore += parseInt(skinScoreChart[ turkeyState.core.cond[2]]); - var coreConditionDesc = new createjs.Text( "COOKED", "20px Arial", "#00000000" ); - coreConditionDesc.x = 150; - coreConditionDesc.y = 340; + var outerConditionText = new createjs.Text( skinScoreChart[ turkeyState.skin.cond[2] ], "20px Arial", "#00000000" ); + outerConditionText.x = 310; + outerConditionText.y = 320; - stage.addChild( coreConditionText ); - stage.addChild( outerConditionText ); + var coreConditionText = new createjs.Text( coreScoreChart[ turkeyState.skin.cond[2] ], "20px Arial", "#00000000" ); + coreConditionText.x = 310; + coreConditionText.y = 340; - 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); + stage.addChild( coreConditionText ); + stage.addChild( outerConditionText ); - var outerTemperatureText = new createjs.Text( "100", "20px Arial", "#00000000" ); - outerTemperatureText.x = 680; - outerTemperatureText.y = 320; + stage.addChild( coreConditionDesc ); + stage.addChild( outerConditionDesc ); - var coreTemperatureText = new createjs.Text( "200", "20px Arial", "#00000000" ); - coreTemperatureText.x = 680; - coreTemperatureText.y = 340; + // Temperature Score + var outerTemp = UtilityFunctions.C2F(turkeyState.skin.temp).toFixed(2); + var coreTemp = UtilityFunctions.C2F(turkeyState.core.temp).toFixed(2); - var outerTemperatureDesc = new createjs.Text( outerTemp + " F", "20px Arial", "#00000000" ); - outerTemperatureDesc.x = 530; - outerTemperatureDesc.y = 320; + var outerTempScore = that.scoreDistribution( outerTemp ) * 200; + var coreTempScore = that.scoreDistribution( coreTemp ) * 200; - var coreTemperatureDesc = new createjs.Text( coreTemp + " F", "20px Arial", "#00000000" ); - coreTemperatureDesc.x = 530; - coreTemperatureDesc.y = 340; + var outerTemperatureText = new createjs.Text( outerTempScore.toFixed(0), "20px Arial", "#00000000" ); + outerTemperatureText.x = 680; + outerTemperatureText.y = 320; - stage.addChild( outerTemperatureText ); - stage.addChild( coreTemperatureText ); + var coreTemperatureText = new createjs.Text( coreTempScore.toFixed(0), "20px Arial", "#00000000" ); + coreTemperatureText.x = 680; + coreTemperatureText.y = 340; - stage.addChild( coreTemperatureDesc ); - stage.addChild( outerTemperatureDesc ); + var outerTemperatureDesc = new createjs.Text( outerTemp + " F", "20px Arial", "#00000000" ); + outerTemperatureDesc.x = 530; + outerTemperatureDesc.y = 320; + totalScore += parseInt(outerTempScore.toFixed(0)); - // Modifiers - var turkeyTypeModifierText = new createjs.Text( "x"+"1", "20px Arial", "#00000000" ); - turkeyTypeModifierText.x = 310; - turkeyTypeModifierText.y = 437; + var coreTemperatureDesc = new createjs.Text( coreTemp + " F", "20px Arial", "#00000000" ); + coreTemperatureDesc.x = 530; + coreTemperatureDesc.y = 340; - var stuffingTypeModifierText = new createjs.Text( "x"+"1", "20px Arial", "#00000000" ); - stuffingTypeModifierText.x = 310 - stuffingTypeModifierText.y = 457; + totalScore += parseInt(coreTempScore.toFixed(0)); - var frillsModifierText = new createjs.Text( "x"+"1", "20px Arial", "#00000000" ); - frillsModifierText.x = 310 - frillsModifierText.y = 477; + stage.addChild( outerTemperatureText ); + stage.addChild( coreTemperatureText ); - var hardcoreModifierText = new createjs.Text( "x"+"10", "20px Arial", "#00000000" ); - hardcoreModifierText.x = 310 - hardcoreModifierText.y = 497; + stage.addChild( coreTemperatureDesc ); + stage.addChild( outerTemperatureDesc ); - stage.addChild( stuffingTypeModifierText ); - stage.addChild( turkeyTypeModifierText ); - stage.addChild( frillsModifierText ); - stage.addChild( hardcoreModifierText ); + console.log(totalScore); + + // Modifiers + var turkeyTypeModifierText = new createjs.Text( "x"+"1", "20px Arial", "#00000000" ); + turkeyTypeModifierText.x = 310; + turkeyTypeModifierText.y = 437; + + totalScore *= 1; + + var stuffingTypeModifierText = new createjs.Text( "x"+"1", "20px Arial", "#00000000" ); + stuffingTypeModifierText.x = 310 + stuffingTypeModifierText.y = 457; + + totalScore *= 1; + + var frillsModifierText = new createjs.Text( "x"+"1", "20px Arial", "#00000000" ); + frillsModifierText.x = 310 + frillsModifierText.y = 477; + + totalScore *= 1; + + var hardcoreModifierText = new createjs.Text( "x"+gameState.hardcoreModifier, "20px Arial", "#00000000" ); + hardcoreModifierText.x = 310 + hardcoreModifierText.y = 497; + + totalScore *= gameState.hardcoreModifier; + + var totalText = new createjs.Text( totalScore, "32px Arial", "#00000000" ); + totalText.x = 250 + totalText.y = 550; + stage.addChild( totalText ); + + stage.addChild( stuffingTypeModifierText ); + stage.addChild( turkeyTypeModifierText ); + stage.addChild( frillsModifierText ); + stage.addChild( hardcoreModifierText ); + + + }} ); - // Optimal Temperature to be served at - this.scoreDistribution= function(inputTemp) { - desiredAverage = 162; - variance = 1000; //Std Deviation 31.62 - return(Math.exp(-(Math.pow((inputTemp-desiredAverage),2)/(2*variance)))) - }; return { blit : function(){} diff --git a/js/ui.js b/js/ui.js index 8398ff3..f5833b3 100644 --- a/js/ui.js +++ b/js/ui.js @@ -421,6 +421,7 @@ function OvenUI( stage, gameState ){ 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]} ); gameState.ovenModel.setRawTemp( (gameState.ovenModel.getRawTemp() - 25) < 150 ? 150 : gameState.ovenModel.getRawTemp() - 25 ); + gameState.ovenOpened++; } gameState.pubsub.publish( "Play", "Oven_Door_Full_Open" ); @@ -451,7 +452,6 @@ function OvenUI( stage, gameState ){ 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++; } } else if (that.ovenDoor == OVEN_PEEK){ @@ -475,7 +475,6 @@ function OvenUI( stage, gameState ){ 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++; } } diff --git a/res/screens/.DS_Store b/res/screens/.DS_Store index 4f560cd..55da0b3 100644 Binary files a/res/screens/.DS_Store and b/res/screens/.DS_Store differ diff --git a/res/screens/KitchenScreen/.DS_Store b/res/screens/KitchenScreen/.DS_Store index 5bd25ee..cd49bd0 100644 Binary files a/res/screens/KitchenScreen/.DS_Store and b/res/screens/KitchenScreen/.DS_Store differ diff --git a/res/screens/KitchenScreen/Cookbook-Open.png b/res/screens/KitchenScreen/Cookbook-Open.png index 8a72d3c..2189dd5 100644 Binary files a/res/screens/KitchenScreen/Cookbook-Open.png and b/res/screens/KitchenScreen/Cookbook-Open.png differ