Compare commits

..

No commits in common. 'master' and 'final' have entirely different histories.

  1. 36
      README.md
  2. 2
      index.html
  3. 17
      js/dialogue.js
  4. 29
      js/main.js
  5. 320
      js/model.js
  6. 48
      js/screens.js
  7. 1
      js/soundmanager.js
  8. 212
      js/stories.js
  9. 186
      js/ui.js
  10. BIN
      res/screens/HelpCreditsScreen/Credits.png
  11. BIN
      res/screens/HelpCreditsScreen/HelpP1P2.png
  12. BIN
      res/screens/HelpCreditsScreen/HelpP3P4.png
  13. BIN
      res/screens/HelpCreditsScreen/HelpP5P6.png
  14. BIN
      res/screens/HelpCreditsScreen/HelpP7P8.png
  15. BIN
      res/screens/HelpCreditsScreen/HelpP9P10.png
  16. BIN
      res/screens/KitchenScreen/Cookbook-Open.png
  17. BIN
      res/screens/KitchenScreen/TurkeyState1Small.png
  18. BIN
      res/screens/KitchenScreen/TurkeyState2Small.png
  19. BIN
      res/screens/KitchenScreen/TurkeyState3Small.png
  20. BIN
      res/screens/KitchenScreen/TurkeyState4Small.png
  21. BIN
      res/screens/KitchenScreen/TurkeyState5Small.png
  22. BIN
      res/screens/Window/Housefar.png
  23. BIN
      res/screens/Window/Stars.png
  24. BIN
      res/screens/Window/Test4-217.png
  25. BIN
      res/screens/Window/Test4TransparencyFull.png
  26. 76
      sim/TurkeySimulation.m

36
README.md

@ -2,9 +2,9 @@ @@ -2,9 +2,9 @@
## Overview
It is another Thanksgiving holiday, a time of retrospection and blessings.
You have been invited to craft the centerpiece of the American thanksgiving dinner, the turkey. Woo your girlfriend / boyfriend and be judged by your future in-laws! Apply your culinary expertise to impress your family!
It is another Thanksgiving holiday, a time of retrospect and blessings.
You have been invited over for dinner.
Wanting to make a good impression, you agree to cook the turkey…
## Turkey Cooking Simulator Features:
* Real-time cooking action!
@ -12,24 +12,23 @@ You have been invited to craft the centerpiece of the American thanksgiving dinn @@ -12,24 +12,23 @@ You have been invited to craft the centerpiece of the American thanksgiving dinn
* Hours of gripping stories and drama!
* Accessorize your turkey with stuffing, frills, and other awesomeness!
* Day-night environmental cycle!
* High-fidelity stereo audio!
* High-definition stereo audio!
* Masterfully crafted scenes of an American household!
* Apply your culinary expertise to impress your family!
## Compatibility
* [Firefox](www.firefox.com) - Recommended Browser, Gstreamer required for sound on Mac OS
* [Chrome 22](https://www.google.com/intl/en/chrome/) - Full compatibility, recommended browser.
* [Safari 6.0.5](http://www.apple.com/safari/) - Full compatibility, recommended browser.
* [Firefox 25](http://www.mozilla.org/en-US/firefox/new/) - Playable. [GStreamer] (http://gstreamer.freedesktop.org/) required for sound on Mac. Sound only plays once on Windows
* [Internet Explorer 11](http://windows.microsoft.com/en-us/internet-explorer/download-ie) - Not recommended. Sound looping issues.
## Open Source!
* Uses the CreateJS library for HTML5 Canvas: https://github.com/CreateJS/
* [Safari 6.0.5](http://www.apple.com/safari/) - Some incompatibility with SVG
* [Internet Explorer 11](http://windows.microsoft.com/en-us/internet-explorer/download-ie) - Not recommended . Sound looping issues
## Authors
* [Scott R. Mobley](http://www.linkedin.com/in/mobleyscott) - Turkey Overlord and Master of Dialogue
* [Robert J. Chen](http://fernjager.net) - Javascript Wizard
* [Benjamin Kwok](mailto:tengen1112@gmail.com) - Unpaid Art Peasant
* Sheen Kao - Finite Elementalist Supreme
* [Robert J. Chen](http://fernjager.net) - Programming
* [Benjamin Kwok](mailto:tengen1112@gmail.com) - Art
* [Scott R. Mobley](http://www.linkedin.com/in/mobleyscott) - Math and Dialogue
* Sheen Kao - Supreme Commissar Overlord MC
## Backup Mirror
* http://fernjager.net/game/index.html
@ -37,10 +36,7 @@ You have been invited to craft the centerpiece of the American thanksgiving dinn @@ -37,10 +36,7 @@ You have been invited to craft the centerpiece of the American thanksgiving dinn
## Licenses and Credit
![CC](http://i.creativecommons.org/l/by-nc/3.0/88x31.png)
* Unless indicated otherwise in the credits page:
* All original artwork and writing are licensed under the Creative Commons Attribution-NonCommercial BY-NC
* Artwork: Benjamin Kwok.
* Writing: Scott Mobley.
* Source code is released under GPL v3 by Robert Chen.
* See credits screen for full attribution of all assets.
* Unless indicated otherwise in the credits page, all artwork are licensed under the Creative Commons Attribution-NonCommercial BY-NC by Benjamin Kwok.
* See credits screen for full attribution of sound assets

2
index.html

@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@
</div>
</center>
</body>
<script src="//code.createjs.com/createjs-2013.09.25.min.js"></script>
<script src="http://code.createjs.com/createjs-2013.09.25.min.js"></script>
<script src="js/model.js"></script>
<script src="js/soundmanager.js"></script>
<script src="js/stories.js"></script>

17
js/dialogue.js

@ -65,10 +65,6 @@ function DialogUI( stage, gameState ){ @@ -65,10 +65,6 @@ function DialogUI( stage, gameState ){
this.textContent.addEventListener( "mouseout", function(){ document.body.style.cursor='default'; } );
this.textContent.addEventListener( "click", function(){ setTimeout( clickEvent, 100); });
// negate double setTimeout if clicked
var oldTime = new Date().getTime();
var delayCounter = 0;
this.endFunc = function(){};
this.showDialog= function( textSeq ){
@ -94,15 +90,13 @@ function DialogUI( stage, gameState ){ @@ -94,15 +90,13 @@ function DialogUI( stage, gameState ){
that.showRandomConvo();
return;
}
delayCounter = 0;
oldTime = new Date().getTime();
that.currDialogueSeq = new DialogueSequence( textSeq.seq );
var nextDialogue = that.currDialogueSeq.next();
that.endFunc = textSeq.endFunc || function(){};
that.textContent.text=nextDialogue[1].replace(/\[GenderPronoun\]/g, gameState.pronoun ).replace(/\[Player\]/g, gameState.name || "Sam" );
that.textContent.text=nextDialogue[1].replace(/\[GenderPronoun\]/g, gameState.pronoun ).replace(/\[Player\]/g, gameState.name );
that.currentFace.y = 250;
that.currentFace = peopleImg[nextDialogue[0]] || that.currentFace;
that.autoAdvance = textSeq.autoAdvance;
@ -127,6 +121,9 @@ function DialogUI( stage, gameState ){ @@ -127,6 +121,9 @@ function DialogUI( stage, gameState ){
gameState.pubsub.subscribe( "ShowDialog", this.showDialog );
// negate double setTimeout if clicked
var oldTime = new Date().getTime();
var delayCounter = 0;
var clickEvent = function( timer ){
if( !peopleImg["Me"] ){
@ -138,7 +135,7 @@ function DialogUI( stage, gameState ){ @@ -138,7 +135,7 @@ function DialogUI( stage, gameState ){
var nextDialogue = that.currDialogueSeq.next();
that.dialogMotionQueue.push(DIALOG_SHOWING);
that.textContent.text=nextDialogue[1].replace(/\[GenderPronoun\]/g, gameState.pronoun ).replace(/\[Player\]/g, gameState.name || "Sam" );
that.textContent.text=nextDialogue[1];
if(DEBUG) console.log("showing face:" +nextDialogue[0] );
// swap out face immediately
@ -168,6 +165,7 @@ function DialogUI( stage, gameState ){ @@ -168,6 +165,7 @@ function DialogUI( stage, gameState ){
return {
tick: function(){
delayCounter = new Date().getTime() - oldTime;
if( that.autoAdvance == true && that.dialogBox.y ==0 && delayCounter > ( (that.textContent.text.length * MILLIS_PER_CHAR) < 2000 ? 2000 : (that.textContent.text.length * MILLIS_PER_CHAR) ) ){
clickEvent();
@ -207,7 +205,6 @@ function DialogUI( stage, gameState ){ @@ -207,7 +205,6 @@ function DialogUI( stage, gameState ){
if( that.dialogMotionQueue.length > 0 && that.dialogState == DIALOG_PAUSING ){
that.dialogState = that.dialogMotionQueue.shift();
}
delayCounter = new Date().getTime() - oldTime;
},
minDialog: function(){

29
js/main.js

@ -71,7 +71,6 @@ function GameState(){ @@ -71,7 +71,6 @@ function GameState(){
// Screens
queue.loadFile( {id: "res/screens/DifficultyScreen/Difficulty-Selection.png", src:"res/screens/DifficultyScreen/Difficulty-Selection.png"} );
queue.loadFile( {id: "res/screens/DifficultyScreen/ButtonsandText.png", src:"res/screens/DifficultyScreen/ButtonsandText.png"} );
queue.loadFile( {id: "res/screens/DifficultyScreen/ButtonMale.png", src:"res/screens/DifficultyScreen/ButtonMale.png"} );
queue.loadFile( {id: "res/screens/DifficultyScreen/ButtonFemale.png", src:"res/screens/DifficultyScreen/ButtonFemale.png"} );
@ -88,11 +87,11 @@ function GameState(){ @@ -88,11 +87,11 @@ function GameState(){
queue.loadFile( {id: "HelpP3P4", src:"res/screens/HelpCreditsScreen/HelpP3P4.png" } );
queue.loadFile( {id: "HelpP5P6", src:"res/screens/HelpCreditsScreen/HelpP5P6.png" } );
queue.loadFile( {id: "HelpP7P8", src:"res/screens/HelpCreditsScreen/HelpP7P8.png" } );
queue.loadFile( {id: "HelpP9P10", src:"res/screens/HelpCreditsScreen/HelpP9P10.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"} );
@ -101,6 +100,7 @@ function GameState(){ @@ -101,6 +100,7 @@ function GameState(){
queue.loadFile( {id: "MarketSoundFile", src:"res/sound/Store/Waterford.mp3"} );
// UI sounds
queue.loadFile( {id: "UILowClickFile", src:"res/sound/GUI/lowclick.mp3"} );
queue.loadFile( {id: "UIClickFile", src:"res/sound/GUI/click.mp3"} );
queue.loadFile( {id: "UIBuzzFile", src:"res/sound/GUI/buzz.mp3"} );
queue.loadFile( {id: "UIDingFile", src:"res/sound/GUI/ding.mp3"} );
@ -108,11 +108,11 @@ function GameState(){ @@ -108,11 +108,11 @@ function GameState(){
// Kitchen Items
queue.loadFile( {id: "res/screens/KitchenScreen/KitchenScreen.png", src:"res/screens/KitchenScreen/KitchenScreen.png"});
queue.loadFile( {id: "res/screens/KitchenScreen/FinalConfirmation.png", src:"res/screens/KitchenScreen/FinalConfirmation.png"});
queue.loadFile( {id: "res/screens/KitchenScreen/TurkeyState1Small.png", src:"res/screens/KitchenScreen/TurkeyState1Small.png"});
queue.loadFile( {id: "res/screens/KitchenScreen/TurkeyState2Small.png", src:"res/screens/KitchenScreen/TurkeyState2Small.png"});
queue.loadFile( {id: "res/screens/KitchenScreen/TurkeyState3Small.png", src:"res/screens/KitchenScreen/TurkeyState3Small.png"});
queue.loadFile( {id: "res/screens/KitchenScreen/TurkeyState4Small.png", src:"res/screens/KitchenScreen/TurkeyState4Small.png"});
queue.loadFile( {id: "res/screens/KitchenScreen/TurkeyState5Small.png", src:"res/screens/KitchenScreen/TurkeyState5Small.png"});
queue.loadFile( {id: "res/screens/KitchenScreen/TurkeyState1Small.svg", src:"res/screens/KitchenScreen/TurkeyState1Small.svg"});
queue.loadFile( {id: "res/screens/KitchenScreen/TurkeyState2Small.svg", src:"res/screens/KitchenScreen/TurkeyState2Small.svg"});
queue.loadFile( {id: "res/screens/KitchenScreen/TurkeyState3Small.svg", src:"res/screens/KitchenScreen/TurkeyState3Small.svg"});
queue.loadFile( {id: "res/screens/KitchenScreen/TurkeyState4Small.svg", src:"res/screens/KitchenScreen/TurkeyState4Small.svg"});
queue.loadFile( {id: "res/screens/KitchenScreen/TurkeyState5Small.svg", src:"res/screens/KitchenScreen/TurkeyState5Small.svg"});
queue.loadFile( {id: "res/screens/KitchenScreen/CookbookKitchenGlow.png", src:"res/screens/KitchenScreen/CookbookKitchenGlow.png"});
queue.loadFile( {id: "res/screens/KitchenScreen/CookbookKitchen.png", src:"res/screens/KitchenScreen/CookbookKitchen.png"});
@ -246,8 +246,7 @@ function GameState(){ @@ -246,8 +246,7 @@ function GameState(){
queue.loadFile( {id: "res/screens/Window/Win10.png", src:"res/screens/Window/Win10.png"});
queue.loadFile( {id: "res/screens/Window/Win11.png", src:"res/screens/Window/Win11.png"});
queue.loadFile( {id: "res/screens/Window/Tree_Animation.png", src:"res/screens/Window/Tree_Animation.png"});
queue.loadFile( {id: "res/screens/Window/Test4TransparencyFull.png", src:"res/screens/Window/Test4TransparencyFull.png"});
queue.loadFile( {id: "res/screens/Window/Stars.png", src:"res/screens/Window/Stars.png"});
queue.loadFile( {id: "res/screens/Window/Test4TransparencyFull.svg", src:"res/screens/Window/Test4TransparencyFull.svg"});
@ -284,11 +283,11 @@ function GameState(){ @@ -284,11 +283,11 @@ function GameState(){
/* all turkeys */
this.turkeyStates = [
new createjs.Bitmap( "res/screens/KitchenScreen/TurkeyState1Small.png" ),
new createjs.Bitmap( "res/screens/KitchenScreen/TurkeyState2Small.png" ),
new createjs.Bitmap( "res/screens/KitchenScreen/TurkeyState3Small.png" ),
new createjs.Bitmap( "res/screens/KitchenScreen/TurkeyState4Small.png" ),
new createjs.Bitmap( "res/screens/KitchenScreen/TurkeyState5Small.png" )
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 = [];
@ -355,7 +354,7 @@ function GameUI( canvasElem, gameState ){ @@ -355,7 +354,7 @@ function GameUI( canvasElem, gameState ){
var soundManager = new SoundManager( gameState );
this.activeScreenObj = new LoadingScreen( this.stage, gameState );
var textContent = new createjs.Text( "", "20px Arial", "white" );
var textContent = new createjs.Text( "", "20px Arial", "black" );
textContent.x = 750;
textContent.y = 30;
//this.stage.addChild( textContent);

320
js/model.js

@ -1,29 +1,36 @@ @@ -1,29 +1,36 @@
function TurkeyLayer( name, layerNumber1, turkeyModel, ovenModel ){
function TurkeyLayer( name, percentRadius, turkeyModel, ovenModel ){
var that = this;
this.name = name;
this.layerNumber=layerNumber1;
this.percentRadius=percentRadius;
this.initialTemp = 20;
this.waterLost = 0;
this.finalTemperature = 20;
this.cookCondition = "Raw";
this.highestTemp = 0;
this.cookCondition = "Raw";
return {
updateTemperatureTick: function(){
that.finalTemperature = turkeyModel.globTemp[that.layerNumber]
if(DEBUG) console.log(turkeyModel.globTemp);
that.highestTemp = that.finalTemperature > that.highestTemp ? that.finalTemperature : that.highestTemp;
that.finalTemperature = UtilityFunctions.transientSphereSeries( turkeyModel.density,
turkeyModel.thermalConduct,
turkeyModel.heatConvection,
turkeyModel.cp,
percentRadius * turkeyModel.totalRadius,
turkeyModel.totalRadius,
that.initialTemp,
ovenModel.steadyTemp,
ovenModel.globalTime );
that.waterLost = that.waterLost + UtilityFunctions.waterLoss( that.finalTemperature );
that.cookCondition = UtilityFunctions.cookCondition(that.waterLost, that.name);
if(DEBUG) console.log( that.name + ": "+ that.waterLost + " " + that.cookCondition + " " + that.finalTemperature + " C" );
that.cookCondition = UtilityFunctions.cookCondition(that.waterLost);
if(DEBUG) console.log( that.name + ": "+ that.waterLost + " " + that.cookCondition);
},
resetLayerTemps: function(){
that.initialTemp = that.finalTemperature;
},
getCondition: function(){
return that.cookCondition;
},
getTemperature: function(){
return that.finalTemperature;
},
getHighestTemp: function(){
return that.highestTemp;
}
}
@ -31,71 +38,45 @@ function TurkeyLayer( name, layerNumber1, turkeyModel, ovenModel ){ @@ -31,71 +38,45 @@ function TurkeyLayer( name, layerNumber1, turkeyModel, ovenModel ){
function TurkeyModel( weight, ovenModel ){
this.density = 700; // kg/m3 Assuming Density of Water 1000 kg/m3
this.cp = 2810; // 2810 J/kg K for Turkey. Extra is to semi-account for water evaporation energy
this.density = 1050; // kg/m3 Assuming Density of Water 1000 kg/m3
this.cp = 2000; // 2810 J/kg K for Turkey. Extra is to semi-account for water evaporation energy
this.heatConvection = 9; // W/m2 K Some Reasonable estimate for natural Convection. Change as needed. 5-25
this.thermalConduct = 0.412; // W/m K // Chicken
this.skin = {};
this.body = {};
this.core = {};
this.splitsNum = 20;
console.log(UtilityFunctions.lbs2kgs(weight))
this.totalRadius = UtilityFunctions.calculateRadius( UtilityFunctions.lbs2kgs(weight), this.density );
this.totalRadius = UtilityFunctions.calculateRadius( weight, this.density );
this.totalLayers = [ new TurkeyLayer("Skin", this.splitsNum-1, this, ovenModel ),
new TurkeyLayer("Body", this.splitsNum-10, this, ovenModel ),
new TurkeyLayer("Core", 1, this, ovenModel ) ];
this.totalLayers = [ new TurkeyLayer("Skin", 0.85, this, ovenModel ),
new TurkeyLayer("Body", 0.45, this, ovenModel ),
new TurkeyLayer("Core", 0.01, this, ovenModel ) ];
// Whenever temperature is changed
this.updateLayerTemps = function() {
this.globTemp = UtilityFunctions.transientSphereSeries( this.density,
this.thermalConduct,
this.heatConvection,
this.cp,
this.totalRadius,
ovenModel.tempInfini,
this.splitsNum,
this.deltar,
this.globTemp,
this.pointRadius
);
this.updateLayerTemps = function(){
for (var i in this.totalLayers ){
this.totalLayers[i].updateTemperatureTick();
}
};
this.resetLayerTemps = function() {
for (var i in this.totalLayers ) {
this.resetLayerTemps = function(){
for (var i in this.totalLayers ){
this.totalLayers[i].resetLayerTemps();
}
};
//Sheen Model Stuff
this.globTemp=[];
this.pointRadius = []
this.splitsNum = 20;
this.deltar = this.totalRadius/this.splitsNum; //20 Data Points
this.initializePoints = function() {
var step = ( this.totalRadius - this.deltar ) / ( this.splitsNum - 1 );
for (var i = 0; i<this.splitsNum ; i++ ) {
this.pointRadius.push(step*i+this.deltar);
this.globTemp.push(20+step*i); //Starts at 20 C for initilizating
}
};
this.initializePoints()
}
function OvenModel( turkeyWeight, gameState ) {
var that = this;
this.tempInfini=20; //C
this.setTemp = 20;
this.steadyTemp = 20;
this.steadyTimer = 0;
this.globalTime = 0;
var turkey = new TurkeyModel(turkeyWeight, this );
var turkey = new TurkeyModel(9.07185, this );
var proportional = 0.004; // This value is arbitrary to how fast you want the temperatures to converge. (Or oscillate, which could be realistic as well)
var errorTolerance = 10; //Stove is accurate to 1 degree Celcius Should hopefully oscillate below that value.
// Equalize temp will need to be sent each time iteration
@ -109,6 +90,13 @@ function OvenModel( turkeyWeight, gameState ) { @@ -109,6 +90,13 @@ function OvenModel( turkeyWeight, gameState ) {
}
if( error>errorTolerance ) {
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();
}
return(true);
}
}
@ -117,18 +105,15 @@ function OvenModel( turkeyWeight, gameState ) { @@ -117,18 +105,15 @@ function OvenModel( turkeyWeight, gameState ) {
return {
"skin" : {
"temp": turkey.totalLayers[0].getTemperature(),
"cond": turkey.totalLayers[0].getCondition(),
"highest" : turkey.totalLayers[0].getHighestTemp()
"cond": turkey.totalLayers[0].getCondition()
},
"body" : {
"temp": turkey.totalLayers[1].getTemperature(),
"cond": turkey.totalLayers[1].getCondition(),
"highest" : turkey.totalLayers[1].getHighestTemp()
"cond": turkey.totalLayers[1].getCondition()
},
"core" : {
"temp": turkey.totalLayers[2].getTemperature(),
"cond": turkey.totalLayers[2].getCondition(),
"highest" : turkey.totalLayers[2].getHighestTemp()
"cond": turkey.totalLayers[2].getCondition()
}
};
},
@ -149,15 +134,19 @@ function OvenModel( turkeyWeight, gameState ) { @@ -149,15 +134,19 @@ function OvenModel( turkeyWeight, gameState ) {
},
secondTick: function(){
that.globalTime = that.globalTime + 1;
that.steadyTimer = that.steadyTimer + 1;
if ( that.equalizeTemp() ) {
// Turn on oven light
gameState.pubsub.publish( "OvenLight", "On" );
}
else {
that.steadyTemp = that.tempInfini;
// Turn off oven light
gameState.pubsub.publish( "OvenLight", "Off" );
}
if(DEBUG) console.log("Steady Temp " + that.steadyTemp)
if(DEBUG) console.log("Steady Timer " + that.steadyTimer)
if(DEBUG) console.log("Oven Temp " + that.tempInfini )
turkey.updateLayerTemps();
}
@ -190,6 +179,26 @@ UtilityFunctions = { @@ -190,6 +179,26 @@ UtilityFunctions = {
return complexRadius;
},
findAllRoots: function(min,max,splitsNum,Biot) {
var step = ( max - min ) / ( splitsNum - 1 );
var answer;
var negativeTest;
var storage = [];
for (var i = step; i < max; i=i+step ) {
negativeTest = this.lambdaFormula(i-step, Biot)*this.lambdaFormula(i, Biot);
if (negativeTest <= 0) {
answer = this.bisectionMethod(i-step,i,Biot);
if (answer !=undefined) {
storage.push(answer);
}
}
else {
//if(DEBUG) console.log("No Bracketed Root " + negativeTest)
}
}
return storage;
},
sphereVolume: function(radius) {
return((4/3)*Math.PI*Math.pow(radius,3))
},
@ -198,50 +207,74 @@ UtilityFunctions = { @@ -198,50 +207,74 @@ UtilityFunctions = {
return (Math.pow(10,(temperature-20)/80)-1)
},
transientSphereSeries: function( density, thermalConduct, heatConvection, cp, rTotal, tempInfinity, splitsNum, deltar, globTemp,pointRadius) {
//Not Global Stuff
var r0 = rTotal;
var deltat = 0.1
var alpha = thermalConduct/(density*cp)
var h=heatConvection;
for (var j=0; j<(1/deltat); j++ ) {
var dTdr=[]
// globTemp[splitsNum-1] should be last entry in globtemp
for (var k=0; k<splitsNum; k++){
if (k==0) {
dTdr.push((globTemp[1] - globTemp[0])/deltar) }
else if (k==splitsNum-1) {
dTdr.push((globTemp[splitsNum-1] - globTemp[splitsNum-2])/deltar)}
else {
dTdr.push((globTemp[k+1] - globTemp[k-1])/(2*deltar))}
}
dTdr[splitsNum-1] = heatConvection*(tempInfinity-globTemp[splitsNum-1])/thermalConduct
var parenthesis = []
for (var k=0; k<splitsNum; k++){
parenthesis.push(dTdr[k]*Math.pow(pointRadius[k],2))
}
dPdr = []
for (var k=0; k<splitsNum; k++){
if (k==0) {
dPdr.push((parenthesis[1] - parenthesis[0])/deltar) }
else if (k==splitsNum-1) {
dPdr.push((parenthesis[splitsNum-1] - parenthesis[splitsNum-2])/deltar)}
else {
dPdr.push((parenthesis[k+1] - parenthesis[k-1])/(2*deltar))}
}
for (var k=0; k<splitsNum; k++){
globTemp[k]=alpha*dPdr[k]/Math.pow(pointRadius[k],2)*deltat + globTemp[k] //dTdr * deltaT in one loop
}
//dTdt(1)=dTdt(1)/2;
}
return(globTemp)
bisectionMethod: function(min,max,Biot) {
errorTolerance = (1/Math.pow(10,8))
result = Infinity // some large value to ensure the calculation goes through.
negativeTest =this.lambdaFormula(min, Biot)*this.lambdaFormula(max, Biot)
if (negativeTest <=0 ) {
var antiFreeze=0;
while (Math.abs(result) > errorTolerance && antiFreeze<=500) { //The greater the antiFreeze, the more wasted cycles around a singularity
lambdaN = (min+max)/2
result=this.lambdaFormula(lambdaN, Biot)
if (Math.abs(result) <= errorTolerance && result<=errorTolerance) {
return (lambdaN); //At Root
}
else if ((this.lambdaFormula(min, Biot)*this.lambdaFormula(lambdaN, Biot))>=0) {
min=lambdaN;
}
else if ((this.lambdaFormula(max, Biot)*this.lambdaFormula(lambdaN, Biot))>=0) {
max=lambdaN;
}
antiFreeze++
}
}
},
lambdaFormula: function( lambdaN, Biot ) {
var result = 1-lambdaN*(1/Math.tan(lambdaN))-Biot;
return(result)
},
transientSphereSeries: function( density, thermalConduct, heatConvection, cp, rPosition, rTotal, tempInitial, tempInfini, t ){
var min = 0;
var max = 10000; // This are for setting Lambda boundaries and nothing else
var sum=0;
var alpha = thermalConduct/(density*cp);
var lambdaN;
var sinPortion;
var exponentialPortion;
var frontCoefficientPortion;
//if(DEBUG) console.log("Alpha is " + alpha)
var Fourier = (alpha*t)/Math.pow(rTotal,2)
//if(DEBUG) console.log("Fourier is " + Fourier)
var biotNum = heatConvection * rTotal/thermalConduct
if ( biotNum != this.cachedBiot ) {
if(DEBUG) console.log("Recalculating Lambda Terms")
this.cachedLambda = this.findAllRoots(min,max,max*Math.PI*10,biotNum)
this.cachedBiot = biotNum;
}
//if(DEBUG) console.log("The Biot Value is " + biotNum)
for (var i = 0; i<this.cachedLambda.length; i++) {
var lambdaN = this.cachedLambda[i];
var sinPortion= Math.sin(lambdaN*rPosition/rTotal)/(lambdaN*rPosition/rTotal);
var exponentialPortion = (1/Math.exp(Math.pow(lambdaN,2)*Fourier));
var frontCoefficientPortion = 4*(Math.sin(lambdaN)-(lambdaN*Math.cos(lambdaN)))/ (2*lambdaN-Math.sin(2*lambdaN));
sum = frontCoefficientPortion*exponentialPortion*sinPortion + sum;
}
tempAtTimeAndRadius=(sum*(tempInitial-tempInfini))+tempInfini
if(DEBUG) console.log("The Temperature at radius " + rPosition + " m and time " + t/60/60 + " hours is " + tempAtTimeAndRadius + " C or " + this.C2F(tempAtTimeAndRadius) + " F");
return(tempAtTimeAndRadius)
},
/* Utility Functions */
@ -257,62 +290,31 @@ UtilityFunctions = { @@ -257,62 +290,31 @@ UtilityFunctions = {
randRange: function(min, max){
return Math.floor(Math.random()*(max-min+1))+min;
},
cookCondition: function(cookValue, layerName){
if( layerName == "Skin" || layerName == "Body" ){
var multiplier = 1;
if (cookValue>=multiplier*600000) {
return ["Fire", (cookValue)/(multiplier*700000),"fire"];
}
else if(cookValue>=multiplier*400000) {
return ["Burnt", (cookValue)/(multiplier*600000), "burnt"];
}
else if (cookValue>=multiplier*300000) {
return ["Dry", (cookValue)/(multiplier*350000), "dry"];
}
else if (cookValue>=multiplier*250000){ // >250000
return ["Cooked", (cookValue)/(multiplier*300000), "overcooked"];
}
else if (cookValue>=multiplier*80000) { // >50000
return ["Cooked", (cookValue)/(multiplier*250000), "cooked"];
}
else if (cookValue>=multiplier*50000){
return ["Undercooked", (cookValue)/(multiplier*80000), "slightly cooked"];
}
else if (cookValue>=multiplier*25000) { //
return ["Undercooked", (cookValue)/(multiplier*50000), "undercooked"];
}
else {
return ["Raw", 1, "raw"];
}
cookCondition: function(cookValue,volume){
var multiplier = 1;
if (cookValue>=multiplier*600000) {
return ["Fire", (cookValue-600000)/(multiplier*600000),"fire"];
}
else{
var multiplier = 1;
if (cookValue>=multiplier*45000) { //
return ["Fire", (cookValue)/(multiplier*600000),"fire"];
}
else if(cookValue>=multiplier*35000){//
return ["Burnt", (cookValue)/(multiplier*45000), "burnt"];
}
else if (cookValue>=multiplier*25000){ //
return ["Dry", (cookValue)/(multiplier*35000), "dry"];
}
else if (cookValue>=multiplier*22000){ //
return ["Cooked", (cookValue)/(multiplier*25000), "overcooked"];
}
else if (cookValue>=multiplier*12000){ //
return ["Cooked", (cookValue)/(multiplier*22000), "cooked"];
}
else if (cookValue>=multiplier*7000){ //
return ["Undercooked", (cookValue)/(multiplier*12000), "slightly cooked"];
}
else if (cookValue>=multiplier*3000) {
return ["Undercooked", (cookValue)/(multiplier*7000), "undercooked"];
}
else {
return ["Raw", 1, "raw"];
}
else if(cookValue>=multiplier*250000) {
return ["Burnt", (cookValue-250000)/(multiplier*600000), "burnt"];
}
else if (cookValue>=multiplier*150000) {
return ["Dry", (cookValue-150000)/(multiplier*250000), "dry"];
}
else if (cookValue>=multiplier*85000){
return ["Cooked", (cookValue-12000)/(multiplier*150000), "overcooked"];
}
else if (cookValue>=multiplier*12000) {
return ["Cooked", (cookValue-12000)/(multiplier*150000), "cooked"];
}
else if (cookValue>=multiplier*10000){
return ["Undercooked", (cookValue-5000)/(multiplier*12000), "slightly cooked"];
}
else if (cookValue>=multiplier*5000) {
return ["Undercooked", (cookValue-5000)/(multiplier*12000), "undercooked"];
}
else {
return ["Raw", 1, "raw"];
}
}
}
@ -320,8 +322,8 @@ UtilityFunctions = { @@ -320,8 +322,8 @@ UtilityFunctions = {
//Running the Program Stuff
/*
var ovenObject = new OvenModel();
var turkey = new TurkeyModel(9, ovenObject);
var turkey = new TurkeyModel(9.07185, ovenObject );
globalTime=0;
setInterval(function(){ovenObject.secondTick();},1000);
setInterval(function(){ovenObject.secondTick();},10);
*/

48
js/screens.js

@ -15,6 +15,7 @@ function LoadingScreen( stage, gameState ){ @@ -15,6 +15,7 @@ function LoadingScreen( stage, gameState ){
this.done.alpha= 0;
stage.addChild( this.picture );
stage.addChild( this.cooking );
stage.addChild( this.done );
stage.addChild( this.turkeyState[0] );
var textContent = new createjs.Text( "0 %", "25px Arial", "black" );
@ -24,7 +25,7 @@ function LoadingScreen( stage, gameState ){ @@ -24,7 +25,7 @@ function LoadingScreen( stage, gameState ){
gameState.pubsub.subscribe( "Load", function(percent){
textContent.text = (percent * 25).toFixed(2) + " %";
var wholeNum = Math.floor(percent);
var wholeNum = percent.toFixed(0);
if( that.lastPercent != percent){
that.lastPercent = percent;
stage.addChild( that.turkeyState[wholeNum] );
@ -51,7 +52,6 @@ function LoadingScreen( stage, gameState ){ @@ -51,7 +52,6 @@ function LoadingScreen( stage, gameState ){
}
});
stage.addChild( this.done );
stage.addChild( this.pictureFront );
return {
@ -178,10 +178,8 @@ function DifficultyScreen( stage, gameState ){ @@ -178,10 +178,8 @@ function DifficultyScreen( stage, gameState ){
}
}
if( keynum != 8 && keynum < 91 && keynum > 47 && nameInput.text.length < 22 ){
if( keynum != 8 && keynum < 91 && keynum > 47 && nameInput.text.length < 22 )
nameInput.text += String.fromCharCode(keynum);
gameState.name = nameInput.text;
}
};
@ -197,19 +195,19 @@ function DifficultyScreen( stage, gameState ){ @@ -197,19 +195,19 @@ function DifficultyScreen( stage, gameState ){
}
}
if(keynum == 8 && nameInput.text.length > 0 ){
if(keynum == 8 && nameInput.text.length > 0 )
nameInput.text = nameInput.text.substr(0, nameInput.text.length-1);
gameState.name = nameInput.text;
}
event.preventDefault();
}
gameState.name = nameInput.text;
// Easy/Hard Button
stage.addChild( new Button( stage, gameState, 500, 235, 100, 55, "ChangeGender", "Male" ) );
stage.addChild( new Button( stage, gameState, 500, 300, 100, 55, "ChangeGender", "Female" ) );
stage.addChild( new Button( stage, gameState, 503, 370, 200, 55, null, null, function(){ document.onkeyup = function(){}; gameState.hard = false; gameState.gameStarted = true; gameState.hardcoreModifier=1; gameState.pubsub.publish("SwitchScreen", "KitchenScreen"); } ) );
stage.addChild( new Button( stage, gameState, 500, 495, 205, 55, null, null, function(){ document.onkeydown = function(){}; gameState.hard = true; gameState.gameStarted = true; gameState.hardcoreModifier=20; gameState.pubsub.publish("SwitchScreen", "KitchenScreen"); } ) );
stage.addChild( new Button( stage, gameState, 503, 370, 200, 55, null, null, function(){ gameState.hard = false; gameState.gameStarted = true; gameState.hardcoreModifier=20; gameState.pubsub.publish("SwitchScreen", "KitchenScreen"); } ) );
stage.addChild( new Button( stage, gameState, 500, 495, 205, 55, null, null, function(){ gameState.hard = true; gameState.gameStarted = true; gameState.hardcoreModifier=1; gameState.pubsub.publish("SwitchScreen", "KitchenScreen"); } ) );
stage.addChild( new Button( stage, gameState, 35, 495, 85, 55, "SwitchScreen", "MainScreen" ) );
@ -405,7 +403,7 @@ function ScoreScreen( stage, gameState ){ @@ -405,7 +403,7 @@ function ScoreScreen( stage, gameState ){
var totalScore = 0;
var skinScoreChart = {
"raw": -1000,
"raw": 0,
"undercooked": -100,
"slightly cooked": 75,
"cooked": 500,
@ -417,9 +415,9 @@ function ScoreScreen( stage, gameState ){ @@ -417,9 +415,9 @@ function ScoreScreen( stage, gameState ){
var coreScoreChart = {
"raw": 0,
"undercooked": 125,
"slightly cooked": 600,
"slightly cooked": 750,
"cooked": 1000,
"overcooked": 750,
"overcooked": 1000,
"dry": 400,
"burnt": 0
};
@ -441,28 +439,29 @@ function ScoreScreen( stage, gameState ){ @@ -441,28 +439,29 @@ function ScoreScreen( stage, gameState ){
};
// Temperature Score
var outerTemp = UtilityFunctions.C2F(turkeyState.skin.highest).toFixed(2);
var outerTemp = UtilityFunctions.C2F(turkeyState.skin.temp).toFixed(2);
var coreTemp = UtilityFunctions.C2F(turkeyState.core.temp).toFixed(2);
var outerTempScore = that.scoreDistribution( outerTemp, "skin" ) * 200;
var outerTempScore = that.scoreDistribution( outerTemp ) * 200;
var coreTempScore = that.scoreDistribution( coreTemp ) * 200;
totalScore += parseInt(skinScoreChart[ turkeyState.skin.cond[2]]);
totalScore += parseInt(coreScoreChart[ turkeyState.core.cond[2]]);
totalScore += parseInt(skinScoreChart[ turkeyState.core.cond[2]]);
totalScore += parseInt(outerTempScore.toFixed(0));
totalScore += parseInt(coreTempScore.toFixed(0));
resultsDialogue = [];
if (totalScore>=1800) {
if (totalScore>=2000) {
randomDiag = perfect;
}
else if (totalScore>=1400) {
else if (totalScore>=1200) {
randomDiag = great;
}
else if (totalScore>=1000) {
else if (totalScore>=625) {
randomDiag = average;
}
else if (totalScore>=400) {
else if (totalScore>=300) {
randomDiag = subPar;
}
else {
@ -552,7 +551,7 @@ function ScoreScreen( stage, gameState ){ @@ -552,7 +551,7 @@ function ScoreScreen( stage, gameState ){
outerConditionText.x = 310;
outerConditionText.y = 320;
var coreConditionText = new createjs.Text( coreScoreChart[ turkeyState.core.cond[2] ], "20px Arial", "black" );
var coreConditionText = new createjs.Text( coreScoreChart[ turkeyState.skin.cond[2] ], "20px Arial", "black" );
coreConditionText.x = 310;
coreConditionText.y = 340;
@ -593,13 +592,14 @@ function ScoreScreen( stage, gameState ){ @@ -593,13 +592,14 @@ function ScoreScreen( stage, gameState ){
// Modifiers
var turkeyMod = typeToMod[gameState.turkeyType];
var turkeyTypeModifierText = new createjs.Text( -1*((1-turkeyMod)*100).toFixed(0) + "%", "20px Arial", "black" );
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( -1*((1-gameState.stuffingTypeModifier)*100).toFixed(0)+"%" , "20px Arial", "black" );
var stuffingTypeModifierText = new createjs.Text( "+"+(Math.abs(gameState.stuffingTypeModifier-1)*100).toFixed(0)+"%" , "20px Arial", "black" );
stuffingTypeModifierText.x = 310
stuffingTypeModifierText.y = 457;
@ -626,6 +626,8 @@ function ScoreScreen( stage, gameState ){ @@ -626,6 +626,8 @@ function ScoreScreen( stage, gameState ){
stage.addChild( turkeyTypeModifierText );
stage.addChild( frillsModifierText );
stage.addChild( hardcoreModifierText );
}} );

1
js/soundmanager.js

@ -14,6 +14,7 @@ function SoundManager( gameState ){ @@ -14,6 +14,7 @@ function SoundManager( gameState ){
// Register all sounds loaded in gameState
createjs.Sound.registerSound("res/sound/turkey_in_the_straw.mp3", "TitleMusic");
createjs.Sound.registerSound("res/sound/Store/Waterford.mp3", "MarketMusic");
createjs.Sound.registerSound("res/sound/GUI/lowclick.mp3", "LowClick");
createjs.Sound.registerSound("res/sound/GUI/click.mp3", "Click");
createjs.Sound.registerSound("res/sound/GUI/buzz.mp3", "Error");
createjs.Sound.registerSound("res/sound/Store/buy.mp3", "Buy");

212
js/stories.js

@ -4,8 +4,8 @@ var messages = { @@ -4,8 +4,8 @@ var messages = {
"CannotBuyTurkey" : ["Me: I barely have time for ONE turkey, let alone TWO!"],
"NoMoney" : ["Me: I can't afford this!"],
"BuyTurkeyFirst" : ["Me: I should buy a turkey first!"],
"EmptyOven" : ["Me: I'll start cooking once I get a turkey."],
"OpenDoor" :["Me: I should probably try opening the oven door to measure the turkey's temperature."]
"EmptyOven" : ["Me: Ah, the oven is already preheated..."],
"OpenDoor" :["Me: I should probably try opening the oven door to measure the turkey's temperature"]
}
//Terrible Results
@ -17,8 +17,8 @@ var terrible = [ @@ -17,8 +17,8 @@ var terrible = [
"Mom: No thanks, I'm actually a vegetarian.",
"Brother: Who taught you how to cook?",
"Brother: What an awful turkey.",
"Spouse: I'm leaving you honey. It's not you, its the turkey.",
"Cat: Meow Meow (Get out of my house!)"];
"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 = [
@ -32,9 +32,9 @@ var subPar = [ @@ -32,9 +32,9 @@ var subPar = [
"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.",
"Spouse: Hey, the cat seems to like it.",
"Spouse: We'll have to go to some cooking classes together.",
"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
@ -44,8 +44,8 @@ var average = [ @@ -44,8 +44,8 @@ var average = [
"Dad: Pretty decent turkey have you cooked here.",
"Mom: Tastes better than store cooked turkeys.",
"Brother: This is way better than I expected.",
"Spouse: Not bad.",
"Cat: Meow meow (I may not leave a present in your shoes today)"];
"Girlfriend: Not bad.",
"Cat: Meow meow ('I may not leave a present in your shoes today')"];
//Great Results
var great = [
@ -57,8 +57,8 @@ var great = [ @@ -57,8 +57,8 @@ var great = [
"Mom: The second best turkey I have ever had!",
"Mom: You should teach me your secrets",
"Brother: Way to go, this turkey is fantastic.",
"Spouse: Oh, what a nice turkey.",
"Cat: Meow MEOW! (I am pleased, human)"];
"Girlfriend: Oh, what a nice turkey.",
"Cat: Meow MEOW! ('I am pleased, human')"];
//Perfect Results
var perfect = [
@ -68,8 +68,8 @@ var perfect = [ @@ -68,8 +68,8 @@ var perfect = [
"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!",
"Spouse: Bite after bite of gourmet delight!",
"Spouse: We should get married. Tonight!",
"Girlfriend: Bite after bite of gourmet delight!",
"Girlfriend: We should get married. Tonight!",
"Cat: Puuuurrrrrrr"];
@ -219,7 +219,7 @@ var story = { @@ -219,7 +219,7 @@ var story = {
"Mom: Did you stay the whole time? I could not see myself walking out. I would feel too embarrassed about the whole audience staring at me.",
"Spouse: It isn't that hard, you just treat it like you are headed to the bathroom. Except you never come back.",
"Spouse: But yes, we did leave early, so we'll have to check the rest of the movie on DVD, or see it in theatres when it officially releases.",
"Mom: Good thing the staff didn't send a search party for you. Maybe you fell into the toilet.",
"Mom: Good thing the staff didn't send a search party for you. Maybe you fell into the toilet",
"Spouse: Haha",
"Dad: Say, what was the title of the movie?",
"Spouse: 'Randy Staples Shares the Pain.' We saw all the build up, but missed the payoff.",
@ -250,65 +250,65 @@ var story = { @@ -250,65 +250,65 @@ var story = {
"Grandma: No, not taking a taxi out to dinner. Forget it. Just forget it."],
"Girlfriend's Boba Keeps on a-flowing":
["Spouse: You know what boba is right Mom?",
["Girlfriend: You know what boba is right Mom?",
"Mom: What's Boba?",
"Spouse: Ok, I guess not.",
"Girlfriend: Ok, I guess not.",
"Grandma: What's booba?",
"Spouse: I take it you mean boba?",
"Girlfriend: I take it you mean boba?",
"Grandma: Yes, that thing.",
"Spouse: What most people talk about when they mean 'boba' are tea drinks with milk in them.",
"Spouse: The boba tea drinks are not hard to make, just make black tea, and then add any kind of milk you have, some sweetener, then chill with ice.",
"Spouse: [Player] and I made it at home one time, but that's another story. Anyways, the 'boba' itself are these little black balls that are made out of sweet potato.",
"Girlfriend: What most people talk about when they mean 'boba' are tea drinks with milk in them.",
"Girlfriend: The boba tea drinks are not hard to make, just make black tea, and then add any kind of milk you have, some sweetener, then chill with ice.",
"Girlfriend: [Player] and I made it at home one time, but that's another story. Anyways, the 'boba' itself are these little black balls that are made out of sweet potato.",
"Dad: Sweet Potatoes, like a yam?",
"Brother: Dad, you know that sweet potatoes and yams are not the same right?",
"Dad: What? They aren't?",
"Brother: No",
"Dad: Well, what's the difference?",
"Brother: I don't know, but the point is they are different.",
"Spouse: Boba is usually made from sweet potatoes, but it can also be made from other starchy materials, I suppose.",
"Girlfriend: Boba is usually made from sweet potatoes, but it can also be made from other starchy materials, I suppose.",
"Dad: What's it taste like? Kind of...potatoey?",
"Spouse: Not really, it is chewy, a bit like... when you take the first bite into some gum. Right before it gets soft.",
"Spouse: Though when places heat it up, it is really soft and moldable.",
"Girlfriend: Not really, it is chewy, a bit like... when you take the first bite into some gum. Right before it gets soft.",
"Girlfriend: Though when places heat it up, it is really soft and moldable.",
"Grandma: Hmm. I wouldn't mind trying this boba sometime.",
"Spouse: You definitely should since I know you like your morning tea.",
"Spouse: Now that you all know what boba is, I can tell you about this cool, and somewhat awkward event that happened.",
"Spouse: [Player] and I were driving down the freeway when we remembered that a new boba place was opening up on Teller St.",
"Spouse: As part of their opening promotion, they were offering one free boba drink per customer.",
"Spouse: Since I was thirsty, I suggested we drop by and see what's up.",
"Spouse: We parked and walk up to the building. There weren't too many people about, and a sign revealed why.",
"Spouse: The free boba promotion ended at 8PM, and it was already 10!",
"Girlfriend: You definitely should since I know you like your morning tea.",
"Girlfriend: Now that you all know what boba is, I can tell you about this cool, and somewhat awkward event that happened.",
"Girlfriend: [Player] and I were driving down the freeway when we remembered that a new boba place was opening up on Teller St.",
"Girlfriend: As part of their opening promotion, they were offering one free boba drink per customer.",
"Girlfriend: Since I was thirsty, I suggested we drop by and see what's up.",
"Girlfriend: We parked and walk up to the building. There weren't too many people about, and a sign revealed why.",
"Girlfriend: The free boba promotion ended at 8PM, and it was already 10!",
"Mom: Aww, that's too bad",
"Spouse: I decided to get a drink anyways.",
"Spouse: But when I ordered, the worker said 'Would you like to try one of our free drinks?', and motioned towards the sign.",
"Spouse: 'Sure!', Then he asked [Player] what [GenderPronoun] wanted.",
"Spouse: So we both got a full-sized free drink!",
"Girlfriend: I decided to get a drink anyways.",
"Girlfriend: But when I ordered, the worker said 'Would you like to try one of our free drinks?', and motioned towards the sign",
"Girlfriend: 'Sure!', Then he asked [Player] what [GenderPronoun] wanted.",
"Girlfriend: So we both got a full-sized free drink!",
"Mom: What flavor did you get? I assume there are flavors of boba?",
"Spouse: Yes, there are. I ordered Strawberry. It tasted ok, but was really missing that strawberry flavor.",
"Spouse: The worker asked how they were, and well Mom, you raised me to be an honest individual, so it was lacking in flavor.",
"Spouse: So the worker says, 'Alright, let me make you another one'",
"Spouse: He makes me a completely new boba drink, while letting me keep the old one to drink. At this point I haven't even paid for anything yet.",
"Girlfriend: Yes, there are. I ordered Strawberry. It tasted ok, but was really missing that strawberry flavor.",
"Girlfriend: The worker asked how they were, and well Mom, you raised me to be an honest individual, so it was lacking in flavor.",
"Girlfriend: So the worker says, 'Alright, let me make you another one'",
"Girlfriend: He makes me a completely new boba drink, while letting me keep the old one to drink. At this point I haven't even paid for anything yet",
"Dad: That's just good customer service. Since this place is new, he is trying to build up customer relations.",
"Spouse: True, but I feel like it got a little out of hand. The next drink also lacked the strawberry flavor. The worker said it is probably because of the syrup.",
"Spouse: He then proceeded to make another drink, still free, using fresh strawberries in lieu of the syrup flavoring.",
"Spouse: Now the syrup drinks were probably really cheap to make, but making drinks with real fruit costs considerably more.",
"Spouse: By the end of our time at the place, the two of us had six drinks in hand without a cent spent.",
"Spouse: The worker just kept offering us samples and I felt really guilty about being so honest.",
"Spouse: I decided to order the drink I was originally going to get, even though I had consumed 2 whole boba drinks already. Sugar overload!",
"Girlfriend: True, but I feel like it got a little out of hand. The next drink also lacked the strawberry flavor. The worker said it is probably because of the syrup.",
"Girlfriend: He then proceeded to make another drink, still free, using fresh strawberries in lieu of the syrup flavoring.",
"Girlfriend: Now the syrup drinks were probably really cheap to make, but making drinks with real fruit costs considerably more.",
"Girlfriend: By the end of our time at the place, the two of us had six drinks in hand without a cent spent.",
"Girlfriend: The worker just kept offering us samples and I felt really guilty about being so honest.",
"Girlfriend: I decided to order the drink I was originally going to get, even though I had consumed 2 whole boba drinks already. Sugar overload!",
"Brother: I hope you left him a fat tip for his troubles.",
"Spouse: Yes, I tipped, [Player] made sure of that.",
"Spouse: With all the caffeine and sugar, I couldn't sleep all night. My heart was in trepidation even through the next morning.",
"Spouse: I probably wouldn't do that again.",
"Girlfriend: Yes, I tipped, [Player] made sure of that.",
"Girlfriend: With all the caffeine and sugar, I couldn't sleep all night. My heart was in trepidation even through the next morning.",
"Girlfriend: I probably wouldn't do that again.",
"Grandma: This sounds like the place I should try my first boba.",
"Spouse: I don't think I could boba for at least a month I'm so burnt out.",
"Girlfriend: I don't think I could boba for at least a month I'm so burnt out.",
"Brother: It is settled, right after this meal we're all going out for boba.",
"Spouse: Hah, no.",
"Girlfriend: Hah, no.",
"Brother: No, seriously.",
"Spouse: And seriously. No"],
"Girlfriend: And seriously. No"],
"Grandmother reveals the virtues of the bread line":
["Brother: The Turkey is taking a while to cook. [Player] isn't too good at cooking is [GenderPronoun]?",
"Spouse: How dare you talk about [Player] like that. [Player] is a great cook. You'll see!",
"Girlfriend: How dare you talk about [Player] like that. [Player] is a great cook. You'll see!",
"Grandma: You guys have it lucky. Where I grew up we had bread lines.",
"Grandma: My family would stand in a bread line for over six hours with the POSSIBILITY of receiving a loaf of bread.",
"Grandma: I remember one particular occasion where my mom told me to take my baby sister with me and go stand in the bread line.",
@ -327,7 +327,7 @@ var story = { @@ -327,7 +327,7 @@ var story = {
"Dad: It wasn't a meeting, it was closer to a seminar.",
"Dad: At work, we accrue credits that can be put towards educational events. Our managers think that an educated workforce is a happy and productive workforce.",
"Dad: So we are required to spend these credits every year on our choice of relevant education events.",
"Spouse: That's cool. What kind of choices for educational events are there?",
"Girlfriend: That's cool. What kind of choices for educational events are there?",
"Dad: As one example, employees can go to a local college or high school and present about their work at the company.",
"Dad: Other options are to attend talks about various topics, such as aerospace engineering, materials science, manager relations, customer relations, etc.",
"Dad: I decided to spend my credits on a five person panel from the various automotive manufacturers about the future of automated vehicles.",
@ -346,14 +346,14 @@ var story = { @@ -346,14 +346,14 @@ var story = {
"Grandpa: Enjoy your fandangled self-driving cars, if they ever come.",
"Grandpa: In the 1960s they used to say we'd have flying cars in the 2000s, but you don't see that now.",
"Brother: Maybe in my generation. First the self-driving cars, then the flying ones.",
"Cat: Meow (And then the world!)"],
"Cat: Meow (and then the world!)"],
"Brother recounts a hockey game he saw recently, and his friend has to go to the hospital":
["Brother: Yo, I watched a hockey game recently. There were cheap group tickets, so a bunch of my friends jumped on it to watch the game.",
"Spouse: Who was playing?",
"Girlfriend: Who was playing?",
"Brother: Some minor league team, the 'Raging Tornados', I believe? It isn't important. The point is seeing two teams pummel each other over a little puck.",
"Grandpa: Yes, exactly!",
"Spouse: I suppose since we're glorifying the violence of the sport, were there any fights?",
"Girlfriend: I suppose since we're glorifying the violence of the sport, were there any fights?",
"Brother: Ah hell yeah! The gloves were thrown to the ice, and the two players starting man-hugging each other.",
"Brother: The refs just let it go. There was no blood, but it was the intention that mattered.",
"Brother: Sadly, it isn't like some video games where the winner of the fight gets to stay on the ice. The perpetrator in this case got the penalty.",
@ -367,7 +367,7 @@ var story = { @@ -367,7 +367,7 @@ var story = {
"Brother: Yeah, they were fine. They decided to go home however. Too much trauma. They would be flinching with every one-timer during the game.",
"Mom: Aww, that's a shame. It wasn't Charles was it? Poor Charles...",
"Brother: No, Mom, Charles is fine.",
"Spouse: Close game?",
"Girlfriend: Close game?",
"Brother: Hardly. 3-0",
"Brother: The tornado mascot kept it interesting though, with his kazoo.",
"Brother: 'Bzzzwoooooo'",
@ -389,16 +389,16 @@ var story = { @@ -389,16 +389,16 @@ var story = {
"Brother: But, it was definitely a lot of fun to watch."],
"Mom talks about her students and reading over summer vacation":
["Spouse: Well Mom, how are your students doing?",
["Girlfriend: Well Mom, how are your students doing?",
"Mom: Thank you for asking. They are doing well.",
"Brother: Still teaching the third grade?",
"Mom: Yessum",
"Spouse: Soo, lay on the juicy stories.",
"Girlfriend: Soo, lay on the juicy stories.",
"Mom: Mmmm, well, for the winter break coming up I'm planning on having them read 'The BFG'.",
"Spouse: oooh, I liked that book.",
"Girlfriend: oooh, I liked that book.",
"Brother: Mom, winter break reading is THE reason that students hate their teachers. Can't you let them enjoy their break in peace?",
"Mom: But reading is fundamental. We can't let our students forget what they learned.",
"Spouse: It isn't that bad, 'The BFG' is a fun and entertaining book.",
"Girlfriend: It isn't that bad, 'The BFG' is a fun and entertaining book.",
"Brother: Granted, but forcing one to read kills their love of reading. It did for me.",
"Brother: After I began reading for fun rather than the school forcing me to do it, I could really appreciate the work for what they are.",
"Mom: Greg, you are right. But you have to remember that if we don't force kids to do a little reading, they may not do the reading at all.",
@ -427,10 +427,10 @@ var story = { @@ -427,10 +427,10 @@ var story = {
"Brother: Whaat? I'm named after your former lover?! Did you know about this Dad?!",
"Dad: Yes, but what's the big deal? I still like the name Greg. It's a good strong name.",
"Brother: I don't think I'll be able to think about my name the same way ever again.",
"Spouse: Hah ha brother. Sucks to be you. Hah ha!",
"Spouse: But please Mom and Dad, don't tell ever me how I got my name.",
"Girlfriend: Hah ha brother. Sucks to be you. Hah ha!",
"Girlfriend: But please Mom and Dad, don't tell ever me how I got my name.",
"Mom: Ooh, but your name origin is quite special.",
"Spouse: La la la, I'm not listening!"],
"Girlfriend: La la la, I'm not listening!"],
"Grandparents sings a Patriotist song":
["Grandpa: Since dinner is taking a while, it seems like a good time for a song don't you think?",
@ -439,42 +439,42 @@ var story = { @@ -439,42 +439,42 @@ var story = {
"Grandpa: All puffed up like a great big frog",
"Grandpa: Sneaked up close and stuck him with a wire",
"Grandpa: And he just went poof like an old flat tire.",
"Grandpa: Took his hide and hung it on a tree,",
"Grandpa: And he said 'hey don't do that to me' ",
"Grandpa: So I took it on home to my mother in law",
"Grandpa: took his hide and hung it on a tree,",
"Grandpa: and he said 'hey don't do that to me' ",
"Grandpa: so I took it on home to my mother in law",
"Grandpa: She threw me outside with the Turkey in the Straw",
"Grandma: Oooooh Adolf Hitler grabbed a tail,",
"Grandma: And he hung right on with tooth and nail,",
"Grandma: and he saw what he had and he began to swear,",
"Grandma: On the end of the tail was a Russian bear,",
"Grandpa: The old bear growled and started in to shake,",
"Grandma: Oooooh Adolf Hitler grabbed a tail, ",
"Grandma: And he hung right on with tooth and nail, ",
"Grandma: and he saw what he had and he began to swear, ",
"Grandma: On the end of the tail was a Russian bear, ",
"Grandpa: The old bear growled and started in to shake, ",
"Grandma: Adolf knew he'd made a big mistake.",
"Grandpa: He tried to hang on and he tried to let go ",
"Grandma: Now they have a new dance called Hitler in the snow. ",
"Grandpa: Wow, I didn't know you knew that one. ",
"Grandma: Word travels fast on the front. Just don't let the officers hear you singing it or they'll whoop your ass faster than you can say vodka. ",
"Grandpa: Advice to keep close at heart."],
"Grandpa: Advice to keep close at heart. "],
"Dad Tells a Bad Dad Joke":
["Dad: Hey guys, what's the key to a great Thanksgiving dinner?",
"Mom: Of course it is the loving family?",
"Brother: I bet it is the pillowy mounds of mashed potatoes.",
"Spouse: It is the turkey right?",
"Girlfriend: It is the turkey right?",
"Dad: That's right, its the turKEY",
"Dad: turKEY, get it?",
"Spouse: What?",
"Girlfriend: What?",
"Dad: The KEY to a great thanksgiving dinner is the turKEY.",
"Spouse: Aww, come on Dad. That's terrible.",
"Girlfriend: Aww, come on Dad. That's terrible.",
"Grandma: Is this a joke?",
"Dad: Yes Mom,",
"Grandma: Well, what do you mean 'key'.",
"Dad: 'Key', as in, characteristic, identifying.",
"Grandma: Well, what do you mean 'key' .",
"Dad: A 'key', something that is of vital importance.",
"Grandma: hmmm, ok. I think I get it.",
"Dad: Ok...."],
"Mom Butter Story":
["Mom: My favorite color is butter.",
"Spouse: That's cool."],
"Girlfriend: That's cool."],
"Cat Story":
["Cat: Meow Meow Meow Meow Meow",
@ -482,19 +482,19 @@ var story = { @@ -482,19 +482,19 @@ var story = {
"Cat: Meow",
"Mom: Look at it, poor thing wants some turkey!",
"Cat: Meow",
"Cat: (If you turn the oven past 1000 degrees, something fun happens!)"],
"Cat: (Translation) If you turn the oven past 1000 degrees, something fun happens!"],
"Cat Story II":
["Cat: Meow Meow Meow!",
"Mom: What is it, sweetie?",
"Cat: Meow Meow Meow!",
"Cat: (Why aren't we cooking fish? I want fish for dinner.)",
"Cat: (Translation) Why aren't we cooking fish? I want fish for dinner.",
"Mom: Yes sweetie, that's an oven with a turkey inside! We're going to have a nice dinner.",
"Cat: Meow",
"Cat: (It's like you don't love me anymore.)",
"Cat: (Translation) It's like you don't love me anymore.",
"Mom: It'll be done very soon, I promise! You can have a few bites.",
"Cat: Meow Meow Meow Meow!",
"Cat: (I don't want turkey, I want fish!)"],
"Cat: (Translation) I don't want turkey, I want fish!"],
"Mom Talks About Her Bathroom Policy and her Students":
@ -509,7 +509,7 @@ var story = { @@ -509,7 +509,7 @@ var story = {
"Mom: But then the administration told me that all students were required to have a bathroom pass. Too many students were skipping class they feared.",
"Mom: I never lost a student and all my students knew not to abuse their privileges, but I did as I was told.",
"Mom: I made sure students signed themselves out, wrote their name, signed it, then took the bathroom pass.",
"Spouse: That seems very efficient. But are the third graders mature enough to get themselves to the bathroom and not goof off?",
"Girlfriend: That seems very efficient. But are the third graders mature enough to get themselves to the bathroom and not goof off?",
"Mom: Well, every student has their 20 minutes. I don't want to parent them. That's not my job. My job is to teach lessons.",
"Mom: It seemed to work well. None of my students abused the system.",
"Mom: But it seemed the administration didn't appreciate the system. They changed the rules once again.",
@ -553,35 +553,35 @@ var story = { @@ -553,35 +553,35 @@ var story = {
"Grandpa: Field medics couldn't get all the pieces out, and we were at least two days away from a decent hospital.",
"Grandpa: The ear got infected and Jimmy lost his hearing soon after.",
"Grandpa: 'Bug Brain' we used to call him. Great guy.",
"Spouse: I'm sorry to hear that.",
"Girlfriend: I'm sorry to hear that.",
"Grandpa: Can't undo the past. Those dang bugs were everywhere though.",
"Mom: Gross, Gross, Gross. ",
"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 Spouse's teacher that makes buzzer noises when you got something wrong":
["Spouse: Greg, here's something that might tinkle your fancy.",
"Spouse: I saw my old professor from a couple years back, Professor Ronfleur. The Humanities teacher. Do you remember him?",
"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?",
"Spouse: Ha-ha, no, but that's why I brought it up. That buzz!",
"Girlfriend: Ha-ha, no, but that's why I brought it up. That buzz!",
"Mom: What buzz?",
"Spouse: I guess we never told you Mom. Remember when we took that humanities class at the local community college during the summer?",
"Spouse: We were trying to get the lower division English requirements out the way so could take classes at college that were actually worth our time.",
"Spouse: This Professor Ronfleur used to make a buzzing sound whenever anybody got something wrong.",
"Spouse: 'In what way does Aristotle disagree with Plato's Allegory of the Cave?' and then...",
"Spouse: BRRZZZZZZZT!",
"Spouse: He would make this super nasally buzzing noise.",
"Girlfriend: I guess we never told you Mom. Remember when we took that humanities class at the local community college during the summer?",
"Girlfriend: We were trying to get the lower division English requirements out the way so could take classes at college that were actually worth our time.",
"Girlfriend: This Professor Ronfleur used to make a buzzing sound whenever anybody got something wrong.",
"Girlfriend: 'In what way does Aristotle disagree with Plato's Allegory of the Cave?' and then...",
"Girlfriend: BRRZZZZZZZT!",
"Girlfriend: He would make this super nasally buzzing noise.",
"Brother: Seriously! Whenever I see the guy, I can just imagine pressing his bow tie and a buzzing noise coming out.",
"Spouse: And he did it ALL. THE. TIME.",
"Girlfriend: And he did it ALL. THE. TIME.",
"Brother: Yeah! Did he say anything to you when he saw you?",
"Spouse: I said hello and introduced myself, but he didn't know me. Just gave me the glazed ham eye look.",
"Girlfriend: I said hello and introduced myself, but he didn't know me. Just gave me the glazed ham eye look.",
"Brother: Glazed ham?",
"Spouse: For Thanksgiving.",
"Girlfriend: For Thanksgiving.",
"Brother: He gave you the glazed turkey look.",
"Spouse: Exactly."],
"Girlfriend: Exactly."],
"Brother's Fiancee is on Business Trip":
["Mom: Greg, where's your fiancee? Why didn't you invite her over for Thanksgiving dinner?",
["Mom: Greg, where's your fiancée? Why didn't you invite her over for Thanksgiving dinner?",
"Brother: I did invite her, but she couldn't make it. She is on a business trip and could not get the time off.",
"Mom: A business trip on Thanksgiving? But Thanksgiving only happens once per year! This is the perfect time to rekindle the spirit of family.",
"Brother: I know Mom, but Thanksgiving doesn't happen everywhere, and her job in sales demands that she travel abroad to meet with potential clients in person.",
@ -592,8 +592,8 @@ var story = { @@ -592,8 +592,8 @@ var story = {
"Brother: uh, well yeah, sure Mom. You can come and visit.",
"Grandpa: What!? I want to come and see your new place too.",
"Brother: Sure...yeah ok.",
"Spouse: You aren't going to invite me?",
"Brother: Yes, definitely. Everyone can come and visit. Just... I don't want to stress out my fiancee when she comes home.",
"Girlfriend: You aren't going to invite me?",
"Brother: Yes, definitely. Everyone can come and visit. Just... I don't want to stress out my fiancée when she comes home.",
"Brother: She likes to relax at home.",
"Mom: Don't worry honey, we won't stress her out. I'll make her my delicious breakfast omelet.",
"Grandpa: And I'll tell her my war stories.",
@ -604,15 +604,15 @@ var story = { @@ -604,15 +604,15 @@ var story = {
"Turkey: Male turkeys like their snood intact to attract a mate, and for dominance. Be kind to your turkey. Do not lose the snood."],
"Turkey Fact - Cat Puns":
["Turkey: Gobble Gobble. I suppose it is too late to ask you not to eat me. But is it too late to ask for you to kick that cat?",
["Turkey: Gobble Gobble. I suppose it is too late to ask you not to eat me. But is it too late to ask for you to kick that cat of yours?",
"Cat: Hey Turkey, it has been a long time. I see you're dead.",
"Turkey: Kasey, how dare you speak to me. First, you steal my plans for world domination and now you gloat at my passing. For shame.",
"Cat: It isn't my fault you taste so delicious. I'm going to delight in eating your flesh. Maybe if I beg enough they may give me your head on a platter.",
"Cat: It isn't my fault you taste so delicious. I'm going to delight in eating your flesh. Maybe if I beg enough they may give me your head on a platter",
"Turkey: Oooh, don't get me fired up.",
"Cat: Meow meow meow! The oven is doing that quite nicely.",
"Turkey: Ga-Gobble!",
"Cat: Meow Meow",
"Dad: Aww Kasey, aren't you a cute little kitty."],
"Dad: Aww Kasey, can't you a cute little kitty."],
"Turkey Fact - Wattle":
["Turkey: Hey, it is time for another turkey fact.",
@ -656,8 +656,8 @@ var story = { @@ -656,8 +656,8 @@ var story = {
"Turkey: That's because a group of turkeys is called a gang.",
"Turkey: A turkey group may also be called a rafter.",
"Turkey: I'm more of a kayaker personally.",
"Cat: Get meowta here.",
"Turkey: That pun was fowl.",
"Cat: Get meowta here",
"Turkey: That pun was fowl",
"Cat: Purrrsonally, not as bad as yours.",
"Turkey: Gobble Gobble"]

186
js/ui.js

@ -51,17 +51,16 @@ function HelpUI( stage, gameState ){ @@ -51,17 +51,16 @@ function HelpUI( stage, gameState ){
new createjs.Bitmap("res/screens/HelpCreditsScreen/HelpP1P2.png"),
new createjs.Bitmap("res/screens/HelpCreditsScreen/HelpP3P4.png"),
new createjs.Bitmap("res/screens/HelpCreditsScreen/HelpP5P6.png"),
new createjs.Bitmap("res/screens/HelpCreditsScreen/HelpP7P8.png"),
new createjs.Bitmap("res/screens/HelpCreditsScreen/HelpP9P10.png")
new createjs.Bitmap("res/screens/HelpCreditsScreen/HelpP7P8.png")
];
var position = 100;
var position = 0;
var helpImg = helpPages[0];
var closeButton = new Button( stage, gameState, 708, 8, 80, 50,null, null, function(){ that.hideHelp(); } );
var nextButton = new Button( stage, gameState, 645, 543, 80, 50, null,null, function(){ gameState.pubsub.publish("Play", "Open_Cookbook");
if( helpImg ){
position++;
helpImg.visible = false;
helpImg = helpPages[ Math.abs(position) % 5 ];
helpImg = helpPages[ position % 4 ];
helpImg.visible = true;
} else{
that.hideHelp();
@ -71,7 +70,7 @@ function HelpUI( stage, gameState ){ @@ -71,7 +70,7 @@ function HelpUI( stage, gameState ){
if( helpImg ){
position--;
helpImg.visible = false;
helpImg = helpPages[ Math.abs(position) % 5 ];
helpImg = helpPages[ Math.abs(position) % 4 ];
helpImg.visible = true;
} else {
that.hideHelp();
@ -270,10 +269,6 @@ function CookbookUI( stage, gameState ){ @@ -270,10 +269,6 @@ 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 scrollUpBtn = new Button( stage, gameState, 710, 80, 100, 50, null, null, function(){that.scrollUp();} );
var scrollDownBtn = new Button( stage, gameState, 710, 540, 100, 50, null, null, function(){that.scrollDown();} );
var turkeyTypeText = new createjs.Text("", "18px Arial", "black" );
turkeyTypeText.x = 535;
turkeyTypeText.y = 56;
@ -281,63 +276,24 @@ function CookbookUI( stage, gameState ){ @@ -281,63 +276,24 @@ function CookbookUI( stage, gameState ){
var turkeyWeightText = new createjs.Text("", "18px Arial", "black" );
turkeyWeightText.x = 553;
turkeyWeightText.y = 85;
var hiddenEntries = [];
var logEntries = [];
var logEntries = [];
this.hideCookbook = function(){
stage.removeChild( closeButton );
stage.removeChild( cookbookImg );
stage.removeChild( scrollUpBtn );
stage.removeChild( scrollDownBtn );
stage.removeChild( turkeyTypeText );
stage.removeChild( turkeyWeightText );
stage.removeChild(turkeyWeightText);
for( i in logEntries ){
stage.removeChild(logEntries[i]);
}
for( i in hiddenEntries ){
stage.removeChild(hiddenEntries[i]);
}
that.showingCookbook = false;
gameState.pubsub.publish("Play", "Close_Cookbook");
}
this.scrollDown = function(){
// move to hidden list
if( logEntries.length > 1 ){
// Move all entries up by 50 pixels
for( i in logEntries ){
logEntries[i].y -= 50;
}
var topEntry = logEntries.shift();
topEntry.alpha = 0;
hiddenEntries.push( topEntry );
}
}
this.scrollUp = function(){
// pop and fill in top
if( hiddenEntries.length > 0 ){
var topEntry = hiddenEntries.pop();
topEntry.alpha = 1;
logEntries.unshift( topEntry );
// shift everything down by 50 pixels
for( i in logEntries ){
logEntries[i].y += 50;
}
}
}
// Show core temperature
this.showCookbook = function(){
if( !that.showingCookbook ){
// TODO: So this object is actually persistent: we should not remove/add children, just hide stuff visually
logEntries = [];
stage.addChild( cookbookImg );
stage.addChild( closeButton );
@ -357,13 +313,9 @@ function CookbookUI( stage, gameState ){ @@ -357,13 +313,9 @@ function CookbookUI( stage, gameState ){
logEntries.push(logLine);
stage.addChild(logLine);
}
stage.addChild(turkeyTypeText);
stage.addChild(turkeyWeightText);
stage.addChild(scrollUpBtn);
stage.addChild(scrollDownBtn);
that.showingCookbook = true;
}
}
@ -524,7 +476,7 @@ function OvenUI( stage, gameState ){ @@ -524,7 +476,7 @@ function OvenUI( stage, gameState ){
gameState.pubsub.publish("Death","");
gameState.pubsub.publish( "ShowDialog", {seq:"custom", autoAdvance:true, customText:evalSkin[turkeyState["skin"]["cond"][2]] + "." } );
gameState.pubsub.publish( "AddRecord", {type:"Open ", text:"The turkey looked " + turkeyState["skin"]["cond"][2]} );
gameState.ovenModel.setRawTemp( (gameState.ovenModel.getRawTemp() - 3 ) < 20 ? 20 : gameState.ovenModel.getRawTemp() - 3 );
//gameState.ovenModel.setRawTemp( (gameState.ovenModel.getRawTemp() - 25) < 150 ? 150 : gameState.ovenModel.getRawTemp() - 25 );
gameState.ovenOpened++;
}
@ -596,15 +548,8 @@ function OvenUI( stage, gameState ){ @@ -596,15 +548,8 @@ function OvenUI( stage, gameState ){
this.secondTick = function(diff){
// check if oven door is open
if( that.ovenDoor == OVEN_OPEN ){
gameState.ovenModel.setRawTemp( (gameState.ovenModel.getRawTemp() - 1 ) < 20 ? 20 : gameState.ovenModel.getRawTemp() - 1 );
}
gameState.ovenModel.secondTick();
gameState.currentTime += diff;
if( gameState.turkeyBought ){
gameState.turkeyCookCounter++;
}
}
gameState.pubsub.subscribe( "SkipTime", function(){
@ -626,6 +571,7 @@ function OvenUI( stage, gameState ){ @@ -626,6 +571,7 @@ function OvenUI( stage, gameState ){
that.secondTick( diff );
if( gameState.turkeyBought ){
gameState.turkeyCookCounter++;
// what's the state of the turkey
turkeyState = gameState.ovenModel.getTurkeyState();
gameState.turkeyStates[0].alpha = 1;
@ -685,10 +631,6 @@ function OvenUI( stage, gameState ){ @@ -685,10 +631,6 @@ function OvenUI( stage, gameState ){
//finalize button
if( gameState.turkeyBought ){
stage.addChild( new Button( stage, gameState, 45, 250, 250, 150, null, null, function(){
if(!evalSkin[turkeyState["skin"]["cond"][2]]){
gameState.pubsub.publish("Death","");
return;
}
gameState.pubsub.publish("Play", "Error");
gameState.pubsub.publish("ShowFinalConfirm","");
} ) );
@ -720,140 +662,68 @@ function OvenUI( stage, gameState ){ @@ -720,140 +662,68 @@ function OvenUI( stage, gameState ){
function WindowUI( stage, gameState ){
var dayNight = new createjs.Bitmap("res/screens/Window/Test4-217.png");
var mood = new createjs.Bitmap("res/screens/Window/Test4TransparencyFull.png");
var smallWindows= [ new createjs.Bitmap("res/screens/Window/Small1.png"),
new createjs.Bitmap("res/screens/Window/Small2.png"),
new createjs.Bitmap("res/screens/Window/Small3.png"),
new createjs.Bitmap("res/screens/Window/Small4.png"),
new createjs.Bitmap("res/screens/Window/Small5.png")
];
var windows= [ new createjs.Bitmap("res/screens/Window/Win1.png"),
new createjs.Bitmap("res/screens/Window/Win2.png"),
new createjs.Bitmap("res/screens/Window/Win3.png"),
new createjs.Bitmap("res/screens/Window/Win4.png"),
new createjs.Bitmap("res/screens/Window/Win5.png"),
new createjs.Bitmap("res/screens/Window/Win6.png"),
new createjs.Bitmap("res/screens/Window/Win7.png"),
new createjs.Bitmap("res/screens/Window/Win8.png"),
new createjs.Bitmap("res/screens/Window/Win9.png"),
new createjs.Bitmap("res/screens/Window/Win10.png"),
new createjs.Bitmap("res/screens/Window/Win11.png")
];
var dayNight = new createjs.Bitmap("res/screens/Window/Test4-217.svg");
var mood = new createjs.Bitmap("res/screens/Window/Test4TransparencyFull.svg");
mood.y=30;
dayNight.y=30;
var secondCounter = 0;
var newpos = -(new Date( gameState.currentTime ).getHours()*682.625);
mood.x = dayNight.x = newpos < -15583 ? 0 : newpos;
mood.x = dayNight.x = -(new Date( gameState.currentTime ).getHours()*682.625);
var ground = new createjs.Bitmap( "res/screens/Window/Ground.png" );
var houses = new createjs.Bitmap( "res/screens/Window/Housefar.png" );
var streetLight = new createjs.Bitmap( "res/screens/Window/StreetlightGlow.png" );
streetLight.alpha = 1;
var stars = new createjs.Bitmap( "res/screens/Window/Stars.png" );
stars.alpha = 1;
streetLight.alpha = 0;
var treeAnimations = { rustle:{ frames:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17], next:false } };
var treeAnimations = { rustle:[0,17,"rustle"], still:[0,0,"still"] };
var data = {
images: ["res/screens/Window/Tree_Animation.png"],
frames: { width:386, height:287 },
animations: treeAnimations
};
var spriteSheet = new createjs.SpriteSheet(data);
var animation = new createjs.Sprite(spriteSheet);
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);
dayNight.x = mood.x = newpos < -15583 ? 0 : newpos;
dayNight.x = mood.x =newpos < -15583 ? 0 : newpos;
});
stage.addChild( dayNight );
stage.addChild( ground );
stage.addChild( houses );
stage.addChild( stars );
stage.addChild( streetLight );
stage.addChild( animation );
stage.addChild( mood );
for( var i in smallWindows ){
smallWindows[i].visible = UtilityFunctions.randRange(0,1);
stage.addChild( smallWindows[i] );
}
for( var i in windows ){
windows[i].visible = UtilityFunctions.randRange(0,1);
stage.addChild( windows[i] );
}
stage.addChild( streetLight );
return {
tick: function(){
// move the sky
secondCounter++;
if( secondCounter > 600 ){
if( secondCounter > 60 ){
dayNight.x-=11.38;
mood.x -= 11.38;
secondCounter = 0;
// move tree sometimes
if( UtilityFunctions.randRange(0,1) )
animation.gotoAndPlay("rustle");
// turn on lights
if( dayNight.x < 0 && dayNight.x > -4545 ){
for( var i in smallWindows ){
smallWindows[i].visible = UtilityFunctions.randRange(0,1);
}
for( var i in windows ){
windows[i].visible = UtilityFunctions.randRange(0,1);
}
// turn on random window lights
streetLight.alpha= 1;
stars.alpha = 1;
}
else if( dayNight.x < -11687 ){
for( var i in smallWindows ){
smallWindows[i].visible = UtilityFunctions.randRange(0,1);
}
for( var i in windows ){
windows[i].visible = UtilityFunctions.randRange(0,1);
}
streetLight.alpha= 1;
stars.alpha = 1;
}
// daytime, turn off all lights
else{
for( var i in smallWindows ){
smallWindows[i].visible = 0;
}
for( var i in windows ){
windows[i].visible = 0;
}
streetLight.alpha= 0;
stars.alpha = 0;
}
}
// if too many lights are causing an issue on your browser, turn them off
if( createjs.Ticker.getMeasuredFPS().toFixed(1) < 13 ){
for( var i in windows ){
windows[i].visible = 0;
}
}
if( dayNight.x < -15583 )
dayNight.x = 0;
// turn on lights
if( dayNight.x < 0 && dayNight.x > -4545 ){
// turn on random window lights
streetLight.alpha = 1;
}
else if( dayNight.x < -11687 ){
streetLight.alpha = 1;
}
else
streetLight.alpha = 0;
}
}
}
@ -959,7 +829,7 @@ function MarketItem( gameState, name, x, y, cost, mouseOutImg, mouseOverImg, mou @@ -959,7 +829,7 @@ 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 = 1.05;
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; }

BIN
res/screens/HelpCreditsScreen/Credits.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 433 KiB

After

Width:  |  Height:  |  Size: 473 KiB

BIN
res/screens/HelpCreditsScreen/HelpP1P2.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 278 KiB

After

Width:  |  Height:  |  Size: 276 KiB

BIN
res/screens/HelpCreditsScreen/HelpP3P4.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 319 KiB

After

Width:  |  Height:  |  Size: 319 KiB

BIN
res/screens/HelpCreditsScreen/HelpP5P6.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 327 KiB

After

Width:  |  Height:  |  Size: 324 KiB

BIN
res/screens/HelpCreditsScreen/HelpP7P8.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 304 KiB

After

Width:  |  Height:  |  Size: 308 KiB

BIN
res/screens/HelpCreditsScreen/HelpP9P10.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 295 KiB

BIN
res/screens/KitchenScreen/Cookbook-Open.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 298 KiB

After

Width:  |  Height:  |  Size: 333 KiB

BIN
res/screens/KitchenScreen/TurkeyState1Small.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

BIN
res/screens/KitchenScreen/TurkeyState2Small.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

BIN
res/screens/KitchenScreen/TurkeyState3Small.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

BIN
res/screens/KitchenScreen/TurkeyState4Small.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

BIN
res/screens/KitchenScreen/TurkeyState5Small.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

BIN
res/screens/Window/Housefar.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 61 KiB

BIN
res/screens/Window/Stars.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

BIN
res/screens/Window/Test4-217.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

BIN
res/screens/Window/Test4TransparencyFull.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

76
sim/TurkeySimulation.m

@ -1,76 +0,0 @@ @@ -1,76 +0,0 @@
%for blog: take pictures of graphs of inside and outsite tempurature vs
%time and oven temperature, also temperature vs radius of a properly cooked turkey.
tic
init=0;
if init == 0
clear all
weight = 15/2.2;%lbs
density = 800;
% r0=.15;
r0 = (weight/density/4*3/pi)^(1/3);
deltar=r0/30;
r=[deltar*1:deltar:r0];
alpha = .412/2800/1000;
h=9; %nusselt number
k=.412+r*0;
% weight = r0^3*4*pi/3*density;
Tinf=600;
Ti=20;
T=Ti+r*0;
waterlost=r*0;
% T(end)=T(end)+1;
end
deltat = .1;
time=.6*60*60/deltat;%minutes
Tcenterlog=zeros(1,time);
Tlog=Tcenterlog;
for i = 1:time
dTtemp = (T(3:end)-T(1:end-2))./(2*deltar); %only works if r is linear
dTdr= [(T(2)-T(1))/deltar, dTtemp, (T(end)-T(end-1))/deltar];
% dTdr = diff(T)./diff(r);
% dTdr(end+1)=dTdr(end);
dTdr(end)= h*(Tinf-T(end))/k(end);
parenthesis=dTdr.*r.^2;
dPtemp = (parenthesis(3:end)-parenthesis(1:end-2))./(2*deltar); %again, linear only
dPdr = [(parenthesis(2)-parenthesis(1))/deltar, dPtemp, (parenthesis(end)-parenthesis(end-1))/deltar];
% dPdr = diff(parenthesis)./diff(r);
% dPdr(end+1) = dPdr(end);
% % if kout > k(end)
% % k(end)=(kout-k(end))/3+k(end);
% % end
% kout=h*(Tinf-T(end))/dTdr(end);
% k(end)=kout;
alpha = k/2800/density;
dTdt=alpha.*dPdr./r.^2;
% dTdt(1)=dTdt(1)/2;
T=T+dTdt*deltat;
waterlost=waterlost+(10.^((T-20)/80)-1)/10;
% Tcenterlog(i)=T(1);
% Tlog(i)=T(end);
end
figure(1)
plot(r,(T*1.8+32))
figure(2)
plot(r,waterlost)
% cooktime=[1:time]*deltat/3600;
% figure(2)
% hold on
% plot(cooktime,Tcenterlog*1.8+32)
% plot(cooktime,Tlog*1.8+32)
% toc
Loading…
Cancel
Save