Browse Source

More bug fixes

Load_Fix
Robert Chen 11 years ago
parent
commit
2571b00cd0
  1. 89
      js/screens.js
  2. 69
      js/stories.js
  3. 7
      js/ui.js

89
js/screens.js

@ -416,8 +416,15 @@ function ScoreScreen( stage, gameState ){ @@ -416,8 +416,15 @@ function ScoreScreen( stage, gameState ){
"overcooked": 1000,
"dry": 400,
"burnt": 0
}
};
var typeToMod = {
"Organic Turkey" : 1.03,
"Free Range Turkey" : 1.02,
"Sunny Farms Turkey" : 0.98,
"Pastured Turkey": 1.05,
"General Turkey": 1.00
};
// Optimal Temperature to be served at
this.scoreDistribution= function(inputTemp) {
desiredAverage = 162;
@ -425,6 +432,48 @@ function ScoreScreen( stage, gameState ){ @@ -425,6 +432,48 @@ function ScoreScreen( stage, gameState ){
return(Math.exp(-(Math.pow((inputTemp-desiredAverage),2)/(2*variance))))
};
// Temperature Score
var outerTemp = UtilityFunctions.C2F(turkeyState.skin.temp).toFixed(2);
var coreTemp = UtilityFunctions.C2F(turkeyState.core.temp).toFixed(2);
var outerTempScore = that.scoreDistribution( outerTemp ) * 200;
var coreTempScore = that.scoreDistribution( coreTemp ) * 200;
totalScore += parseInt(skinScoreChart[ turkeyState.skin.cond[2]]);
totalScore += parseInt(skinScoreChart[ turkeyState.core.cond[2]]);
totalScore += parseInt(outerTempScore.toFixed(0));
totalScore += parseInt(coreTempScore.toFixed(0));
resultsDialogue = [];
if (totalScore>=2000) {
randomDiag = perfect;
}
else if (totalScore>=1200) {
randomDiag = great;
}
else if (totalScore>=625) {
randomDiag = average;
}
else if (totalScore>=300) {
randomDiag = subPar;
}
else {
randomDiag = terrible;
}
for (var i = 0; i<=2; i++) {
resultsDialogue.push(randomString(randomDiag));
}
messages["end"] = resultsDialogue;
function randomString(stringArray) {
var index = Math.floor(Math.random()*stringArray.length);
var stringResult = stringArray[index];
stringArray.splice(index,1);
return (stringResult)
}
gameState.pubsub.publish( "FadeOut", "" );
this.background = new createjs.Bitmap( "res/screens/ScoreScreen/Score-Evaluation-1.png" );
@ -444,7 +493,7 @@ function ScoreScreen( stage, gameState ){ @@ -444,7 +493,7 @@ function ScoreScreen( stage, gameState ){
gameState.pubsub.publish( "BackgroundLoop", {name:"TitleMusic", pos:5650, volume:0.7} );
gameState.pubsub.publish( "ShowDialog", {seq:"NoMoney", autoAdvance:true, endFunc:function(){
gameState.pubsub.publish( "ShowDialog", {seq:"end", autoAdvance:true, endFunc:function(){
background1.alpha=1;
stage.addChild( new Button( stage, gameState, 590, 540, 190, 50, null, null, function(){ document.location.reload(); } ) );
@ -459,7 +508,7 @@ function ScoreScreen( stage, gameState ){ @@ -459,7 +508,7 @@ function ScoreScreen( stage, gameState ){
totalCookTimeText.x = 270;
totalCookTimeText.y = 107;
realTimeElapsed /= 1000;
realTimeElapsed = realTimeElapsed / 1000;
hours = parseInt( realTimeElapsed / 3600 ) % 24;
minutes = parseInt( realTimeElapsed / 60 ) % 60;
seconds = realTimeElapsed % 60;
@ -477,7 +526,6 @@ function ScoreScreen( stage, gameState ){ @@ -477,7 +526,6 @@ function ScoreScreen( stage, gameState ){
dialogueHeardText.x = 270;
dialogueHeardText.y = 167;
stage.addChild( totalCookTimeText );
stage.addChild( realtimeElapsedText );
stage.addChild( ovenOpenedText );
@ -489,14 +537,10 @@ function ScoreScreen( stage, gameState ){ @@ -489,14 +537,10 @@ function ScoreScreen( stage, gameState ){
outerConditionDesc.x = 150;
outerConditionDesc.y = 320;
totalScore += parseInt(skinScoreChart[ turkeyState.skin.cond[2]]);
var coreConditionDesc = new createjs.Text( turkeyState.core.cond[2], "20px Arial", "#00000000" );
coreConditionDesc.x = 150;
coreConditionDesc.y = 340;
totalScore += parseInt(skinScoreChart[ turkeyState.core.cond[2]]);
var outerConditionText = new createjs.Text( skinScoreChart[ turkeyState.skin.cond[2] ], "20px Arial", "#00000000" );
outerConditionText.x = 310;
outerConditionText.y = 320;
@ -513,11 +557,6 @@ function ScoreScreen( stage, gameState ){ @@ -513,11 +557,6 @@ function ScoreScreen( stage, gameState ){
stage.addChild( outerConditionDesc );
// Temperature Score
var outerTemp = UtilityFunctions.C2F(turkeyState.skin.temp).toFixed(2);
var coreTemp = UtilityFunctions.C2F(turkeyState.core.temp).toFixed(2);
var outerTempScore = that.scoreDistribution( outerTemp ) * 200;
var coreTempScore = that.scoreDistribution( coreTemp ) * 200;
var outerTemperatureText = new createjs.Text( outerTempScore.toFixed(0), "20px Arial", "#00000000" );
outerTemperatureText.x = 680;
@ -531,13 +570,13 @@ function ScoreScreen( stage, gameState ){ @@ -531,13 +570,13 @@ function ScoreScreen( stage, gameState ){
outerTemperatureDesc.x = 530;
outerTemperatureDesc.y = 320;
totalScore += parseInt(outerTempScore.toFixed(0));
var coreTemperatureDesc = new createjs.Text( coreTemp + " F", "20px Arial", "#00000000" );
coreTemperatureDesc.x = 530;
coreTemperatureDesc.y = 340;
totalScore += parseInt(coreTempScore.toFixed(0));
stage.addChild( outerTemperatureText );
stage.addChild( coreTemperatureText );
@ -545,26 +584,26 @@ function ScoreScreen( stage, gameState ){ @@ -545,26 +584,26 @@ function ScoreScreen( stage, gameState ){
stage.addChild( coreTemperatureDesc );
stage.addChild( outerTemperatureDesc );
console.log(totalScore);
// Modifiers
var turkeyTypeModifierText = new createjs.Text( "x"+"1", "20px Arial", "#00000000" );
var turkeyMod = typeToMod[gameState.turkeyType];
var turkeyTypeModifierText = new createjs.Text( "+"+((1-turkeyMod)*100).toFixed(0) + "%", "20px Arial", "#00000000" );
turkeyTypeModifierText.x = 310;
turkeyTypeModifierText.y = 437;
totalScore *= 1;
totalScore *= turkeyMod;
var stuffingTypeModifierText = new createjs.Text( "x"+"1", "20px Arial", "#00000000" );
var stuffingTypeModifierText = new createjs.Text( "+"+((gameState.stuffingTypeModifier-1)*100).toFixed(0)+"%" , "20px Arial", "#00000000" );
stuffingTypeModifierText.x = 310
stuffingTypeModifierText.y = 457;
totalScore *= 1;
totalScore *= gameState.stuffingTypeModifier;
var frillsModifierText = new createjs.Text( "x"+"1", "20px Arial", "#00000000" );
var frillsModifierText = new createjs.Text( "x"+gameState.frillsModifier, "20px Arial", "#00000000" );
frillsModifierText.x = 310
frillsModifierText.y = 477;
totalScore *= 1;
totalScore *= gameState.frillsModifier;
var hardcoreModifierText = new createjs.Text( "x"+gameState.hardcoreModifier, "20px Arial", "#00000000" );
hardcoreModifierText.x = 310
@ -572,8 +611,8 @@ function ScoreScreen( stage, gameState ){ @@ -572,8 +611,8 @@ function ScoreScreen( stage, gameState ){
totalScore *= gameState.hardcoreModifier;
var totalText = new createjs.Text( totalScore, "32px Arial", "#00000000" );
totalText.x = 250
var totalText = new createjs.Text( totalScore.toFixed(0), "32px Arial", "#00000000" );
totalText.x = 250;
totalText.y = 550;
stage.addChild( totalText );

69
js/stories.js

@ -8,6 +8,71 @@ var messages = { @@ -8,6 +8,71 @@ var messages = {
"OpenDoor" :["Me: I should probably try opening the oven door to measure the turkey's temperature"]
}
//Terrible Results
var terrible = [
"Grandpa: Outrageous. I didn't fight for freedom for this kind of meal.",
"Grandpa: I could have cooked a better fowl with a flamethrower in Korea.",
"Grandma: My sister can make feast out of a potato. What is this?",
"Dad: Don't expect my blessing.",
"Mom: No thanks, I'm actually a vegetarian.",
"Brother: Who taught you how to cook?",
"Brother: What an awful turkey.",
"Girlfriend: I'm leaving you honey. It's not you, its the turkey.",
"Cat: Meow Meow ('Get out of my house!')"];
//Subpar Results
var subPar = [
"Grandpa: My fake teeth can't chew through this tough turkey.",
"Grandpa: Treat the turkey with respect next time.",
"Grandma: Dear grandchild, next year let Grandmother do cooking.",
"Dad: I had high expectations from you.",
"Dad: You've brought shame to your family.",
"Dad: Not bad, but it could have been better.",
"Mom: Remember, it is the thought that matters.",
"Mom: You are welcome here no matter how well you cook.",
"Mom: Honey, I think this turkey could have turned out better.",
"Brother: Uhh, What's for dessert?",
"Brother: We should get a pre-baked turkey next time",
"Girlfriend: Hey, the cat seems to like it.",
"Girlfriend: We'll have to go to some cooking classes together.",
"Cat: Hisssssss"];
//Average Results
var average = [
"Grandpa: Hmm. Passable.",
"Grandma: This turkey tastes good, you have done well.",
"Dad: Pretty decent turkey have you cooked here.",
"Mom: Tastes better than store cooked turkeys.",
"Brother: This is way better than I expected.",
"Girlfriend: Not bad.",
"Cat: Meow meow ('I may not leave a present in your shoes today')"];
//Great Results
var great = [
"Grandpa: Fine job, sonny! Just like the golden days.",
"Grandpa: Tender and juicy, just the way I like it.",
"Grandma: Such a talented little cook. Welcome to family.",
"Grandma: Most enjoyable dinner. Now, who wants baked apples?",
"Dad: Good and meaty, mmm-mmm!",
"Mom: The second best turkey I have ever had!",
"Mom: You should teach me your secrets",
"Brother: Way to go, this turkey is fantastic.",
"Girlfriend: Oh, what a nice turkey.",
"Cat: Meow MEOW! ('I am pleased, human')"];
//Perfect Results
var perfect = [
"Grandpa: Damn good gobsmackingly delicious piece of freedom!",
"Grandma: Excellent! You will cook festival dinner next year, yes?",
"Dad: Finger-licking perfection!",
"Mom: This turkey is delicious. Let's get you two wed immediately!",
"Mom: Never have I had a more scrumptious turkey!",
"Brother: All-praise the turkeymeister!",
"Girlfriend: Bite after bite of gourmet delight!",
"Girlfriend: We should get married. Tonight!",
"Cat: Puuuurrrrrrr"];
var story = {
"Duck Story":
@ -45,7 +110,7 @@ var story = { @@ -45,7 +110,7 @@ var story = {
"Dad: Mooom!"],
"Golf Story":
["Grandpa: Son, whats your par on the John Milton Golf Course?.",
["Grandpa: Son, what's your par on the John Milton Golf Course?.",
"Dad: I'm a little rusty, but my average is about 76.",
"Grandpa: Oh really? Chaahooooo I am down to 69.",
"Dad: Congratulations Dad.",
@ -494,7 +559,7 @@ var story = { @@ -494,7 +559,7 @@ var story = {
"Grandpa: It isn't that bad. Be grateful I didn't tell you the story where we ate them. Not bad. A little crunchy. Not as good as turkey though.",
"Mom: !!!"],
"Story about Girlfriends teacher that makes buzzer noises when you got something wrong":
"Story about Girlfriend's teacher that makes buzzer noises when you got something wrong":
["Girlfriend: Greg, here's something that might tinkle your fancy.",
"Girlfriend: I saw my old professor from a couple years back, Professor Ronfleur. The Humanities teacher. Do you remember him?",
"Brother: The guy who always wore the purple bow tie? Who could forget him? Did he buzz you?",

7
js/ui.js

@ -769,6 +769,11 @@ function MarketItem( gameState, name, x, y, cost, mouseOutImg, mouseOverImg, mou @@ -769,6 +769,11 @@ function MarketItem( gameState, name, x, y, cost, mouseOutImg, mouseOverImg, mou
// if we bought a clock, enable it!
if( that.name.indexOf("Alarm") != -1 ) gameState.alarmBought = true;
if( that.name.indexOf("Frills") != -1 ) gameState.frillsModifier = 5;
if( that.name.indexOf("Exquisite") != -1 ){ gameState.stuffingTypeModifier = gameState.stuffingTypeModifier > 1.08 ? gameState.stuffingTypeModifier : 1.08; }
if( that.name.indexOf("Special") != -1 ){ gameState.stuffingTypeModifier = gameState.stuffingTypeModifier > 1.17 ? gameState.stuffingTypeModifier : 1.17; }
if( that.name.indexOf("Repurposed") != -1 ){ gameState.stuffingTypeModifier = gameState.stuffingTypeModifier > 1.05 ? gameState.stuffingTypeModifier : 1.05; }
gameState.purchasedItems.push( objReturn );
gameState.marketItems[ that.name ].delete();
@ -783,7 +788,7 @@ function MarketItem( gameState, name, x, y, cost, mouseOutImg, mouseOverImg, mou @@ -783,7 +788,7 @@ function MarketItem( gameState, name, x, y, cost, mouseOutImg, mouseOverImg, mou
}
// Buy turkey first
else{
gameState.pubsub.publish( "ShowDialog", {seq:"BuyTurkeyFirst", autoAdvance:true} );
gameState.pubsub.publish( "ShowDialog", {seq:"BuyTurkeyFirst", autoAdvance:false} );
gameState.pubsub.publish( "Play", "Error" );
}
}

Loading…
Cancel
Save