Browse Source

Death condition, reverted alpha

Load_Fix
Robert Chen 11 years ago
parent
commit
65281a89d9
  1. 2
      js/dialogue.js
  2. 5
      js/main.js
  3. 51
      js/screens.js
  4. 55
      js/ui.js
  5. BIN
      res/screens/.DS_Store
  6. BIN
      res/screens/KitchenScreen/.DS_Store
  7. BIN
      res/screens/KitchenScreen/Explosion_AnimationLowRes.png
  8. BIN
      res/screens/KitchenScreen/HouseFireRetry.png

2
js/dialogue.js

@ -50,7 +50,7 @@ function DialogUI( stage, gameState ){
this.currentFace = peopleImg["Male"]; this.currentFace = peopleImg["Male"];
this.currentFace.x = 0; 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.x = 205;
this.textContent.y = 705; this.textContent.y = 705;
this.textContent.lineWidth = 565; this.textContent.lineWidth = 565;

5
js/main.js

@ -1,3 +1,5 @@
// Robert- Here be dragons
function GameState(){ function GameState(){
var that = this; 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/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/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/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 // Kitchen Sounds
@ -348,7 +351,7 @@ function GameUI( canvasElem, gameState ){
var soundManager = new SoundManager( gameState ); var soundManager = new SoundManager( gameState );
this.activeScreenObj = new LoadingScreen( this.stage, 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.x = 750;
textContent.y = 30; textContent.y = 30;
this.stage.addChild( textContent); this.stage.addChild( textContent);

51
js/screens.js

@ -18,7 +18,7 @@ function LoadingScreen( stage, gameState ){
stage.addChild( this.done ); stage.addChild( this.done );
stage.addChild( this.turkeyState[0] ); 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.x = 500;
textContent.y = 20; textContent.y = 20;
stage.addChild( textContent); stage.addChild( textContent);
@ -158,7 +158,7 @@ function DifficultyScreen( stage, gameState ){
this.femaleSelection.alpha = 0; this.femaleSelection.alpha = 0;
stage.addChild( this.femaleSelection ); stage.addChild( this.femaleSelection );
var nameInput = new createjs.Text( "", "48px Arial", "#00000000" ); var nameInput = new createjs.Text( "", "48px Arial", "black" );
nameInput.x = 47; nameInput.x = 47;
nameInput.y = 85; nameInput.y = 85;
nameInput.lineWidth = 175; nameInput.lineWidth = 175;
@ -274,7 +274,8 @@ function KitchenScreen( stage, gameState ){
if( !gameState.turkeyBought ){ if( !gameState.turkeyBought ){
gameState.pubsub.publish( "ShowDialog", {seq:"KitchenInitial", autoAdvance:false} ); gameState.pubsub.publish( "ShowDialog", {seq:"KitchenInitial", autoAdvance:false} );
} }
return { return {
blit : function(){ blit : function(){
@ -290,11 +291,11 @@ function MarketScreen( stage, gameState ){
var that = this; var that = this;
this.background = new createjs.Bitmap( "res/screens/MarketScreen/MarketScreen.png" ); 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.x = 120;
price.y = 560; 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.x = 725;
wallet.y = 550; wallet.y = 550;
@ -306,17 +307,17 @@ function MarketScreen( stage, gameState ){
clipboardImg.x = 5; clipboardImg.x = 5;
clipboardImg.y = 315; 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.x = 25;
clipboardTitle.y = 385; clipboardTitle.y = 385;
clipboardTitle.lineWidth = 175; 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.x = 23;
clipboardText.y = 425; clipboardText.y = 425;
clipboardText.lineWidth = 173; clipboardText.lineWidth = 173;
var clipboardWeight = new createjs.Text( "", "16px Arial", "#00000000" ); var clipboardWeight = new createjs.Text( "", "16px Arial", "black" );
clipboardWeight.x = 120; clipboardWeight.x = 120;
clipboardWeight.y = 540; clipboardWeight.y = 540;
clipboardWeight.lineWidth = 175; clipboardWeight.lineWidth = 175;
@ -506,7 +507,7 @@ function ScoreScreen( stage, gameState ){
var seconds = totalCookTime % 60; var seconds = totalCookTime % 60;
var timeText = ("00"+hours).slice(-2) + ":" + ("00"+minutes).slice(-2) + ":" + ("00"+seconds).slice(-2); 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.x = 270;
totalCookTimeText.y = 107; totalCookTimeText.y = 107;
@ -516,15 +517,15 @@ function ScoreScreen( stage, gameState ){
seconds = realTimeElapsed % 60; seconds = realTimeElapsed % 60;
timeText = ("00"+hours).slice(-2) + ":" + ("00"+minutes).slice(-2) + ":" + ("00"+seconds).slice(-2); 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.x = 270;
realtimeElapsedText.y = 127; 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.x = 270;
ovenOpenedText.y = 147; 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.x = 270;
dialogueHeardText.y = 167; dialogueHeardText.y = 167;
@ -535,19 +536,19 @@ function ScoreScreen( stage, gameState ){
// Cookedness Score // 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.x = 150;
outerConditionDesc.y = 320; 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.x = 150;
coreConditionDesc.y = 340; 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.x = 310;
outerConditionText.y = 320; 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.x = 310;
coreConditionText.y = 340; coreConditionText.y = 340;
@ -560,21 +561,21 @@ function ScoreScreen( stage, gameState ){
// Temperature Score // 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.x = 680;
outerTemperatureText.y = 320; 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.x = 680;
coreTemperatureText.y = 340; 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.x = 530;
outerTemperatureDesc.y = 320; 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.x = 530;
coreTemperatureDesc.y = 340; coreTemperatureDesc.y = 340;
@ -588,32 +589,32 @@ function ScoreScreen( stage, gameState ){
// Modifiers // Modifiers
var turkeyMod = typeToMod[gameState.turkeyType]; 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.x = 310;
turkeyTypeModifierText.y = 437; turkeyTypeModifierText.y = 437;
totalScore *= turkeyMod; 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.x = 310
stuffingTypeModifierText.y = 457; stuffingTypeModifierText.y = 457;
totalScore *= gameState.stuffingTypeModifier; 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.x = 310
frillsModifierText.y = 477; frillsModifierText.y = 477;
totalScore *= gameState.frillsModifier; 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.x = 310
hardcoreModifierText.y = 497; hardcoreModifierText.y = 497;
totalScore *= gameState.hardcoreModifier; 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.x = 250;
totalText.y = 550; totalText.y = 550;
stage.addChild( totalText ); stage.addChild( totalText );

55
js/ui.js

@ -148,13 +148,52 @@ function FinalConfirmationUI(stage, gameState){
gameState.pubsub.subscribe( "ShowFinalConfirm", this.showFinalConfirm ); 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){ function AlarmUI(stage, gameState){
var that = this; var that = this;
this.showingConfirm = false; this.showingConfirm = false;
var oldTime = Date.now(); var oldTime = Date.now();
var showColon = true; 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.x = 372;
timerText.y = 290; timerText.y = 290;
@ -228,11 +267,11 @@ function CookbookUI( stage, gameState ){
var cookbookImg = new createjs.Bitmap("res/screens/KitchenScreen/Cookbook-Open.png"); 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 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.x = 535;
turkeyTypeText.y = 56; turkeyTypeText.y = 56;
var turkeyWeightText = new createjs.Text("", "18px Arial", "#ffffffff" ); var turkeyWeightText = new createjs.Text("", "18px Arial", "black" );
turkeyWeightText.x = 553; turkeyWeightText.x = 553;
turkeyWeightText.y = 85; turkeyWeightText.y = 85;
@ -262,7 +301,7 @@ function CookbookUI( stage, gameState ){
var record = gameState.peekRecords[i]; var record = gameState.peekRecords[i];
var time = new Date( gameState.peekRecords[i].getTime() ); 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.x = 423;
logLine.y = 50 * i+ 165; logLine.y = 50 * i+ 165;
@ -295,6 +334,8 @@ function OvenUI( stage, gameState ){
ovenLight.graphics.beginFill( "black" ).drawCircle( 181, 126, 2 ); ovenLight.graphics.beginFill( "black" ).drawCircle( 181, 126, 2 );
var confirmation = new FinalConfirmationUI(stage, gameState ); var confirmation = new FinalConfirmationUI(stage, gameState );
var death = new DeathUI(stage,gameState);
// Oven light control // Oven light control
this.changeOvenLight = function( state ){ this.changeOvenLight = function( state ){
if( state == "On" ){ if( state == "On" ){
@ -359,8 +400,8 @@ function OvenUI( stage, gameState ){
} }
// if over 1100 F, burn house down // if over 1100 F, burn house down
if( temp > 1100 ){ if( temp > 500 ){
console.log("You have died in a fire"); gameState.pubsub.publish("Death","");
return; return;
} }
@ -639,7 +680,7 @@ function WindowUI( stage, gameState ){
var animation = new createjs.Sprite(spriteSheet, "treeAnimations"); var animation = new createjs.Sprite(spriteSheet, "treeAnimations");
animation.x = 415; animation.x = 415;
animation.y = 30; animation.y = 30;
// Fast forward, move sky // Fast forward, move sky
gameState.pubsub.subscribe( "SkipTime", function(){ gameState.pubsub.subscribe( "SkipTime", function(){
var newpos = -(new Date( gameState.currentTime ).getHours()*682.625); var newpos = -(new Date( gameState.currentTime ).getHours()*682.625);

BIN
res/screens/.DS_Store vendored

Binary file not shown.

BIN
res/screens/KitchenScreen/.DS_Store vendored

Binary file not shown.

BIN
res/screens/KitchenScreen/Explosion_AnimationLowRes.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 MiB

BIN
res/screens/KitchenScreen/HouseFireRetry.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 KiB

Loading…
Cancel
Save