diff --git a/js/model.js b/js/model.js index 7784ae6..18b24d9 100644 --- a/js/model.js +++ b/js/model.js @@ -282,22 +282,22 @@ UtilityFunctions = { cookCondition: function(cookValue,volume){ var multiplier = 1; if (cookValue>=multiplier*600000) { - return("House Fire") + return ["House Fire", (cookValue-600000)/(multiplier*600000)]; } else if(cookValue>=multiplier*250000) { - return("Charcoal") + return ["Charcoal", (cookValue-250000)/(multiplier*600000)]; } else if (cookValue>=multiplier*150000) { - return("Dry") + return ["Dry", (cookValue-150000)/(multiplier*250000)]; } else if (cookValue>=multiplier*12000) { - return("Cooked") + return ["Cooked", (cookValue-12000)/(multiplier*150000)]; } else if (cookValue>=multiplier*5000) { - return("Undercooked") + return ["Undercooked", (cookValue-5000)/(multiplier*12000)]; } else { - return("Raw") + return ["Raw", 1]; } } } diff --git a/js/ui.js b/js/ui.js index 8f9d5ab..0e489d1 100644 --- a/js/ui.js +++ b/js/ui.js @@ -300,15 +300,32 @@ function OvenUI( stage, gameState ){ } }); - return { tick: function(){ + // IMPORTANT: SECOND TIMER var diff = Date.now() - gameState.oldTime; if( diff > 1000 ){ gameState.oldTime = Date.now(); that.secondTick( diff ); console.log(new Date( gameState.currentTime) ); - } + + if( gameState.turkeyBought ){ + + // what's the state of the turkey + turkeyState = ovenModel.getTurkeyState(); + turkeyStates[0].alpha = 1; + if( turkeyState["skin"]["cond"][0] == "Undercooked" ) + turkeyStates[1].alpha = turkeyState["skin"]["cond"][1]; + if( turkeyState["skin"]["cond"][0] == "Cooked" ) + turkeyStates[2].alpha = turkeyState["skin"]["cond"][1]; + if( turkeyState["skin"]["cond"][0] == "Dry" ) + turkeyStates[3].alpha = turkeyState["skin"]["cond"][1]; + if( turkeyState["skin"]["cond"][0] == "Charcoal" ) + turkeyStates[4].alpha = turkeyState["skin"]["cond"][1]; + if( turkeyState["skin"]["cond"][0] == "House Fire" ) + turkeyStates[4].alpha = 1; + } + } }, render: function(){ @@ -320,7 +337,21 @@ function OvenUI( stage, gameState ){ // 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; + if( turkeyState["skin"]["cond"] == "Undercooked" ) + turkeyStates[1].alpha = turkeyState["skin"]["cond"][1]; + if( turkeyState["skin"]["cond"] == "Cooked" ) + turkeyStates[2].alpha = turkeyState["skin"]["cond"][1]; + if( turkeyState["skin"]["cond"] == "Dry" ) + turkeyStates[3].alpha = turkeyState["skin"]["cond"][1]; + if( turkeyState["skin"]["cond"] == "Charcoal" ) + turkeyStates[4].alpha = turkeyState["skin"]["cond"][1]; + if( turkeyState["skin"]["cond"] == "House Fire" ) + turkeyStates[4].alpha = 1; + panFront.alpha = 1; for(i in turkeyStates){ stage.addChild(turkeyStates[i]); @@ -398,8 +429,6 @@ return { } else streetLight.alpha = 0; - - } } } diff --git a/res/screens/.DS_Store b/res/screens/.DS_Store index 905b0f0..15f07e2 100644 Binary files a/res/screens/.DS_Store and b/res/screens/.DS_Store differ