diff --git a/js/dialogue.js b/js/dialogue.js index 54b986c..f8a88d0 100644 --- a/js/dialogue.js +++ b/js/dialogue.js @@ -50,7 +50,7 @@ function DialogUI( stage, gameState ){ this.currentFace = peopleImg["Male"]; this.currentFace.x = 0; - this.textContent = new createjs.Text( "", "24px Arial", "#00000000" ); + this.textContent = new createjs.Text( "", "24px Arial", "black" ); this.textContent.x = 205; this.textContent.y = 705; this.textContent.lineWidth = 565; diff --git a/js/main.js b/js/main.js index b680f16..7b0c94d 100644 --- a/js/main.js +++ b/js/main.js @@ -1,3 +1,5 @@ +// Robert- Here be dragons + function GameState(){ var that = this; @@ -144,6 +146,7 @@ function GameState(){ queue.loadFile( {id: "res/screens/KitchenScreen/OvenTurnRedState.png", src:"res/screens/KitchenScreen/OvenTurnRedState.png"}); queue.loadFile( {id: "res/screens/KitchenScreen/LightButtonDepressed.png", src:"res/screens/KitchenScreen/LightButtonDepressed.png"}); queue.loadFile( {id: "res/screens/KitchenScreen/Cookbook-Open.png", src:"res/screens/KitchenScreen/Cookbook-Open.png"}); + queue.loadFile( {id: "res/screens/KitchenScreen/Explosion_AnimationLowRes.png", src:"res/screens/KitchenScreen/Explosion_AnimationLowRes.png"}); // Kitchen Sounds @@ -348,7 +351,7 @@ function GameUI( canvasElem, gameState ){ var soundManager = new SoundManager( gameState ); this.activeScreenObj = new LoadingScreen( this.stage, gameState ); - var textContent = new createjs.Text( "", "20px Arial", "#00000000" ); + var textContent = new createjs.Text( "", "20px Arial", "black" ); textContent.x = 750; textContent.y = 30; this.stage.addChild( textContent); diff --git a/js/screens.js b/js/screens.js index f349a53..7b6e734 100644 --- a/js/screens.js +++ b/js/screens.js @@ -18,7 +18,7 @@ function LoadingScreen( stage, gameState ){ stage.addChild( this.done ); stage.addChild( this.turkeyState[0] ); - var textContent = new createjs.Text( "0 %", "25px Arial", "#ffffffff" ); + var textContent = new createjs.Text( "0 %", "25px Arial", "black" ); textContent.x = 500; textContent.y = 20; stage.addChild( textContent); @@ -158,7 +158,7 @@ function DifficultyScreen( stage, gameState ){ this.femaleSelection.alpha = 0; stage.addChild( this.femaleSelection ); - var nameInput = new createjs.Text( "", "48px Arial", "#00000000" ); + var nameInput = new createjs.Text( "", "48px Arial", "black" ); nameInput.x = 47; nameInput.y = 85; nameInput.lineWidth = 175; @@ -274,7 +274,8 @@ function KitchenScreen( stage, gameState ){ if( !gameState.turkeyBought ){ gameState.pubsub.publish( "ShowDialog", {seq:"KitchenInitial", autoAdvance:false} ); } - + + return { blit : function(){ @@ -290,11 +291,11 @@ function MarketScreen( stage, gameState ){ var that = this; this.background = new createjs.Bitmap( "res/screens/MarketScreen/MarketScreen.png" ); - var price = new createjs.Text( "", "16px Arial", "#00000000" ); + var price = new createjs.Text( "", "16px Arial", "black" ); price.x = 120; price.y = 560; - var wallet = new createjs.Text( "$" + parseFloat(gameState.wallet).toFixed(2), "20px Arial", "#00000000" ); + var wallet = new createjs.Text( "$" + parseFloat(gameState.wallet).toFixed(2), "20px Arial", "black" ); wallet.x = 725; wallet.y = 550; @@ -306,17 +307,17 @@ function MarketScreen( stage, gameState ){ clipboardImg.x = 5; clipboardImg.y = 315; - var clipboardTitle = new createjs.Text( "Shopping List", "18px Arial", "#00000000" ); + var clipboardTitle = new createjs.Text( "Shopping List", "18px Arial", "black" ); clipboardTitle.x = 25; clipboardTitle.y = 385; clipboardTitle.lineWidth = 175; - var clipboardText = new createjs.Text( "Turkey", "16px Arial", "#00000000" ); + var clipboardText = new createjs.Text( "Turkey", "16px Arial", "black" ); clipboardText.x = 23; clipboardText.y = 425; clipboardText.lineWidth = 173; - var clipboardWeight = new createjs.Text( "", "16px Arial", "#00000000" ); + var clipboardWeight = new createjs.Text( "", "16px Arial", "black" ); clipboardWeight.x = 120; clipboardWeight.y = 540; clipboardWeight.lineWidth = 175; @@ -506,7 +507,7 @@ function ScoreScreen( stage, gameState ){ 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" ); + var totalCookTimeText = new createjs.Text( timeText, "20px Arial", "black" ); totalCookTimeText.x = 270; totalCookTimeText.y = 107; @@ -516,15 +517,15 @@ function ScoreScreen( stage, gameState ){ seconds = realTimeElapsed % 60; timeText = ("00"+hours).slice(-2) + ":" + ("00"+minutes).slice(-2) + ":" + ("00"+seconds).slice(-2); - var realtimeElapsedText = new createjs.Text( timeText, "20px Arial", "#00000000" ); + var realtimeElapsedText = new createjs.Text( timeText, "20px Arial", "black" ); realtimeElapsedText.x = 270; realtimeElapsedText.y = 127; - var ovenOpenedText = new createjs.Text( gameState.ovenOpened, "20px Arial", "#00000000" ); + var ovenOpenedText = new createjs.Text( gameState.ovenOpened, "20px Arial", "black" ); ovenOpenedText.x = 270; ovenOpenedText.y = 147; - var dialogueHeardText = new createjs.Text( gameState.dialogueHeard, "20px Arial", "#00000000" ); + var dialogueHeardText = new createjs.Text( gameState.dialogueHeard, "20px Arial", "black" ); dialogueHeardText.x = 270; dialogueHeardText.y = 167; @@ -535,19 +536,19 @@ function ScoreScreen( stage, gameState ){ // Cookedness Score - var outerConditionDesc = new createjs.Text( turkeyState.skin.cond[2], "20px Arial", "#00000000" ); + var outerConditionDesc = new createjs.Text( turkeyState.skin.cond[2], "20px Arial", "black" ); outerConditionDesc.x = 150; outerConditionDesc.y = 320; - var coreConditionDesc = new createjs.Text( turkeyState.core.cond[2], "20px Arial", "#00000000" ); + var coreConditionDesc = new createjs.Text( turkeyState.core.cond[2], "20px Arial", "black" ); coreConditionDesc.x = 150; coreConditionDesc.y = 340; - var outerConditionText = new createjs.Text( skinScoreChart[ turkeyState.skin.cond[2] ], "20px Arial", "#00000000" ); + var outerConditionText = new createjs.Text( skinScoreChart[ turkeyState.skin.cond[2] ], "20px Arial", "black" ); outerConditionText.x = 310; outerConditionText.y = 320; - var coreConditionText = new createjs.Text( coreScoreChart[ turkeyState.skin.cond[2] ], "20px Arial", "#00000000" ); + var coreConditionText = new createjs.Text( coreScoreChart[ turkeyState.skin.cond[2] ], "20px Arial", "black" ); coreConditionText.x = 310; coreConditionText.y = 340; @@ -560,21 +561,21 @@ function ScoreScreen( stage, gameState ){ // Temperature Score - var outerTemperatureText = new createjs.Text( outerTempScore.toFixed(0), "20px Arial", "#00000000" ); + var outerTemperatureText = new createjs.Text( outerTempScore.toFixed(0), "20px Arial", "black" ); outerTemperatureText.x = 680; outerTemperatureText.y = 320; - var coreTemperatureText = new createjs.Text( coreTempScore.toFixed(0), "20px Arial", "#00000000" ); + var coreTemperatureText = new createjs.Text( coreTempScore.toFixed(0), "20px Arial", "black" ); coreTemperatureText.x = 680; coreTemperatureText.y = 340; - var outerTemperatureDesc = new createjs.Text( outerTemp + " F", "20px Arial", "#00000000" ); + var outerTemperatureDesc = new createjs.Text( outerTemp + " F", "20px Arial", "black" ); outerTemperatureDesc.x = 530; outerTemperatureDesc.y = 320; - var coreTemperatureDesc = new createjs.Text( coreTemp + " F", "20px Arial", "#00000000" ); + var coreTemperatureDesc = new createjs.Text( coreTemp + " F", "20px Arial", "black" ); coreTemperatureDesc.x = 530; coreTemperatureDesc.y = 340; @@ -588,32 +589,32 @@ function ScoreScreen( stage, gameState ){ // Modifiers var turkeyMod = typeToMod[gameState.turkeyType]; - var turkeyTypeModifierText = new createjs.Text( "+"+((1-turkeyMod)*100).toFixed(0) + "%", "20px Arial", "#00000000" ); + var turkeyTypeModifierText = new createjs.Text( "+"+(Math.abs(turkeyMod-1)*100).toFixed(0) + "%", "20px Arial", "black" ); turkeyTypeModifierText.x = 310; turkeyTypeModifierText.y = 437; totalScore *= turkeyMod; - var stuffingTypeModifierText = new createjs.Text( "+"+((gameState.stuffingTypeModifier-1)*100).toFixed(0)+"%" , "20px Arial", "#00000000" ); + var stuffingTypeModifierText = new createjs.Text( "+"+(Math.abs(gameState.stuffingTypeModifier-1)*100).toFixed(0)+"%" , "20px Arial", "black" ); stuffingTypeModifierText.x = 310 stuffingTypeModifierText.y = 457; totalScore *= gameState.stuffingTypeModifier; - var frillsModifierText = new createjs.Text( "x"+gameState.frillsModifier, "20px Arial", "#00000000" ); + var frillsModifierText = new createjs.Text( "x"+gameState.frillsModifier, "20px Arial", "black" ); frillsModifierText.x = 310 frillsModifierText.y = 477; totalScore *= gameState.frillsModifier; - var hardcoreModifierText = new createjs.Text( "x"+gameState.hardcoreModifier, "20px Arial", "#00000000" ); + var hardcoreModifierText = new createjs.Text( "x"+gameState.hardcoreModifier, "20px Arial", "black" ); hardcoreModifierText.x = 310 hardcoreModifierText.y = 497; totalScore *= gameState.hardcoreModifier; - var totalText = new createjs.Text( totalScore.toFixed(0), "32px Arial", "#00000000" ); + var totalText = new createjs.Text( totalScore.toFixed(0), "32px Arial", "black" ); totalText.x = 250; totalText.y = 550; stage.addChild( totalText ); diff --git a/js/ui.js b/js/ui.js index 83fa2e5..01ecbe3 100644 --- a/js/ui.js +++ b/js/ui.js @@ -148,13 +148,52 @@ function FinalConfirmationUI(stage, gameState){ gameState.pubsub.subscribe( "ShowFinalConfirm", this.showFinalConfirm ); } +function DeathUI(stage, gameState){ + var that = this; + this.showingConfirm = false; + + var finalImg = new createjs.Bitmap("res/screens/KitchenScreen/HouseFireRetry.png"); + var deathCount = new createjs.Text( UtilityFunctions.randRange(1,6), "24px Arial", "black" ); + deathCount.x = 695; + deathCount.y = 260; + + var retryButton = new Button( stage, gameState, 578, 520, 200, 50, null, null, function(){ + document.location.reload(); + } ); + + var explosion = { boom:{ frames:[35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0], next:false } }; + var data = { + images: ["res/screens/KitchenScreen/Explosion_AnimationLowRes.png"], + frames: { width:400, height:300 }, + animations: explosion + }; + + var spriteSheet = new createjs.SpriteSheet(data); + var animation = new createjs.Sprite(spriteSheet, "treeAnimations"); + animation.x = 0; + animation.y = 0; + animation.scaleX = animation.scaleY = 2; + + // Show core temperature + this.showDeath = function(){ + stage.addChild( finalImg ); + animation.gotoAndPlay("boom"); + stage.addChild( deathCount ); + stage.addChild( animation ); + stage.addChild( retryButton ); + }; + + // change temperature, this one's for the UI + gameState.pubsub.subscribe( "Death", this.showDeath ); +} + function AlarmUI(stage, gameState){ var that = this; this.showingConfirm = false; var oldTime = Date.now(); var showColon = true; - var timerText = new createjs.Text("00:00", "24px Arial", "#ffffffff" ); + var timerText = new createjs.Text("00:00", "24px Arial", "black" ); timerText.x = 372; timerText.y = 290; @@ -228,11 +267,11 @@ function CookbookUI( stage, gameState ){ var cookbookImg = new createjs.Bitmap("res/screens/KitchenScreen/Cookbook-Open.png"); var closeButton = new Button( stage, gameState, 710, 10, 100, 50, null, null, function(){that.hideCookbook();} ); - var turkeyTypeText = new createjs.Text("", "18px Arial", "#ffffffff" ); + var turkeyTypeText = new createjs.Text("", "18px Arial", "black" ); turkeyTypeText.x = 535; turkeyTypeText.y = 56; - var turkeyWeightText = new createjs.Text("", "18px Arial", "#ffffffff" ); + var turkeyWeightText = new createjs.Text("", "18px Arial", "black" ); turkeyWeightText.x = 553; turkeyWeightText.y = 85; @@ -262,7 +301,7 @@ function CookbookUI( stage, gameState ){ var record = gameState.peekRecords[i]; var time = new Date( gameState.peekRecords[i].getTime() ); - var logLine = new createjs.Text( "OFF", "12px Arial", "#ffffffff" ); + var logLine = new createjs.Text( "OFF", "12px Arial", "black" ); logLine.x = 423; logLine.y = 50 * i+ 165; @@ -295,6 +334,8 @@ function OvenUI( stage, gameState ){ ovenLight.graphics.beginFill( "black" ).drawCircle( 181, 126, 2 ); var confirmation = new FinalConfirmationUI(stage, gameState ); + var death = new DeathUI(stage,gameState); + // Oven light control this.changeOvenLight = function( state ){ if( state == "On" ){ @@ -359,8 +400,8 @@ function OvenUI( stage, gameState ){ } // if over 1100 F, burn house down - if( temp > 1100 ){ - console.log("You have died in a fire"); + if( temp > 500 ){ + gameState.pubsub.publish("Death",""); return; } @@ -639,7 +680,7 @@ function WindowUI( stage, gameState ){ var animation = new createjs.Sprite(spriteSheet, "treeAnimations"); animation.x = 415; animation.y = 30; - + // Fast forward, move sky gameState.pubsub.subscribe( "SkipTime", function(){ var newpos = -(new Date( gameState.currentTime ).getHours()*682.625); diff --git a/res/screens/.DS_Store b/res/screens/.DS_Store index 55da0b3..3b1068d 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 cd49bd0..1ef0cfb 100644 Binary files a/res/screens/KitchenScreen/.DS_Store and b/res/screens/KitchenScreen/.DS_Store differ diff --git a/res/screens/KitchenScreen/Explosion_AnimationLowRes.png b/res/screens/KitchenScreen/Explosion_AnimationLowRes.png new file mode 100644 index 0000000..64903ab Binary files /dev/null and b/res/screens/KitchenScreen/Explosion_AnimationLowRes.png differ diff --git a/res/screens/KitchenScreen/HouseFireRetry.png b/res/screens/KitchenScreen/HouseFireRetry.png new file mode 100644 index 0000000..e99126d Binary files /dev/null and b/res/screens/KitchenScreen/HouseFireRetry.png differ