Browse Source

Score screen laid out

Load_Fix
Robert Chen 11 years ago
parent
commit
7bc26ead50
  1. 12
      js/dialogue.js
  2. 35
      js/main.js
  3. 7
      js/model.js
  4. 154
      js/screens.js
  5. 1
      js/soundmanager.js
  6. 126
      js/ui.js
  7. BIN
      res/items/.DS_Store
  8. BIN
      res/screens/.DS_Store
  9. BIN
      res/screens/KitchenScreen/.DS_Store
  10. BIN
      res/screens/ScoreScreen/.DS_Store
  11. BIN
      res/sound/.DS_Store
  12. BIN
      res/sound/Events/.DS_Store
  13. BIN
      res/sound/Events/Fire/.DS_Store
  14. BIN
      res/sound/GUI/.DS_Store
  15. BIN
      res/sound/Kitchen/.DS_Store

12
js/dialogue.js

@ -65,7 +65,10 @@ function DialogUI( stage, gameState ){ @@ -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 ){ @@ -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 ){ @@ -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();
}

35
js/main.js

@ -3,9 +3,10 @@ function GameState(){ @@ -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,12 +19,20 @@ function GameState(){ @@ -18,12 +19,20 @@ 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;
// 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)),
@ -74,8 +83,8 @@ function GameState(){ @@ -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(){ @@ -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(){ @@ -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 ){ @@ -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;

7
js/model.js

@ -93,9 +93,9 @@ function OvenModel( turkeyWeight, gameState ) { @@ -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 ) { @@ -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 = { @@ -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"];

154
js/screens.js

@ -256,6 +256,8 @@ function KitchenScreen( stage, gameState ){ @@ -256,6 +256,8 @@ 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 ) );
if( gameState.alarmBought )
this.uiElems.push( new AlarmUI(stage, gameState) );
@ -389,22 +391,144 @@ function MarketScreen( stage, gameState ){ @@ -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,20 +537,10 @@ function ScoreScreen( stage, gameState ){ @@ -413,20 +537,10 @@ 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 ){
var that = this;

1
js/soundmanager.js

@ -22,6 +22,7 @@ function SoundManager( gameState ){ @@ -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");

126
js/ui.js

@ -152,28 +152,31 @@ function AlarmUI(stage, gameState){ @@ -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){ @@ -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
this.updateTimer();
return{
secondTick: function(){
that.updateTimer();
},
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 ){ @@ -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 ){ @@ -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 ){ @@ -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 ){ @@ -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 ){ @@ -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 ){ @@ -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 ){ @@ -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 ){ @@ -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 ){ @@ -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 ){ @@ -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 ){ @@ -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 @@ -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;

BIN
res/items/.DS_Store vendored

Binary file not shown.

BIN
res/screens/.DS_Store vendored

Binary file not shown.

BIN
res/screens/KitchenScreen/.DS_Store vendored

Binary file not shown.

BIN
res/screens/ScoreScreen/.DS_Store vendored

Binary file not shown.

BIN
res/sound/.DS_Store vendored

Binary file not shown.

BIN
res/sound/Events/.DS_Store vendored

Binary file not shown.

BIN
res/sound/Events/Fire/.DS_Store vendored

Binary file not shown.

BIN
res/sound/GUI/.DS_Store vendored

Binary file not shown.

BIN
res/sound/Kitchen/.DS_Store vendored

Binary file not shown.
Loading…
Cancel
Save