diff --git a/js/main.js b/js/main.js index d2ed9a7..0768697 100644 --- a/js/main.js +++ b/js/main.js @@ -71,6 +71,9 @@ function GameState(){ queue.loadFile( {id: "HelpP5P6", src:"res/screens/HelpCreditsScreen/HelpP5P6.png" } ); queue.loadFile( {id: "HelpP7P8", src:"res/screens/HelpCreditsScreen/HelpP7P8.png" } ); + + + queue.loadFile( {id: "ScoreScreenFile", src:"res/screens/ScoreScreen/Score-Tally.png" } ); queue.loadFile( {id: "HelpScreenFile", src:"res/screens/HelpCreditsScreen/Credits.png" } ); queue.loadFile( {id: "MarketScreenfile", src:"res/screens/MarketScreen/MarketScreen.png"} ); @@ -85,6 +88,7 @@ function GameState(){ queue.loadFile( {id: "UILowClickFile", src:"res/sound/GUI/lowclick.mp3"} ); queue.loadFile( {id: "UIClickFile", src:"res/sound/GUI/click.mp3"} ); queue.loadFile( {id: "UIBuzzFile", src:"res/sound/GUI/buzz.mp3"} ); + queue.loadFile( {id: "UIDingFile", src:"res/sound/GUI/ding.mp3"} ); // Kitchen Items queue.loadFile( {id: "res/screens/KitchenScreen/KitchenScreen.png", src:"res/screens/KitchenScreen/KitchenScreen.png"}); @@ -313,8 +317,6 @@ function GameUI( canvasElem, gameState ){ "DifficultyScreen" : DifficultyScreen, "KitchenScreen" : KitchenScreen, "MarketScreen" : MarketScreen, - "TurkeyOutScreen" : TurkeyOutScreen, - "EndingScreen" : EndingScreen, "ScoreScreen" : ScoreScreen, "CreditsScreen" : CreditsScreen } @@ -347,6 +349,7 @@ function GameUI( canvasElem, gameState ){ that.stage.addChild( overlay ); dialogManager.render(); }; + new HelpUI(this.stage, gameState); gameState.pubsub.subscribe( "SwitchScreen", this.switchScreen ); gameState.pubsub.subscribe( "ActuallySwitchScreen", this.actuallySwitchScreen ); diff --git a/js/screens.js b/js/screens.js index 4dbce18..7c8a1c2 100644 --- a/js/screens.js +++ b/js/screens.js @@ -79,7 +79,6 @@ function MainScreen( stage, gameState ){ animation.x = 140; animation.y = 210; - new HelpUI(stage, gameState); animation.addEventListener("tick", handleTick); function handleTick(event){ if ( turkeyAnimations[event.currentTarget.currentAnimation][1] == event.currentTarget.currentFrame ){ @@ -386,51 +385,33 @@ function MarketScreen( stage, gameState ){ } -function TurkeyOutScreen( stage, gameState ){ - var that = this; - - this.background = new createjs.Bitmap( "res/Main.png" ); - stage.addChild( this.background ); - - this.uiElems = []; - return { - blit : function(){ - - // Draw all the uiElements - for( var index in that.uiElems ){ - that.uiElems[ index ].tick(); - } - } - } - - -} +function ScoreScreen( stage, gameState ){ + var that = this; -function EndingScreen( stage, gameState ){ - var that = this; + gameState.pubsub.publish( "FadeOut", "" ); - this.background = new createjs.Bitmap( "res/Main.png" ); + this.background = new createjs.Bitmap( "res/screens/ScoreScreen/Score-Tally.png" ); stage.addChild( this.background ); + gameState.pubsub.publish( "BackgroundLoop", {name:"TitleMusic", pos:5650, volume:1} ); - this.uiElems = []; - return { - blit : function(){ - - // Draw all the uiElements - for( var index in that.uiElems ){ - that.uiElems[ index ].tick(); - } - } - } + // + // 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; -function ScoreScreen( stage, gameState ){ - var that = this; + // 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)))) + }; - this.background = new createjs.Bitmap( "res/Main.png" ); - stage.addChild( this.background ); this.uiElems = []; return { diff --git a/js/soundmanager.js b/js/soundmanager.js index a262f1c..4ef98f1 100644 --- a/js/soundmanager.js +++ b/js/soundmanager.js @@ -21,6 +21,7 @@ function SoundManager( gameState ){ createjs.Sound.registerSound("res/sound/GUI/buzz.mp3", "Error"); 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"); // Kitchen sound createjs.Sound.registerSound("res/sound/Kitchen/Oven_Door_Full_Open.mp3", "Oven_Door_Full_Open"); diff --git a/js/stories.js b/js/stories.js index 67211a6..d577c0f 100644 --- a/js/stories.js +++ b/js/stories.js @@ -1,7 +1,7 @@ var messages = { "Null":["Me: "], "KitchenInitial" : ["Me: I need to buy a turkey..."], - "CannotBuyTurkey" : ["Me: I've barely have time for ONE turkey, let alone TWO!"], + "CannotBuyTurkey" : ["Me: I barely have time for ONE turkey, let alone TWO!"], "NoMoney" : ["Me: I can't afford this!"], "BuyTurkeyFirst" : ["Me: I should buy a turkey first!"], "EmptyOven" : ["Me: Ah, the oven is already preheated..."], diff --git a/js/ui.js b/js/ui.js index b7a5db6..132b008 100644 --- a/js/ui.js +++ b/js/ui.js @@ -77,9 +77,6 @@ function HelpUI( stage, gameState ){ } }); - stage.addChild( this.background ); - stage.addChild( closeButton ); - this.hideHelp = function(){ helpImg.visible=false; stage.removeChild( closeButton ); @@ -104,6 +101,7 @@ function HelpUI( stage, gameState ){ } helpPages[0].visible = true; + stage.addChild( that.background ); stage.addChild( closeButton ); stage.addChild( nextButton ); stage.addChild( prevButton ); @@ -121,7 +119,11 @@ function FinalConfirmationUI(stage, gameState){ this.showingConfirm = false; var finalImg = new createjs.Bitmap("res/screens/KitchenScreen/FinalConfirmation.png"); - var yesButton = new Button( stage, gameState, 355, 338, 388, 50, null, null, function(){that.hideFinalConfirm();} ); + var yesButton = new Button( stage, gameState, 355, 338, 388, 50, null, null, function(){ + gameState.pubsub.publish( "Play", "Ding" ); + gameState.pubsub.publish( "SwitchScreen", "ScoreScreen" ); + that.hideFinalConfirm(); + } ); var noButton = new Button( stage, gameState, 355, 395, 388, 50, null, null, function(){that.hideFinalConfirm();} ); this.hideFinalConfirm = function(){ @@ -335,7 +337,7 @@ function OvenUI( stage, gameState ){ if( gameState.turkeyBought ){ var state = ovenModel.getTurkeyState(); - gameState.pubsub.publish( "ShowDialog", {seq:"custom", autoAdvance:false, customText:"Hmm... Looks " + turkeyState["skin"]["cond"][2] + "." } ); + 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]} ); } @@ -365,7 +367,7 @@ function OvenUI( stage, gameState ){ handleBar.y = 48; if( gameState.turkeyBought ){ var state = ovenModel.getTurkeyState(); - gameState.pubsub.publish( "ShowDialog", {seq:"custom", autoAdvance:false, customText:"Looks " + turkeyState["skin"]["cond"][2] } ); + 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++; } @@ -389,7 +391,7 @@ function OvenUI( stage, gameState ){ } else{ state = ovenModel.getTurkeyState(); - gameState.pubsub.publish( "ShowDialog", {seq:"custom", autoAdvance:false, customText:"The core temperature of the turkey reads " + UtilityFunctions.C2F(state.core.temp).toFixed(2) + " F" } ); + 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++; } @@ -490,9 +492,12 @@ function OvenUI( stage, gameState ){ stage.addChild( panFront ); //finalize button - stage.addChild( new Button( stage, gameState, 45, 250, 250, 175, null, null, function(){ - gameState.pubsub.publish("ShowFinalConfirm",""); - } ) ); + if( gameState.turkeyBought ){ + stage.addChild( new Button( stage, gameState, 45, 250, 250, 175, null, null, function(){ + gameState.pubsub.publish("Play", "Error"); + gameState.pubsub.publish("ShowFinalConfirm",""); + } ) ); + } stage.addChild( doorPeekLightOn); stage.addChild( doorPeekLightOff); diff --git a/res/screens/.DS_Store b/res/screens/.DS_Store index 4efc9e6..1be7744 100644 Binary files a/res/screens/.DS_Store and b/res/screens/.DS_Store differ diff --git a/res/sound/.DS_Store b/res/sound/.DS_Store index 62fe28a..ad501ce 100644 Binary files a/res/sound/.DS_Store and b/res/sound/.DS_Store differ diff --git a/res/sound/GUI/.DS_Store b/res/sound/GUI/.DS_Store index 41bd8e0..cdeb3ef 100644 Binary files a/res/sound/GUI/.DS_Store and b/res/sound/GUI/.DS_Store differ diff --git a/res/sound/GUI/ding.mp3 b/res/sound/GUI/ding.mp3 new file mode 100644 index 0000000..0bf27e4 Binary files /dev/null and b/res/sound/GUI/ding.mp3 differ