From 2682b732d885f277db70c09de623b7fd1a52e47a Mon Sep 17 00:00:00 2001 From: Robert Chen Date: Sat, 30 Nov 2013 22:48:15 -0800 Subject: [PATCH] Clean base commit --- README.md | 0 index.html | 27 + js/dialogue.js | 227 + js/main.js | 484 + js/model.js | 329 + js/screens.js | 657 + js/soundmanager.js | 112 + js/stories.js | 664 + js/ui.js | 935 ++ res/items/Alarm.png | Bin 0 -> 11669 bytes res/items/AlarmGlow.png | Bin 0 -> 13330 bytes res/items/Clipboard.png | Bin 0 -> 54358 bytes res/items/Cookbook.png | Bin 0 -> 26941 bytes res/items/Cookbook1.png | Bin 0 -> 27110 bytes res/items/Cookbook1Glow.png | Bin 0 -> 30148 bytes res/items/CookbookGlow.png | Bin 0 -> 29983 bytes res/items/ExitGlow.png | Bin 0 -> 11852 bytes res/items/ExitSign.png | Bin 0 -> 11131 bytes res/items/FrillsBox.png | Bin 0 -> 11560 bytes res/items/FrillsBoxGlow.png | Bin 0 -> 13575 bytes res/items/OvenLightBox.png | Bin 0 -> 17428 bytes res/items/OvenLightBoxGlow.png | Bin 0 -> 18357 bytes res/items/Price-Tag.png | Bin 0 -> 5637 bytes res/items/StuffingExquisite.png | Bin 0 -> 22741 bytes res/items/StuffingExquisiteGlow.png | Bin 0 -> 25200 bytes res/items/StuffingRepurposed.png | Bin 0 -> 20331 bytes res/items/StuffingRepurposedGlow.png | Bin 0 -> 23541 bytes res/items/StuffingSpecial.png | Bin 0 -> 25985 bytes res/items/StuffingSpecialGlow.png | Bin 0 -> 27907 bytes res/items/TempProbe.png | Bin 0 -> 15694 bytes res/items/TempProbeGlow.png | Bin 0 -> 17809 bytes res/items/Turkey1.png | Bin 0 -> 35374 bytes res/items/Turkey1Glow.png | Bin 0 -> 38640 bytes res/items/Turkey2.png | Bin 0 -> 27764 bytes res/items/Turkey2Glow.png | Bin 0 -> 30641 bytes res/items/Turkey3.png | Bin 0 -> 28321 bytes res/items/Turkey3Glow.png | Bin 0 -> 31168 bytes res/items/Turkey4.png | Bin 0 -> 19780 bytes res/items/Turkey4Glow.png | Bin 0 -> 22648 bytes res/items/Turkey5.png | Bin 0 -> 26362 bytes res/items/Turkey5Glow.png | Bin 0 -> 30549 bytes res/items/Wallet.png | Bin 0 -> 4037 bytes res/people/Boyfriend.png | Bin 0 -> 54877 bytes res/people/Brother.png | Bin 0 -> 61315 bytes res/people/Cat.png | Bin 0 -> 44636 bytes res/people/Dad.png | Bin 0 -> 60098 bytes res/people/Girlfriend.png | Bin 0 -> 59325 bytes res/people/Grandma.png | Bin 0 -> 63748 bytes res/people/Grandpa.png | Bin 0 -> 65294 bytes res/people/Mom.png | Bin 0 -> 71952 bytes res/people/PlayerFemale.png | Bin 0 -> 56556 bytes res/people/PlayerMale.png | Bin 0 -> 52196 bytes res/people/TurkeyGhost.png | Bin 0 -> 57263 bytes res/screens/DifficultyScreen/ButtonFemale.png | Bin 0 -> 19185 bytes res/screens/DifficultyScreen/ButtonMale.png | Bin 0 -> 18982 bytes .../DifficultyScreen/ButtonsandText.png | Bin 0 -> 106429 bytes .../DifficultyScreen/Difficulty-Selection.png | Bin 0 -> 579626 bytes res/screens/EndScreen/FrillsSmall.svg | 739 + res/screens/GUI/DialogueBox.png | Bin 0 -> 32935 bytes res/screens/HelpCreditsScreen/Credits.png | Bin 0 -> 484299 bytes res/screens/HelpCreditsScreen/HelpP1P2.png | Bin 0 -> 283132 bytes res/screens/HelpCreditsScreen/HelpP3P4.png | Bin 0 -> 326899 bytes res/screens/HelpCreditsScreen/HelpP5P6.png | Bin 0 -> 331627 bytes res/screens/HelpCreditsScreen/HelpP7P8.png | Bin 0 -> 314935 bytes res/screens/KitchenScreen/AlarmKitchen.png | Bin 0 -> 10440 bytes .../KitchenScreen/AlarmKitchenGlow.png | Bin 0 -> 13189 bytes res/screens/KitchenScreen/Cookbook-Open.png | Bin 0 -> 340555 bytes res/screens/KitchenScreen/CookbookKitchen.png | Bin 0 -> 32910 bytes .../KitchenScreen/CookbookKitchenGlow.png | Bin 0 -> 37129 bytes .../KitchenScreen/DoorClosedLightOff.png | Bin 0 -> 20581 bytes .../KitchenScreen/DoorClosedLightOn.png | Bin 0 -> 25380 bytes res/screens/KitchenScreen/DoorOpen.png | Bin 0 -> 41858 bytes .../KitchenScreen/DoorPeekLightOff.png | Bin 0 -> 17506 bytes res/screens/KitchenScreen/DoorPeekLightOn.png | Bin 0 -> 23143 bytes .../Explosion_AnimationLowRes.png | Bin 0 -> 4617817 bytes .../KitchenScreen/FinalConfirmation.png | Bin 0 -> 170459 bytes .../KitchenScreen/FrillsBoxKitchen.png | Bin 0 -> 17271 bytes .../KitchenScreen/FrillsBoxKitchenGlow.png | Bin 0 -> 20046 bytes res/screens/KitchenScreen/HouseFireRetry.png | Bin 0 -> 139994 bytes res/screens/KitchenScreen/KitchenScreen.png | Bin 0 -> 378352 bytes .../KitchenScreen/LightButtonDepressed.png | Bin 0 -> 6642 bytes .../KitchenScreen/OvenTurnRedState.png | Bin 0 -> 52075 bytes res/screens/KitchenScreen/PanFront.png | Bin 0 -> 8685 bytes res/screens/KitchenScreen/StoreBrochure.png | Bin 0 -> 41720 bytes .../KitchenScreen/StoreBrochureGlow.png | Bin 0 -> 44957 bytes .../StuffingExquisiteKitchen.png | Bin 0 -> 36179 bytes .../StuffingExquisiteKitchenGlow.png | Bin 0 -> 40893 bytes .../StuffingRepurposedKitchen.png | Bin 0 -> 25467 bytes .../StuffingRepurposedKitchenGlow.png | Bin 0 -> 30187 bytes .../KitchenScreen/StuffingSpecialKitchen.png | Bin 0 -> 33457 bytes .../StuffingSpecialKitchenGlow.png | Bin 0 -> 34664 bytes .../KitchenScreen/TempProbeKitchen.png | Bin 0 -> 22994 bytes .../KitchenScreen/TempProbeKitchenGlow.png | Bin 0 -> 26471 bytes res/screens/KitchenScreen/TurkeyState1.svg | 7695 +++++++++ .../KitchenScreen/TurkeyState1Small.svg | 587 + res/screens/KitchenScreen/TurkeyState2.svg | 9288 +++++++++++ .../KitchenScreen/TurkeyState2Small.svg | 632 + res/screens/KitchenScreen/TurkeyState3.svg | 9290 +++++++++++ .../KitchenScreen/TurkeyState3Small.svg | 671 + res/screens/KitchenScreen/TurkeyState4.svg | 10920 +++++++++++++ .../KitchenScreen/TurkeyState4Small.svg | 583 + res/screens/KitchenScreen/TurkeyState5.svg | 12955 ++++++++++++++++ .../KitchenScreen/TurkeyState5Small.svg | 596 + .../LoadingScreen/Loading-Title-Mockup.png | Bin 0 -> 331537 bytes res/screens/LoadingScreen/Loading-Title.png | Bin 0 -> 245448 bytes res/screens/LoadingScreen/PanFront.png | Bin 0 -> 17736 bytes res/screens/LoadingScreen/TextCooking.png | Bin 0 -> 10224 bytes res/screens/LoadingScreen/TextDone.png | Bin 0 -> 6945 bytes res/screens/LoadingScreen/Turkey0.png | Bin 0 -> 98054 bytes res/screens/LoadingScreen/Turkey25.png | Bin 0 -> 105400 bytes res/screens/LoadingScreen/Turkey50.png | Bin 0 -> 108407 bytes res/screens/LoadingScreen/Turkey75.png | Bin 0 -> 102873 bytes res/screens/LoadingScreen/TurkeyDone.png | Bin 0 -> 113444 bytes res/screens/MainScreen/ButtonCredits.png | Bin 0 -> 15003 bytes res/screens/MainScreen/ButtonHelp.png | Bin 0 -> 15586 bytes res/screens/MainScreen/ButtonStart.png | Bin 0 -> 14934 bytes res/screens/MainScreen/Grass.png | Bin 0 -> 331413 bytes res/screens/MainScreen/Main-Screen.png | Bin 0 -> 607669 bytes res/screens/MainScreen/TurkeySprite.png | Bin 0 -> 2074646 bytes res/screens/MarketScreen/MarketScreen.png | Bin 0 -> 530191 bytes res/screens/MarketScreen/MarketTopShelf.png | Bin 0 -> 96212 bytes .../ScoreScreen/Score-Evaluation-1.png | Bin 0 -> 281287 bytes .../ScoreScreen/Score-Evaluation-2.png | Bin 0 -> 285969 bytes res/screens/ScoreScreen/Score-Tally.png | Bin 0 -> 277769 bytes res/screens/Window/Door1.png | Bin 0 -> 4247 bytes res/screens/Window/Door2.png | Bin 0 -> 4229 bytes res/screens/Window/Ground.png | Bin 0 -> 60963 bytes res/screens/Window/Housefar.png | Bin 0 -> 62388 bytes res/screens/Window/Small1.png | Bin 0 -> 4495 bytes res/screens/Window/Small2.png | Bin 0 -> 4380 bytes res/screens/Window/Small3.png | Bin 0 -> 4349 bytes res/screens/Window/Small4.png | Bin 0 -> 4372 bytes res/screens/Window/Small5.png | Bin 0 -> 4441 bytes res/screens/Window/StreetlightGlow.png | Bin 0 -> 14829 bytes res/screens/Window/Test4-217.svg | 25 + res/screens/Window/Test4TransparencyFull.svg | 40 + res/screens/Window/Tree_Animation.png | Bin 0 -> 606747 bytes res/screens/Window/Win1.png | Bin 0 -> 5140 bytes res/screens/Window/Win10.png | Bin 0 -> 5140 bytes res/screens/Window/Win11.png | Bin 0 -> 5185 bytes res/screens/Window/Win2.png | Bin 0 -> 5141 bytes res/screens/Window/Win3.png | Bin 0 -> 5141 bytes res/screens/Window/Win4.png | Bin 0 -> 5143 bytes res/screens/Window/Win5.png | Bin 0 -> 5142 bytes res/screens/Window/Win6.png | Bin 0 -> 5140 bytes res/screens/Window/Win7.png | Bin 0 -> 5167 bytes res/screens/Window/Win8.png | Bin 0 -> 5185 bytes res/screens/Window/Win9.png | Bin 0 -> 5140 bytes res/sound/Audio Sources.txt | 35 + .../87564__sgak__fire Fire Start Louder.mp3 | Bin 0 -> 28608 bytes .../Events/Fire/87564__sgak__fire Loop.mp3 | Bin 0 -> 358224 bytes res/sound/GUI/buzz.mp3 | Bin 0 -> 8977 bytes res/sound/GUI/click.mp3 | Bin 0 -> 1982 bytes res/sound/GUI/ding.mp3 | Bin 0 -> 29304 bytes res/sound/GUI/lowclick.mp3 | Bin 0 -> 2086 bytes res/sound/GUI/pop.mp3 | Bin 0 -> 2817 bytes res/sound/Kitchen/Close_Cookbook.mp3 | Bin 0 -> 5496 bytes res/sound/Kitchen/Double_Beep.mp3 | Bin 0 -> 27035 bytes res/sound/Kitchen/Open_Cookbook.mp3 | Bin 0 -> 16128 bytes res/sound/Kitchen/Oven_Door_Full_Close.mp3 | Bin 0 -> 13009 bytes res/sound/Kitchen/Oven_Door_Full_Open.mp3 | Bin 0 -> 25925 bytes res/sound/Kitchen/Oven_Door_Peek_Close.mp3 | Bin 0 -> 12156 bytes res/sound/Kitchen/Oven_Door_Peek_Open.mp3 | Bin 0 -> 5764 bytes res/sound/Kitchen/sizzle.mp3 | Bin 0 -> 91128 bytes res/sound/Store/Waterford.mp3 | Bin 0 -> 359026 bytes res/sound/Store/buy.mp3 | Bin 0 -> 40428 bytes res/sound/Store/entrance.mp3 | Bin 0 -> 53832 bytes res/sound/Store/supermarket.mp3 | Bin 0 -> 134846 bytes res/sound/turkey_in_the_straw.mp3 | Bin 0 -> 1500946 bytes 169 files changed, 57491 insertions(+) mode change 100644 => 100755 README.md create mode 100755 index.html create mode 100755 js/dialogue.js create mode 100755 js/main.js create mode 100755 js/model.js create mode 100755 js/screens.js create mode 100755 js/soundmanager.js create mode 100755 js/stories.js create mode 100755 js/ui.js create mode 100755 res/items/Alarm.png create mode 100755 res/items/AlarmGlow.png create mode 100755 res/items/Clipboard.png create mode 100755 res/items/Cookbook.png create mode 100755 res/items/Cookbook1.png create mode 100755 res/items/Cookbook1Glow.png create mode 100755 res/items/CookbookGlow.png create mode 100755 res/items/ExitGlow.png create mode 100755 res/items/ExitSign.png create mode 100755 res/items/FrillsBox.png create mode 100755 res/items/FrillsBoxGlow.png create mode 100755 res/items/OvenLightBox.png create mode 100755 res/items/OvenLightBoxGlow.png create mode 100755 res/items/Price-Tag.png create mode 100755 res/items/StuffingExquisite.png create mode 100755 res/items/StuffingExquisiteGlow.png create mode 100755 res/items/StuffingRepurposed.png create mode 100755 res/items/StuffingRepurposedGlow.png create mode 100755 res/items/StuffingSpecial.png create mode 100755 res/items/StuffingSpecialGlow.png create mode 100755 res/items/TempProbe.png create mode 100755 res/items/TempProbeGlow.png create mode 100755 res/items/Turkey1.png create mode 100755 res/items/Turkey1Glow.png create mode 100755 res/items/Turkey2.png create mode 100755 res/items/Turkey2Glow.png create mode 100755 res/items/Turkey3.png create mode 100755 res/items/Turkey3Glow.png create mode 100755 res/items/Turkey4.png create mode 100755 res/items/Turkey4Glow.png create mode 100755 res/items/Turkey5.png create mode 100755 res/items/Turkey5Glow.png create mode 100755 res/items/Wallet.png create mode 100755 res/people/Boyfriend.png create mode 100755 res/people/Brother.png create mode 100755 res/people/Cat.png create mode 100755 res/people/Dad.png create mode 100755 res/people/Girlfriend.png create mode 100755 res/people/Grandma.png create mode 100755 res/people/Grandpa.png create mode 100755 res/people/Mom.png create mode 100755 res/people/PlayerFemale.png create mode 100755 res/people/PlayerMale.png create mode 100755 res/people/TurkeyGhost.png create mode 100755 res/screens/DifficultyScreen/ButtonFemale.png create mode 100755 res/screens/DifficultyScreen/ButtonMale.png create mode 100755 res/screens/DifficultyScreen/ButtonsandText.png create mode 100755 res/screens/DifficultyScreen/Difficulty-Selection.png create mode 100755 res/screens/EndScreen/FrillsSmall.svg create mode 100755 res/screens/GUI/DialogueBox.png create mode 100755 res/screens/HelpCreditsScreen/Credits.png create mode 100755 res/screens/HelpCreditsScreen/HelpP1P2.png create mode 100755 res/screens/HelpCreditsScreen/HelpP3P4.png create mode 100755 res/screens/HelpCreditsScreen/HelpP5P6.png create mode 100755 res/screens/HelpCreditsScreen/HelpP7P8.png create mode 100755 res/screens/KitchenScreen/AlarmKitchen.png create mode 100755 res/screens/KitchenScreen/AlarmKitchenGlow.png create mode 100755 res/screens/KitchenScreen/Cookbook-Open.png create mode 100755 res/screens/KitchenScreen/CookbookKitchen.png create mode 100755 res/screens/KitchenScreen/CookbookKitchenGlow.png create mode 100755 res/screens/KitchenScreen/DoorClosedLightOff.png create mode 100755 res/screens/KitchenScreen/DoorClosedLightOn.png create mode 100755 res/screens/KitchenScreen/DoorOpen.png create mode 100755 res/screens/KitchenScreen/DoorPeekLightOff.png create mode 100755 res/screens/KitchenScreen/DoorPeekLightOn.png create mode 100755 res/screens/KitchenScreen/Explosion_AnimationLowRes.png create mode 100755 res/screens/KitchenScreen/FinalConfirmation.png create mode 100755 res/screens/KitchenScreen/FrillsBoxKitchen.png create mode 100755 res/screens/KitchenScreen/FrillsBoxKitchenGlow.png create mode 100755 res/screens/KitchenScreen/HouseFireRetry.png create mode 100755 res/screens/KitchenScreen/KitchenScreen.png create mode 100755 res/screens/KitchenScreen/LightButtonDepressed.png create mode 100755 res/screens/KitchenScreen/OvenTurnRedState.png create mode 100755 res/screens/KitchenScreen/PanFront.png create mode 100755 res/screens/KitchenScreen/StoreBrochure.png create mode 100755 res/screens/KitchenScreen/StoreBrochureGlow.png create mode 100755 res/screens/KitchenScreen/StuffingExquisiteKitchen.png create mode 100755 res/screens/KitchenScreen/StuffingExquisiteKitchenGlow.png create mode 100755 res/screens/KitchenScreen/StuffingRepurposedKitchen.png create mode 100755 res/screens/KitchenScreen/StuffingRepurposedKitchenGlow.png create mode 100755 res/screens/KitchenScreen/StuffingSpecialKitchen.png create mode 100755 res/screens/KitchenScreen/StuffingSpecialKitchenGlow.png create mode 100755 res/screens/KitchenScreen/TempProbeKitchen.png create mode 100755 res/screens/KitchenScreen/TempProbeKitchenGlow.png create mode 100755 res/screens/KitchenScreen/TurkeyState1.svg create mode 100755 res/screens/KitchenScreen/TurkeyState1Small.svg create mode 100755 res/screens/KitchenScreen/TurkeyState2.svg create mode 100755 res/screens/KitchenScreen/TurkeyState2Small.svg create mode 100755 res/screens/KitchenScreen/TurkeyState3.svg create mode 100755 res/screens/KitchenScreen/TurkeyState3Small.svg create mode 100755 res/screens/KitchenScreen/TurkeyState4.svg create mode 100755 res/screens/KitchenScreen/TurkeyState4Small.svg create mode 100755 res/screens/KitchenScreen/TurkeyState5.svg create mode 100755 res/screens/KitchenScreen/TurkeyState5Small.svg create mode 100755 res/screens/LoadingScreen/Loading-Title-Mockup.png create mode 100755 res/screens/LoadingScreen/Loading-Title.png create mode 100755 res/screens/LoadingScreen/PanFront.png create mode 100755 res/screens/LoadingScreen/TextCooking.png create mode 100755 res/screens/LoadingScreen/TextDone.png create mode 100755 res/screens/LoadingScreen/Turkey0.png create mode 100755 res/screens/LoadingScreen/Turkey25.png create mode 100755 res/screens/LoadingScreen/Turkey50.png create mode 100755 res/screens/LoadingScreen/Turkey75.png create mode 100755 res/screens/LoadingScreen/TurkeyDone.png create mode 100755 res/screens/MainScreen/ButtonCredits.png create mode 100755 res/screens/MainScreen/ButtonHelp.png create mode 100755 res/screens/MainScreen/ButtonStart.png create mode 100755 res/screens/MainScreen/Grass.png create mode 100755 res/screens/MainScreen/Main-Screen.png create mode 100755 res/screens/MainScreen/TurkeySprite.png create mode 100755 res/screens/MarketScreen/MarketScreen.png create mode 100755 res/screens/MarketScreen/MarketTopShelf.png create mode 100755 res/screens/ScoreScreen/Score-Evaluation-1.png create mode 100755 res/screens/ScoreScreen/Score-Evaluation-2.png create mode 100755 res/screens/ScoreScreen/Score-Tally.png create mode 100755 res/screens/Window/Door1.png create mode 100755 res/screens/Window/Door2.png create mode 100755 res/screens/Window/Ground.png create mode 100755 res/screens/Window/Housefar.png create mode 100755 res/screens/Window/Small1.png create mode 100755 res/screens/Window/Small2.png create mode 100755 res/screens/Window/Small3.png create mode 100755 res/screens/Window/Small4.png create mode 100755 res/screens/Window/Small5.png create mode 100755 res/screens/Window/StreetlightGlow.png create mode 100755 res/screens/Window/Test4-217.svg create mode 100755 res/screens/Window/Test4TransparencyFull.svg create mode 100755 res/screens/Window/Tree_Animation.png create mode 100755 res/screens/Window/Win1.png create mode 100755 res/screens/Window/Win10.png create mode 100755 res/screens/Window/Win11.png create mode 100755 res/screens/Window/Win2.png create mode 100755 res/screens/Window/Win3.png create mode 100755 res/screens/Window/Win4.png create mode 100755 res/screens/Window/Win5.png create mode 100755 res/screens/Window/Win6.png create mode 100755 res/screens/Window/Win7.png create mode 100755 res/screens/Window/Win8.png create mode 100755 res/screens/Window/Win9.png create mode 100755 res/sound/Audio Sources.txt create mode 100755 res/sound/Events/Fire/87564__sgak__fire Fire Start Louder.mp3 create mode 100755 res/sound/Events/Fire/87564__sgak__fire Loop.mp3 create mode 100755 res/sound/GUI/buzz.mp3 create mode 100755 res/sound/GUI/click.mp3 create mode 100755 res/sound/GUI/ding.mp3 create mode 100755 res/sound/GUI/lowclick.mp3 create mode 100755 res/sound/GUI/pop.mp3 create mode 100755 res/sound/Kitchen/Close_Cookbook.mp3 create mode 100755 res/sound/Kitchen/Double_Beep.mp3 create mode 100755 res/sound/Kitchen/Open_Cookbook.mp3 create mode 100755 res/sound/Kitchen/Oven_Door_Full_Close.mp3 create mode 100755 res/sound/Kitchen/Oven_Door_Full_Open.mp3 create mode 100755 res/sound/Kitchen/Oven_Door_Peek_Close.mp3 create mode 100755 res/sound/Kitchen/Oven_Door_Peek_Open.mp3 create mode 100755 res/sound/Kitchen/sizzle.mp3 create mode 100755 res/sound/Store/Waterford.mp3 create mode 100755 res/sound/Store/buy.mp3 create mode 100755 res/sound/Store/entrance.mp3 create mode 100755 res/sound/Store/supermarket.mp3 create mode 100755 res/sound/turkey_in_the_straw.mp3 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/index.html b/index.html new file mode 100755 index 0000000..b30900d --- /dev/null +++ b/index.html @@ -0,0 +1,27 @@ + + + Turkey Cooking Simulator + + + + +
+
+ +
+
+ + + + + + + + + + + + diff --git a/js/dialogue.js b/js/dialogue.js new file mode 100755 index 0000000..c14b752 --- /dev/null +++ b/js/dialogue.js @@ -0,0 +1,227 @@ +function DialogueSequence( sequence ){ + + var targetStory = story[sequence] ? story[sequence].slice(0) : ( messages[sequence] ? messages[sequence].slice(0) : [] ); + + return { + next: function(){ + return targetStory.shift().split(": "); + }, + more: function(){ + return targetStory.length > 0; + } + } +} + +function DialogUI( stage, gameState ){ + var that = this; + // Dialog States + var DIALOG_RECEDING = 0; + var DIALOG_SHOWING = 1; + var DIALOG_PAUSING = 2; + var MILLIS_PER_CHAR = 100; + + var peopleImg = { + "Boyfriend": new createjs.Bitmap("res/people/Boyfriend.png"), + "Brother": new createjs.Bitmap("res/people/Brother.png"), + "Cat": new createjs.Bitmap("res/people/Cat.png"), + "Dad": new createjs.Bitmap("res/people/Dad.png"), + "Girlfriend": new createjs.Bitmap("res/people/Girlfriend.png"), + "Grandma": new createjs.Bitmap("res/people/Grandma.png"), + "Grandpa": new createjs.Bitmap("res/people/Grandpa.png"), + "Mom": new createjs.Bitmap("res/people/Mom.png"), + "Female": new createjs.Bitmap("res/people/PlayerFemale.png"), + "Male": new createjs.Bitmap("res/people/PlayerMale.png"), + "Turkey": new createjs.Bitmap("res/people/TurkeyGhost.png") + }; + + var dialogueList = Object.keys(story); + + this.dialogSpeed = 30; + this.dialogState = DIALOG_PAUSING; + + this.dialogMotionQueue = [DIALOG_RECEDING]; + this.currDialogueSeq = new DialogueSequence("Null"); + dialogQueue = []; + + this.dialogBox = new createjs.Bitmap("res/screens/GUI/DialogueBox.png"); + this.dialogBox.x = 0; + this.dialogBox.y = 250; + + this.currentFace = peopleImg["Male"]; + this.currentFace.x = 0; + + this.textContent = new createjs.Text( "", "24px Arial", "black" ); + this.textContent.x = 205; + this.textContent.y = 705; + this.textContent.lineWidth = 565; + this.textContent.lineHeight = 30; + this.textContent.textBaseline = "alphabetic"; + + this.dialogBox.addEventListener( "mouseover", function(){ document.body.style.cursor='pointer'; } ); + this.dialogBox.addEventListener( "mouseout", function(){ document.body.style.cursor='default'; } ); + this.dialogBox.addEventListener( "click", function(){ setTimeout( clickEvent, 100); }); + + this.textContent.addEventListener( "mouseover", function(){ document.body.style.cursor='pointer'; } ); + this.textContent.addEventListener( "mouseout", function(){ document.body.style.cursor='default'; } ); + this.textContent.addEventListener( "click", function(){ setTimeout( clickEvent, 100); }); + + this.endFunc = function(){}; + + this.showDialog= function( textSeq ){ + if(DEBUG) console.log("showing"+ textSeq); + if( !peopleImg["Me"] ){ + peopleImg["Me"] = peopleImg[gameState.gender]; + } + + if( !peopleImg["Spouse"] ){ + if( gameState.gender == "Male" ){ + peopleImg["Spouse"] = peopleImg["Girlfriend"] ; + }else{ + peopleImg["Spouse"] = peopleImg["Boyfriend"] ; + } + } + + if( textSeq.seq == "custom" ){ + messages["custom"] = ["Me: " + textSeq.customText ]; + } + + + if( textSeq.random ){ + that.showRandomConvo(); + return; + } + + 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 ); + that.currentFace.y = 250; + that.currentFace = peopleImg[nextDialogue[0]] || that.currentFace; + that.autoAdvance = textSeq.autoAdvance; + that.dialogMotionQueue = [DIALOG_SHOWING]; + } + + this.showRandomConvo = function(){ + // No more stories, thanks for playing + if( dialogueList.length == 0 ) return; + + dialogueList = Object.keys(story); + var randomKey = UtilityFunctions.randRange(0, dialogueList.length); + + // check if there is something going on + if( !that.currDialogueSeq.more() ){ + if(DEBUG) console.log("random story"); + this.showDialog( {seq: dialogueList[ randomKey ] || "Dad Tells a bad Joke", autoAdvance:true } ); + delete story[ dialogueList[ randomKey ] ]; + gameState.dialogueHeard++; + } + } + + 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"] ){ + peopleImg["Me"] = peopleImg[gameState.gender]; + } + + // if there is more dialogue text, then keep going, otherwise, recede + if( that.currDialogueSeq.more() ){ + var nextDialogue = that.currDialogueSeq.next(); + + that.dialogMotionQueue.push(DIALOG_SHOWING); + that.textContent.text=nextDialogue[1]; + if(DEBUG) console.log("showing face:" +nextDialogue[0] ); + + // swap out face immediately + that.currentFace.y = 250; + that.currentFace = peopleImg[nextDialogue[0]] || that.currentFace; + that.currentFace.y = 0; + }else{ + // pause and close dialog + setTimeout( function(){ + that.dialogMotionQueue.push(DIALOG_RECEDING); + if( that.endFunc ) + that.endFunc(); + }, 250 ); + } + delayCounter = 0; + oldTime = new Date().getTime(); + } + + stage.addChild( this.dialogBox ); + stage.addChild( this.textContent ); + + for(var i in peopleImg ){ + peopleImg[i].alpha = 1; + peopleImg[i].y = 250; + stage.addChild( peopleImg[i] ); + } + + 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(); + } + + if( that.dialogState == DIALOG_RECEDING ){ + that.dialogBox.y+=that.dialogSpeed; + that.textContent.y += that.dialogSpeed; + that.currentFace.y += that.dialogSpeed; + //if(DEBUG) console.log( "Receding" + that.dialogBox.y ); + } + if( that.dialogState == DIALOG_SHOWING ){ + that.dialogBox.y-=that.dialogSpeed; + that.textContent.y -= that.dialogSpeed; + that.currentFace.y -= that.dialogSpeed; + //if(DEBUG) console.log( "Advancing" + that.dialogBox.y ); + } + + // toggle states + if( that.dialogBox.y > 250 && that.dialogState == DIALOG_RECEDING ){ + that.dialogBox.y = 250; + that.textContent.y = 735; + that.currentFace.y = 250; + that.dialogState = DIALOG_PAUSING; + //if(DEBUG) console.log( "Pausing on recede" + that.dialogBox.y ); + + } + if( that.dialogBox.y < 0 && that.dialogState == DIALOG_SHOWING ){ + that.dialogBox.y = 0; + that.textContent.y = 480; + that.currentFace.y = 0; + that.dialogState = DIALOG_PAUSING; + //if(DEBUG) console.log( "Pausing on showing" + that.dialogBox.y ); + } + + /* next states if there are any on the queue */ + if( that.dialogMotionQueue.length > 0 && that.dialogState == DIALOG_PAUSING ){ + that.dialogState = that.dialogMotionQueue.shift(); + } + }, + + minDialog: function(){ + that.dialogMotionQueue.push( DIALOG_RECEDING ); + }, + + maxDialog: function(){ + that.dialogMotionQueue.push( DIALOG_SHOWING ); + }, + render: function(){ + stage.addChild( that.dialogBox ); + stage.addChild( that.textContent ); + + for(var i in peopleImg ){ + peopleImg[i].alpha = 1; + stage.addChild( peopleImg[i] ); + } + } + } +} \ No newline at end of file diff --git a/js/main.js b/js/main.js new file mode 100755 index 0000000..0e07431 --- /dev/null +++ b/js/main.js @@ -0,0 +1,484 @@ +// Robert- Here be dragons + +var DEBUG = 1; + +function GameState(){ + var that = this; + + this.pubsub = {}; + BindPubSub( this.pubsub ); + this.currentTime = Date.now(); //new Date().getTime(); + this.startTime = Date.now();//new Date().getTime() + this.oldTime = Date.now();// new Date().getTime(); + this.oldDialogueTime = Date.now();//new Date().getTime(); + + this.gameStarted = false; + this.name = ""; + this.gender = "Male"; + this.pronoun = "he"; + this.wallet = 45.00; + this.hard = false; + this.boughtOvenLight = false; + this.turkeyWeight = 8; + this.peekRecords = []; + this.turkeyCooking = false; + this.turkeyType = ""; + this.alarmTimer = 0; + this.alarmBought = false; + this.alarmActivated = false; + this.turkeyCookCounter = 0; + + // stats + this.storeVisits = 0; + this.dialogueHeard = 0; + this.ovenOpened = 0; + + // modifiers + this.turkeyTypeModifier = 1; + this.stuffingTypeModifier = 1; + this.frillsModifier = 1; + this.hardcoreModifier = 1; + + // Game State flags + this.turkeyBought = false; + var randomWeight = [ (UtilityFunctions.randRange(10,22)+"."+UtilityFunctions.randRange(10,99)), + (UtilityFunctions.randRange(10,22)+"."+UtilityFunctions.randRange(10,99)), + (UtilityFunctions.randRange(10,22)+"."+UtilityFunctions.randRange(10,99)), + (UtilityFunctions.randRange(10,22)+"."+UtilityFunctions.randRange(10,99)), + (UtilityFunctions.randRange(10,22)+"."+UtilityFunctions.randRange(10,99)) + ]; + + // Load all our resources: + var queue = new createjs.LoadQueue(true); + queue.addEventListener("progress", function(event){ + that.pubsub.publish("Load", (event.progress*100/25)); + }); + + that.mainUI = new GameUI( "demoCanvas", that ); + createjs.Ticker.addEventListener( "tick", gameLoop ); + queue.addEventListener("complete", function(event){ + // Finished loading + }); + queue.installPlugin(createjs.Sound); + + // + queue.loadFile( {id: "DialogueBoxFile", src:"res/screens/GUI/DialogueBox.png"} ); + /*queue.loadFile( {id:"res/screens/LoadingScreen/Turkey0.png", src: "res/screens/LoadingScreen/Turkey0.png"} ); + queue.loadFile( {id:"res/screens/LoadingScreen/Turkey25.png", src: "res/screens/LoadingScreen/Turkey25.png"} ); + queue.loadFile( {id:"res/screens/LoadingScreen/Turkey50.png", src: "res/screens/LoadingScreen/Turkey50.png"} ); + queue.loadFile( {id:"res/screens/LoadingScreen/Turkey75.png", src: "res/screens/LoadingScreen/Turkey75.png"} ); + queue.loadFile( {id:"res/screens/LoadingScreen/TurkeyDone.png", src: "res/screens/LoadingScreen/TurkeyDone.png"} );*/ + + // Screens + queue.loadFile( {id: "res/screens/DifficultyScreen/Difficulty-Selection.png", src:"res/screens/DifficultyScreen/Difficulty-Selection.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"} ); + + // Load image assets + queue.loadFile( {id: "TurkeySpriteFile", src:"res/screens/MainScreen/TurkeySprite.png"} ); + queue.loadFile( {id: "MainBackgroundFile", src:"res/screens/MainScreen/Main-Screen.png"} ); + queue.loadFile( {id: "OverlayGrassFile", src:"res/screens/MainScreen/Grass.png"} ); + queue.loadFile( {id: "StartButtonFile", src:"res/screens/MainScreen/ButtonStart.png"} ); + queue.loadFile( {id: "HelpButtonFile", src:"res/screens/MainScreen/ButtonHelp.png"} ); + queue.loadFile( {id: "CreditsButtonFile", src:"res/screens/MainScreen/ButtonCredits.png"} ); + + queue.loadFile( {id: "CreditsScreenFile", src:"res/screens/HelpCreditsScreen/Credits.png" } ); + queue.loadFile( {id: "HelpP1P2", src:"res/screens/HelpCreditsScreen/HelpP1P2.png" } ); + 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: "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"} ); + + // Load sound assets + queue.loadFile( {id: "TitleMusicFile", src:"res/sound/turkey_in_the_straw.mp3"} ); + 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"} ); + + // 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.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"}); + + queue.loadFile( {id: "res/screens/KitchenScreen/AlarmKitchenGlow.png", src:"res/screens/KitchenScreen/AlarmKitchenGlow.png"}); + queue.loadFile( {id: "res/screens/KitchenScreen/AlarmKitchen.png", src:"res/screens/KitchenScreen/AlarmKitchen.png"}); + + queue.loadFile( {id: "res/screens/KitchenScreen/TempProbeKitchenGlow.png", src:"res/screens/KitchenScreen/TempProbeKitchenGlow.png"}); + queue.loadFile( {id: "res/screens/KitchenScreen/TempProbeKitchen.png", src:"res/screens/KitchenScreen/TempProbeKitchen.png"}); + + queue.loadFile( {id: "res/screens/KitchenScreen/StuffingSpecialKitchenGlow.png", src:"res/screens/KitchenScreen/StuffingSpecialKitchenGlow.png"}); + queue.loadFile( {id: "res/screens/KitchenScreen/StuffingSpecialKitchen.png", src:"res/screens/KitchenScreen/StuffingSpecialKitchen.png"}); + + queue.loadFile( {id: "res/screens/KitchenScreen/StuffingRepurposedKitchenGlow.png", src:"res/screens/KitchenScreen/StuffingRepurposedKitchenGlow.png"}); + queue.loadFile( {id: "res/screens/KitchenScreen/StuffingRepurposedKitchen.png", src:"res/screens/KitchenScreen/StuffingRepurposedKitchen.png"}); + + queue.loadFile( {id: "res/screens/KitchenScreen/StuffingExquisiteKitchenGlow.png", src:"res/screens/KitchenScreen/StuffingExquisiteKitchenGlow.png"}); + queue.loadFile( {id: "res/screens/KitchenScreen/StuffingExquisiteKitchen.png", src:"res/screens/KitchenScreen/StuffingExquisiteKitchen.png"}); + + queue.loadFile( {id: "res/screens/KitchenScreen/StoreBrochureGlow.png", src:"res/screens/KitchenScreen/StoreBrochureGlow.png"}); + queue.loadFile( {id: "res/screens/KitchenScreen/StoreBrochure.png", src:"res/screens/KitchenScreen/StoreBrochure.png"}); + + queue.loadFile( {id: "res/screens/KitchenScreen/FrillsBoxKitchenGlow.png", src:"res/screens/KitchenScreen/FrillsBoxKitchenGlow.png"}); + queue.loadFile( {id: "res/screens/KitchenScreen/FrillsBoxKitchen.png", src:"res/screens/KitchenScreen/FrillsBoxKitchen.png"}); + + queue.loadFile( {id: "res/screens/KitchenScreen/DoorPeekLightOn.png", src:"res/screens/KitchenScreen/DoorPeekLightOn.png"}); + queue.loadFile( {id: "res/screens/KitchenScreen/DoorPeekLightOff.png", src:"res/screens/KitchenScreen/DoorPeekLightOff.png"}); + + queue.loadFile( {id: "res/screens/KitchenScreen/DoorOpen.png", src:"res/screens/KitchenScreen/DoorOpen.png"}); + queue.loadFile( {id: "res/screens/KitchenScreen/DoorClosedLightOn.png", src:"res/screens/KitchenScreen/DoorClosedLightOn.png"}); + queue.loadFile( {id: "res/screens/KitchenScreen/DoorClosedLightOff.png", src:"res/screens/KitchenScreen/DoorClosedLightOff.png"}); + + queue.loadFile( {id: "res/screens/KitchenScreen/PanFront.png", src:"res/screens/KitchenScreen/PanFront.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/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 + queue.loadFile( {id: "res/sound/Kitchen/Oven_Door_Full_Open.mp3", src:"res/sound/Kitchen/Oven_Door_Full_Open.mp3"}); + queue.loadFile( {id: "res/sound/Kitchen/Oven_Door_Full_Close.mp3", src:"res/sound/Kitchen/Oven_Door_Full_Close.mp3"}); + queue.loadFile( {id: "res/sound/Kitchen/Oven_Door_Peek_Close.mp3", src:"res/sound/Kitchen/Oven_Door_Peek_Close.mp3"}); + queue.loadFile( {id: "res/sound/Kitchen/Oven_Door_Peek_Open.mp3", src:"res/sound/Kitchen/Oven_Door_Peek_Open.mp3"}); + queue.loadFile( {id: "res/sound/Kitchen/Close_Cookbook.mp3", src:"res/sound/Kitchen/Close_Cookbook.mp3"}); + queue.loadFile( {id: "res/sound/Kitchen/Open_Cookbook.mp3", src:"res/sound/Kitchen/Open_Cookbook.mp3"}); + queue.loadFile( {id: "res/sound/Kitchen/sizzle.mp3", src:"res/sound/Kitchen/sizzle.mp3"} ); + queue.loadFile( {id: "res/sound/Kitchen/Double_Beep.mp3", src:"res/sound/Kitchen/Double_Beep.mp3"} ); + + // Market Items + queue.loadFile( {id: "res/screens/MarketScreen/MarketTopShelf.png", src:"res/screens/MarketScreen/MarketTopShelf.png"}); + + queue.loadFile( {id: "res/items/Clipboard.png", src:"res/items/Clipboard.png"}); + queue.loadFile( {id: "res/items/Wallet.png", src:"res/items/Wallet.png"}); + + queue.loadFile( {id: "res/items/FrillsBox.png", src:"res/items/ExitSign.png"}); + queue.loadFile( {id: "res/items/FrillsBoxGlow.png", src:"res/items/ExitGlow.png"}); + + queue.loadFile( {id: "res/items/FrillsBox.png", src:"res/items/FrillsBox.png"}); + queue.loadFile( {id: "res/items/FrillsBoxGlow.png", src:"res/items/FrillsBoxGlow.png"}); + + queue.loadFile( {id: "res/items/TempProbe.png", src:"res/items/TempProbe.png"}); + queue.loadFile( {id: "res/items/TempProbeGlow.png", src:"res/items/TempProbeGlow.png"}); + + queue.loadFile( {id: "res/items/OvenLightBox.png", src:"res/items/OvenLightBox.png"}); + queue.loadFile( {id: "res/items/OvenLightBoxGlow.png", src:"res/items/OvenLightBoxGlow.png"}); + + queue.loadFile( {id: "res/items/Alarm.png", src:"res/items/Alarm.png"}); + queue.loadFile( {id: "res/items/AlarmGlow.png", src:"res/items/AlarmGlow.png"}); + + queue.loadFile( {id: "res/items/Cookbook1.png", src:"res/items/Cookbook1.png"}); + queue.loadFile( {id: "res/items/Cookbook1Glow.png", src:"res/items/Cookbook1Glow.png"}); + + queue.loadFile( {id: "res/items/StuffingRepurposed.png", src:"res/items/StuffingRepurposed.png"}); + queue.loadFile( {id: "res/items/StuffingRepurposedGlow.png", src:"res/items/StuffingRepurposedGlow.png"}); + + queue.loadFile( {id: "res/items/StuffingExquisite.png", src:"res/items/StuffingExquisite.png"}); + queue.loadFile( {id: "res/items/StuffingExquisiteGlow.png", src:"res/items/StuffingExquisiteGlow.png"}); + + queue.loadFile( {id: "res/items/StuffingSpecial.png", src:"res/items/StuffingSpecial.png"}); + queue.loadFile( {id: "res/items/StuffingSpecialGlow.png", src:"res/items/StuffingSpecialGlow.png"}); + + queue.loadFile( {id: "res/items/Turkey5.png", src:"res/items/Turkey5.png"}); + queue.loadFile( {id: "res/items/Turkey5Glow.png", src:"res/items/Turkey5Glow.png"}); + + queue.loadFile( {id: "res/items/Turkey4.png", src:"res/items/Turkey4.png"}); + queue.loadFile( {id: "res/items/Turkey4Glow.png", src:"res/items/Turkey4Glow.png"}); + + queue.loadFile( {id: "res/items/Turkey3.png", src:"res/items/Turkey3.png"}); + queue.loadFile( {id: "res/items/Turkey3Glow.png", src:"res/items/Turkey3Glow.png"}); + + queue.loadFile( {id: "res/items/Turkey2.png", src:"res/items/Turkey2.png"}); + queue.loadFile( {id: "res/items/Turkey2Glow.png", src:"res/items/Turkey2Glow.png"}); + + queue.loadFile( {id: "res/items/Turkey1.png", src:"res/items/Turkey1.png"}); + queue.loadFile( {id: "res/items/Turkey1Glow.png", src:"res/items/Turkey1Glow.png"}); + + // People photos + queue.loadFile( {id: "res/people/Boyfriend.png", src:"res/people/Boyfriend.png"}); + queue.loadFile( {id: "res/people/Brother.png", src:"res/people/Brother.png"}); + queue.loadFile( {id: "res/people/Cat.png", src:"res/people/Cat.png"}); + queue.loadFile( {id: "res/people/Dad.png", src:"res/people/Dad.png"}); + queue.loadFile( {id: "res/people/Girlfriend.png", src:"res/people/Girlfriend.png"}); + queue.loadFile( {id: "res/people/Grandma.png", src:"res/people/Grandma.png"}); + queue.loadFile( {id: "res/people/Grandpa.png", src:"res/people/Grandpa.png"}); + queue.loadFile( {id: "res/people/Mom.png", src:"res/people/Mom.png"}); + queue.loadFile( {id: "res/people/PlayerFemale.png", src:"res/people/PlayerFemale.png"}); + queue.loadFile( {id: "res/people/PlayerMale.png", src:"res/people/PlayerMale.png"}); + queue.loadFile( {id: "res/people/TurkeyGhost.png", src:"res/people/TurkeyGhost.png"}); + + // Load Window elements + queue.loadFile( {id: "res/screens/Window/Door1.png", src:"res/screens/Window/Door1.png"}); + queue.loadFile( {id: "res/screens/Window/Door2.png", src:"res/screens/Window/Door2.png"}); + queue.loadFile( {id: "res/screens/Window/Ground.png", src:"res/screens/Window/Ground.png"}); + queue.loadFile( {id: "res/screens/Window/Housefar.png", src:"res/screens/Window/Housefar.png"}); + queue.loadFile( {id: "res/screens/Window/Small1.png", src:"res/screens/Window/Small1.png"}); + queue.loadFile( {id: "res/screens/Window/Small2.png", src:"res/screens/Window/Small2.png"}); + queue.loadFile( {id: "res/screens/Window/Small3.png", src:"res/screens/Window/Small3.png"}); + queue.loadFile( {id: "res/screens/Window/Small4.png", src:"res/screens/Window/Small4.png"}); + queue.loadFile( {id: "res/screens/Window/Small5.png", src:"res/screens/Window/Small5.png"}); + queue.loadFile( {id: "res/screens/Window/StreetlightGlow.png", src:"res/screens/Window/StreetlightGlow.png"}); + queue.loadFile( {id: "res/screens/Window/Win1.png", src:"res/screens/Window/Win1.png"}); + queue.loadFile( {id: "res/screens/Window/Win2.png", src:"res/screens/Window/Win2.png"}); + queue.loadFile( {id: "res/screens/Window/Win3.png", src:"res/screens/Window/Win3.png"}); + queue.loadFile( {id: "res/screens/Window/Win4.png", src:"res/screens/Window/Win4.png"}); + queue.loadFile( {id: "res/screens/Window/Win5.png", src:"res/screens/Window/Win5.png"}); + queue.loadFile( {id: "res/screens/Window/Win6.png", src:"res/screens/Window/Win6.png"}); + queue.loadFile( {id: "res/screens/Window/Win7.png", src:"res/screens/Window/Win7.png"}); + queue.loadFile( {id: "res/screens/Window/Win8.png", src:"res/screens/Window/Win8.png"}); + queue.loadFile( {id: "res/screens/Window/Win9.png", src:"res/screens/Window/Win9.png"}); + 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.svg", src:"res/screens/Window/Test4TransparencyFull.svg"}); + + + + this.screenState = 0; + this.newScreen = ""; + + this.marketItems = { + "Frills Box" : new MarketItem( this, "Frills Box", 133,92, 3.00, "res/items/FrillsBox.png", "res/items/FrillsBoxGlow.png", "res/screens/KitchenScreen/FrillsBoxKitchen.png", "res/screens/KitchenScreen/FrillsBoxKitchenGlow.png", + "Some people dress up their dogs. Others dress up their house. Why not dress up your turkey?" ), + + + "Temperature Probe" : new MarketItem( this, "Temperature Probe", 200, 57, 9.00, "res/items/TempProbe.png", "res/items/TempProbeGlow.png", "res/screens/KitchenScreen/TempProbeKitchen.png", "res/screens/KitchenScreen/TempProbeKitchenGlow.png", "Ensure your food is cooked with this handy thermometer. Now with easy to read LED display" ), + "Oven Light in a Box" : new MarketItem( this, "Oven Light in a Box", 131,222, 15.00, "res/items/OvenLightBox.png", "res/items/OvenLightBoxGlow.png", null,null, "This will allow checking on your turkey without letting the heat out." ), + + "Alarm Clock" : new MarketItem( this, "Alarm Clock", 173,248, 6.00, "res/items/Alarm.png", "res/items/AlarmGlow.png", "res/screens/KitchenScreen/AlarmKitchen.png", "res/screens/KitchenScreen/AlarmKitchenGlow.png", "Have you ever wanted to control time? Now you can. Digital readout counts down until time of choice. Audible alarm" ), + "Cookbook" : new MarketItem( this, "Cookbook", 283,203, 3.00, "res/items/Cookbook1.png", "res/items/Cookbook1Glow.png","res/screens/KitchenScreen/CookbookKitchen.png", "res/screens/KitchenScreen/CookbookKitchenGlow.png", "How do I cook turkey? Handy note space included for writing down temperature measurements" ), + "Repurposed Stuffing" : new MarketItem( this, "Repurposed Stuffing", 510,197, 2.00, "res/items/StuffingRepurposed.png", "res/items/StuffingRepurposedGlow.png", "res/screens/KitchenScreen/StuffingRepurposedKitchen.png", "res/screens/KitchenScreen/StuffingRepurposedKitchenGlow.png","At least 80% original breadcrumb. Guaranteed to contain no avian products" ), + "Exquisite Stuffing" : new MarketItem( this, "Exquisite Stuffing", 458,210, 3.00, "res/items/StuffingExquisite.png", "res/items/StuffingExquisiteGlow.png", "res/screens/KitchenScreen/StuffingExquisiteKitchen.png","res/screens/KitchenScreen/StuffingExquisiteKitchenGlow.png", "Colonial merchants once traveled the four reaches of the Earth to bring back the ingredients contained in this very box" ), + + "Special Stuffing" : new MarketItem( this, "Special Stuffing", 390,220, 6.00, "res/items/StuffingSpecial.png", "res/items/StuffingSpecialGlow.png", + "res/screens/KitchenScreen/StuffingSpecialKitchen.png","res/screens/KitchenScreen/StuffingSpecialKitchenGlow.png", + "Once rated as the most handsome man in the universe. Scott and his patented special stuffing will set you on the path to food heaven" ), + + "Organic Turkey" : new MarketItem( this, "Organic Turkey", 180,360, randomWeight[0]*1.2, "res/items/Turkey5.png", "res/items/Turkey5Glow.png",null,null, "All natural. No hormones. No antibiotics. Free Range. Lead Free", parseFloat(randomWeight[0]) ), + "Free Range Turkey": new MarketItem( this, "Free Range Turkey", 540,320, randomWeight[1]*1.00, "res/items/Turkey4.png", "res/items/Turkey4Glow.png",null,null, "Our turkeys have wide open spaces to roam and are fed with only the highest quality feed.", parseFloat(randomWeight[1]) ), + "Sunny Farms Turkey" : new MarketItem( this, "Sunny Farms Turkey", 265,415, randomWeight[2]*0.60, "res/items/Turkey3.png", "res/items/Turkey3Glow.png",null,null, "100% Turkey product from Sunny Farms Heavy Industries, Ltd.", parseFloat(randomWeight[2]) ), + "Pastured Turkey": new MarketItem( this, "Pastured Turkey", 474,357, randomWeight[3]*1.4, "res/items/Turkey2.png", "res/items/Turkey2Glow.png",null,null, "Grassy fields and natural ingredients allow our turkeys to have a better life, and taste great.", parseFloat(randomWeight[3]) ), + "General Turkey": new MarketItem( this, "General Turkey", 378,426, randomWeight[4]*0.80, "res/items/Turkey1.png", "res/items/Turkey1Glow.png",null,null, "100% General Satisfaction Guaranteed", parseFloat(randomWeight[4]) ) + }; + + // Important Model, dummy placeholder + this.ovenModel = { secondTick:function(){}, setRawTemp:function(){}, getRawTemp:function(){}, getCookTime:function(){return 1000;} }; + + + /* all turkeys */ + this.turkeyStates = [ + new createjs.Bitmap( "res/screens/KitchenScreen/TurkeyState1Small.svg" ), + new createjs.Bitmap( "res/screens/KitchenScreen/TurkeyState2Small.svg" ), + new createjs.Bitmap( "res/screens/KitchenScreen/TurkeyState3Small.svg" ), + new createjs.Bitmap( "res/screens/KitchenScreen/TurkeyState4Small.svg" ), + new createjs.Bitmap( "res/screens/KitchenScreen/TurkeyState5Small.svg" ) + ]; + + this.purchasedItems = []; + + // did we already show the player the kitchen intro? + this.kitchenIntro = false; + + this.addRecord = function( record ){ + that.peekRecords.push( new Record( record.type, that.currentTime, record.text ) ); + } + that.pubsub.subscribe( "AddRecord", this.addRecord ); + + + function addHighScore(name, turkeyPoundage, cookTime, score){ + var scores = {}; + var now = new Date(); + if( !localStorage.getItem("highScores") ){ + scores = JSON.parse( localStorage.getItem("highScores") ); + } + + scores[now.getYear()+"/"+now.getMonth()+"/"+now.getDay()] = { + "name" : name, + "weight" : turkeyPoundage, + "cookTime" : cookTime, + "score" : score + }; + + localStorage.setItem("highScores", JSON.stringfy(scores)); + } + + function gameLoop(){ + that.mainUI.draw(); + } + + return { + // "main": this + } +} + +function GameUI( canvasElem, gameState ){ + var that = this; + + var SCREEN_OUT = 1; + var SCREEN_IN = 2; + var SCREEN_STABLE = 0; + + this.stage = new createjs.Stage( canvasElem ); + this.stage.enableMouseOver(25); + + this.activeScreenName = "EndingScreen"; + this.activeScreenObj = {}; + + /* Initialize All Screens */ + this.screens = { + "LoadingScreen" : LoadingScreen, + "MainScreen" : MainScreen, + "DifficultyScreen" : DifficultyScreen, + "KitchenScreen" : KitchenScreen, + "MarketScreen" : MarketScreen, + "ScoreScreen" : ScoreScreen, + "CreditsScreen" : CreditsScreen + } + + var soundManager = new SoundManager( gameState ); + + this.activeScreenObj = new LoadingScreen( this.stage, gameState ); + var textContent = new createjs.Text( "", "20px Arial", "black" ); + textContent.x = 750; + textContent.y = 30; + //this.stage.addChild( textContent); + var overlay = new createjs.Shape(); + overlay.graphics.beginFill("#fffffff").drawRect(0, 0, 800, 600 ); + overlay.alpha = 0; + this.stage.addChild(overlay); + + var dialogManager = new DialogUI( this.stage, gameState ); + + // delay for fade in and fade-out + this.switchScreen = function( screenName ){ + gameState.screenState = SCREEN_OUT; + dialogManager.minDialog(); + if(DEBUG) console.log("Switch screen called with" + screenName); + gameState.newScreen = screenName; + }; + this.actuallySwitchScreen = function( screenName ){ + that.stage.removeAllChildren(); + that.activeScreenObj = new that.screens[ screenName ]( that.stage, gameState ); + //that.stage.addChild( textContent ); + that.stage.addChild( overlay ); + dialogManager.render(); + }; + new HelpUI(this.stage, gameState); + + gameState.pubsub.subscribe( "SwitchScreen", this.switchScreen ); + gameState.pubsub.subscribe( "ActuallySwitchScreen", this.actuallySwitchScreen ); + + // Allow items to be removed if they don't have access to stage + gameState.pubsub.subscribe( "RemoveItems", function(items){ + for (var index in items ){ + that.stage.removeChild(items[index]); + } + }); + + return { + draw : function(){ + if( gameState.screenState == SCREEN_OUT ){ + overlay.alpha +=0.3; + } + if( gameState.screenState == SCREEN_IN ){ + overlay.alpha -=0.3; + } + if( overlay.alpha > 1.0 ){ + gameState.screenState = SCREEN_IN; + overlay.alpha = 1; + gameState.pubsub.publish( "ActuallySwitchScreen", gameState.newScreen ); + } + if( overlay.alpha < 0.0 ){ + gameState.screenState = SCREEN_STABLE; + overlay.alpha = 0; + } + soundManager.tick(); + that.activeScreenObj.blit(); + dialogManager.tick(); + textContent.text = createjs.Ticker.getMeasuredFPS().toFixed(1); + that.stage.update(); + } + } +} + +function Record( type, dateTime, record ){ + return { + getTime: function(){ + return dateTime; + }, + getContent: function(){ + return record; + }, + getType: function(){ + return type; + } + } +} + + //"Turkey weight, " + //"Opened oven for X seconds" + //"Core temperature measured at " + + +function BindPubSub( obj ){ + (function(q) { + var topics = {}, subUid = -1; + q.subscribe = function(topic, func) { + if (!topics[topic]) { + topics[topic] = []; + } + var token = (++subUid).toString(); + topics[topic].push({ + token: token, + func: func + }); + return token; + }; + + q.publish = function(topic, args) { + if (!topics[topic]) { + return false; + } + setTimeout(function() { + var subscribers = topics[topic], + len = subscribers ? subscribers.length : 0; + + while (len--) { + subscribers[len].func(args); + } + }, 0); + return true; + + }; + + q.unsubscribe = function(token) { + for (var m in topics) { + if (topics[m]) { + for (var i = 0, j = topics[m].length; i < j; i++) { + if (topics[m][i].token === token) { + topics[m].splice(i, 1); + return token; + } + } + } + } + return false; + }; + }(obj)); +} diff --git a/js/model.js b/js/model.js new file mode 100755 index 0000000..3bc02ea --- /dev/null +++ b/js/model.js @@ -0,0 +1,329 @@ +function TurkeyLayer( name, percentRadius, turkeyModel, ovenModel ){ + var that = this; + + this.name = name; + this.percentRadius=percentRadius; + this.initialTemp = 20; + this.waterLost = 0; + this.finalTemperature = 20; + this.cookCondition = "Raw"; + + return { + updateTemperatureTick: function(){ + 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); + 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; + } + + } +} + + +function TurkeyModel( weight, ovenModel ){ + 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.totalRadius = UtilityFunctions.calculateRadius( weight, this.density ); + + + 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(){ + for (var i in this.totalLayers ){ + this.totalLayers[i].updateTemperatureTick(); + } + }; + + this.resetLayerTemps = function(){ + for (var i in this.totalLayers ){ + this.totalLayers[i].resetLayerTemps(); + } + }; +} + +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(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 + this.equalizeTemp= function(){ + var error = Math.abs(this.setTemp-this.tempInfini); + if( this.setTemp>this.tempInfini ){ + this.tempInfini = this.tempInfini + error*proportional; + } + else if( this.setTemperrorTolerance ) { + 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); + } + } + return { + getTurkeyState: function(){ + return { + "skin" : { + "temp": turkey.totalLayers[0].getTemperature(), + "cond": turkey.totalLayers[0].getCondition() + }, + "body" : { + "temp": turkey.totalLayers[1].getTemperature(), + "cond": turkey.totalLayers[1].getCondition() + }, + "core" : { + "temp": turkey.totalLayers[2].getTemperature(), + "cond": turkey.totalLayers[2].getCondition() + } + }; + }, + changeTemp: function(setTemp){ + if(DEBUG) console.log("temp changed to " + setTemp); + that.setTemp = setTemp; + }, + // set the tempInfini + setRawTemp: function(newTemp){ + if(DEBUG) console.log("raw temp changed to" + that.tempInfini); + that.tempInfini = newTemp; + }, + getRawTemp: function(){ + return that.tempInfini; + }, + getCookTime: function(){ + return that.globalTime; + }, + 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(); + } + } +} + + +UtilityFunctions = { + + // Cache the lambda if the Biot number does not change, to avoid expensive root-finding operations + cachedBiot: null, + cachedLambda: null, + + // Using Ratios for a rectangular Box Turkey + calculateRadius: function(weight, density) { + + var ratioLvG=1.4; //1.4, Turkey length vs shoulder girth + var ratioLvH=2; //2, Turkey length vs height from resting position + + var length = Math.pow(weight/((1/ratioLvG)*(1/ratioLvH)*density),(1/3)) + var depth = 1/(ratioLvG /length); + var height = 1/(ratioLvH /length); + var simpleRadius = length/2; //Doesn't take into account equal Volume + + var rectangleVolume = depth*height*length; //m^3 Multiple by 1/4 to account for triangular shape and empty Space + var complexRadius = Math.pow(rectangleVolume/((4/3)*Math.PI), 1/3); //Volume of 3D Box = 3D Sphere + + //if(DEBUG) console.log("Simple Radius " + simpleRadius + " Meters") + //if(DEBUG) console.log("Complex Radius " + complexRadius + " Meters") + 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)) + }, + + waterLoss: function(temperature) { + return (Math.pow(10,(temperature-20)/80)-1) + }, + + + 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=multiplier*600000) { + return ["Fire", (cookValue-600000)/(multiplier*600000),"fire"]; + } + 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"]; + } + } +} + +//Running the Program Stuff +/* +var ovenObject = new OvenModel(); +var turkey = new TurkeyModel(9.07185, ovenObject ); + +globalTime=0; +setInterval(function(){ovenObject.secondTick();},10); +*/ diff --git a/js/screens.js b/js/screens.js new file mode 100755 index 0000000..c2af4ef --- /dev/null +++ b/js/screens.js @@ -0,0 +1,657 @@ +/* Screens, inheritance would be nice */ +function LoadingScreen( stage, gameState ){ + var that = this; + this.lastPercent = -1; + this.picture = new createjs.Bitmap( "res/screens/LoadingScreen/Loading-Title.png" ); + this.pictureFront = new createjs.Bitmap( "res/screens/LoadingScreen/PanFront.png" ); + this.cooking = new createjs.Bitmap( "res/screens/LoadingScreen/TextCooking.png" ); + this.done = new createjs.Bitmap( "res/screens/LoadingScreen/TextDone.png" ); + this.turkeyState = [ new createjs.Bitmap( "res/screens/LoadingScreen/Turkey0.png" ), + new createjs.Bitmap( "res/screens/LoadingScreen/Turkey25.png" ), + new createjs.Bitmap( "res/screens/LoadingScreen/Turkey50.png" ), + new createjs.Bitmap( "res/screens/LoadingScreen/Turkey75.png" ), + new createjs.Bitmap( "res/screens/LoadingScreen/TurkeyDone.png" ) ]; + + 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" ); + textContent.x = 500; + textContent.y = 20; + stage.addChild( textContent); + + gameState.pubsub.subscribe( "Load", function(percent){ + textContent.text = (percent * 25).toFixed(2) + " %"; + var wholeNum = percent.toFixed(0); + if( that.lastPercent != percent){ + that.lastPercent = percent; + stage.addChild( that.turkeyState[wholeNum] ); + stage.addChild( that.pictureFront ); + } + + //If we're still on image one, don't fade it out, it's the base image! + if( wholeNum != 0 ) + that.turkeyState[wholeNum].alpha = percent.toFixed(2) - wholeNum; + + // Done! + if( wholeNum == 4 ){ + that.turkeyState[4].alpha = 1; + that.cooking.alpha=0; + that.done.alpha = 1; + + that.done.addEventListener( "mouseover", function(){ document.body.style.cursor='pointer'; } ); + that.done.addEventListener( "mouseout", function(){ document.body.style.cursor='default'; } ); + that.done.addEventListener( "click", function(){ gameState.pubsub.publish("SwitchScreen", "MainScreen"); }); + + that.turkeyState[4].addEventListener( "mouseover", function(){ document.body.style.cursor='pointer'; } ); + that.turkeyState[4].addEventListener( "mouseout", function(){ document.body.style.cursor='default'; } ); + that.turkeyState[4].addEventListener( "click", function(){ gameState.pubsub.publish("SwitchScreen", "MainScreen"); }); + } + }); + + stage.addChild( this.pictureFront ); + + return { + blit : function(){ + } + } +} + + +function MainScreen( stage, gameState ){ + var that = this; + + this.background = new createjs.Bitmap( "res/screens/MainScreen/Main-Screen.png" ); + stage.addChild( this.background ); + + var turkeyAnimations = { peck:[14,24,"peck"], ruffle:[0,13,"ruffle"], stare:[25,35,"stare"] }; + var data = { + images: ["res/screens/MainScreen/TurkeySprite.png"], + frames: { width:400, height:350 }, + animations: turkeyAnimations + }; + + var spriteSheet = new createjs.SpriteSheet(data); + var animation = new createjs.Sprite(spriteSheet, "stare"); + animation.x = 140; + animation.y = 210; + + animation.addEventListener("tick", handleTick); + function handleTick(event){ + if ( turkeyAnimations[event.currentTarget.currentAnimation][1] == event.currentTarget.currentFrame ){ + event.currentTarget.paused = true; + } + // Click happened. + } + stage.addChild(animation); + + this.grassLayer = new createjs.Bitmap( "res/screens/MainScreen/Grass.png" ); + this.grassLayer.x = -60; + stage.addChild( this.grassLayer ); + + // buttons info/credits/start + new ImgButton( stage, gameState, 571,527, "res/screens/MainScreen/ButtonStart.png", "res/screens/MainScreen/ButtonStart.png","SwitchScreen", "DifficultyScreen", "Click" ); + new ImgButton( stage, gameState, 17,470, "res/screens/MainScreen/ButtonHelp.png", "res/screens/MainScreen/ButtonHelp.png",null, null, "Click", function(){ gameState.pubsub.publish("ShowHelp",""); } ); + new ImgButton( stage, gameState, 17,527, "res/screens/MainScreen/ButtonCredits.png", "res/screens/MainScreen/ButtonCredits.png","SwitchScreen", "CreditsScreen", "Click" ); + + gameState.pubsub.publish( "BackgroundLoop", {name:"TitleMusic", pos:5650, volume:0.7} ); + this.uiElems = []; + + return { + blit : function(){ + if( createjs.Ticker.getTicks() %50 == 0 ){ + + animation.gotoAndPlay(["peck", "ruffle", "stare"][UtilityFunctions.randRange(0,2)]); + } + // Draw all the uiElements + for( var index in that.uiElems ){ + that.uiElems[ index ].tick(); + } + } + } + +//start button +} + +function DifficultyScreen( stage, gameState ){ + var that = this; + + this.background = new createjs.Bitmap( "res/screens/DifficultyScreen/Difficulty-Selection.png" ); + stage.addChild( this.background ); + + var turkeyAnimations = { peck:[14,24,"peck"], ruffle:[0,13,"ruffle"], stare:[25,35,"stare"] }; + var data = { + images: ["res/screens/MainScreen/TurkeySprite.png"], + frames: { width:400, height:350 }, + animations: turkeyAnimations + }; + + var spriteSheet = new createjs.SpriteSheet(data); + var animation = new createjs.Sprite(spriteSheet, "stare"); + animation.x = 140; + animation.y = 210; + + animation.addEventListener("tick", handleTick); + function handleTick(event) { + if ( turkeyAnimations[event.currentTarget.currentAnimation][1] == event.currentTarget.currentFrame ){ + event.currentTarget.paused = true; + } + // Click happened. + } + stage.addChild(animation); + + this.grassLayer = new createjs.Bitmap( "res/screens/MainScreen/Grass.png" ); + this.grassLayer.x = -60; + stage.addChild( this.grassLayer ); + + // Difficulty selection UI + this.buttonsAndText = new createjs.Bitmap( "res/screens/DifficultyScreen/ButtonsandText.png" ); + stage.addChild( this.buttonsAndText ); + + this.maleSelection = new createjs.Bitmap( "res/screens/DifficultyScreen/ButtonMale.png" ); + stage.addChild( this.maleSelection ); + + this.femaleSelection = new createjs.Bitmap( "res/screens/DifficultyScreen/ButtonFemale.png" ); + this.femaleSelection.alpha = 0; + stage.addChild( this.femaleSelection ); + + var nameInput = new createjs.Text( "", "48px Arial", "black" ); + nameInput.x = 47; + nameInput.y = 85; + nameInput.lineWidth = 175; + + stage.addChild( nameInput ); + + // handle keyboard typing + document.onkeyup = function(event){ + // keycode + var keynum = 48; + if(window.event){ // IE + keynum = event.keyCode; + } + else{ + if(event.which){ // Netscape/Firefox/Opera + keynum = event.which; + } + } + + if( keynum != 8 && keynum < 91 && keynum > 47 && nameInput.text.length < 22 ) + nameInput.text += String.fromCharCode(keynum); + }; + + + // Backspace gets special treatment + document.onkeydown = function(event){ + var keynum = 0; + if(window.event){ // IE + keynum = event.keyCode; + } + else{ + if(event.which){ // Netscape/Firefox/Opera + keynum = event.which; + } + } + + if(keynum == 8 && nameInput.text.length > 0 ) + nameInput.text = nameInput.text.substr(0, nameInput.text.length-1); + 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(){ 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" ) ); + + gameState.pubsub.subscribe( "ChangeGender", function(gender){ + gameState.gender=gender; + if( gender == "Male" ){ + that.maleSelection.alpha = 1; + that.femaleSelection.alpha = 0; + gameState.pronoun = "he"; + }else{ + that.maleSelection.alpha = 0; + that.femaleSelection.alpha = 1; + gameState.pronoun = "she"; + } + }) + return { + blit : function(){ + if( createjs.Ticker.getTicks() %50 == 0 ){ + animation.gotoAndPlay(["peck", "ruffle", "stare"][UtilityFunctions.randRange(0,2)]); + } + + // Draw all the uiElements + for( var index in that.uiElems ){ + that.uiElems[ index ].tick(); + } + } + } +} + +function KitchenScreen( stage, gameState ){ + var that = this; + + // Fade out any other sounds + gameState.pubsub.publish( "FadeOut", "" ); + + //gameState.pubsub.publish( "BackgroundLoop", {name:"Sizzle", pos:0, volume:0.5} ); + this.uiElems = []; + + this.uiElems.push( new WindowUI( stage, gameState ) ); + this.background = new createjs.Bitmap( "res/screens/KitchenScreen/KitchenScreen.png" ); + stage.addChild( this.background ); + if(DEBUG) console.log(gameState.purchasedItems); + if(DEBUG) console.log("KitchenScreen"); + for(var i in gameState.purchasedItems ){ + if(DEBUG) console.log(gameState.purchasedItems); + gameState.purchasedItems[i].draw( stage ); + } + + this.uiElems.push( gameState.ovenUI ? gameState.ovenUI.render() : ( gameState.ovenUI = new OvenUI( stage, gameState ) ).render() ); + this.uiElems.push( new ClockUI( stage, gameState ) ); + + if( gameState.alarmBought ) + this.uiElems.push( new AlarmUI(stage, gameState) ); + + + stage.addChild( new Button( stage, gameState, 14, 17, 73, 45, null,null, function(){ gameState.pubsub.publish("ShowHelp","");} ) ); + + new ImgButton( stage, gameState, 0,0, "res/screens/KitchenScreen/StoreBrochure.png", "res/screens/KitchenScreen/StoreBrochureGlow.png", null,null, "Click", function(){ + gameState.pubsub.publish("SwitchScreen", "MarketScreen"); + gameState.storeVisits++; + } ); + + // If player did not buy a turkey, tell them + if( !gameState.turkeyBought ){ + gameState.pubsub.publish( "ShowDialog", {seq:"KitchenInitial", autoAdvance:false} ); + } + + + return { + blit : function(){ + + // Draw all the uiElements + for( var index in that.uiElems ){ + that.uiElems[ index ].tick(); + } + } + } +} + +function MarketScreen( stage, gameState ){ + var that = this; + + this.background = new createjs.Bitmap( "res/screens/MarketScreen/MarketScreen.png" ); + var price = new createjs.Text( "", "16px Arial", "black" ); + price.x = 120; + price.y = 560; + + var wallet = new createjs.Text( "$" + parseFloat(gameState.wallet).toFixed(2), "20px Arial", "black" ); + wallet.x = 725; + wallet.y = 550; + + var walletTag = new createjs.Bitmap("res/items/Wallet.png"); + walletTag.x = 670; + walletTag.y = 535; + + var clipboardImg = new createjs.Bitmap("res/items/Clipboard.png"); + clipboardImg.x = 5; + clipboardImg.y = 315; + + var clipboardTitle = new createjs.Text( "Shopping List", "18px Arial", "black" ); + clipboardTitle.x = 25; + clipboardTitle.y = 385; + clipboardTitle.lineWidth = 175; + + var clipboardText = new createjs.Text( "Turkey", "16px Arial", "black" ); + clipboardText.x = 23; + clipboardText.y = 425; + clipboardText.lineWidth = 173; + + var clipboardWeight = new createjs.Text( "", "16px Arial", "black" ); + clipboardWeight.x = 120; + clipboardWeight.y = 540; + clipboardWeight.lineWidth = 175; + + // Play soundz + gameState.pubsub.publish( "Play", {name:"Entrance", volume:0.3} ); + gameState.pubsub.publish( "BackgroundLoop", {name:"MarketMusic", volume:1} ); + gameState.pubsub.publish( "BackgroundLoop", {name:"MarketBackgroundSound", volume:0.4} ); + + stage.addChild(this.background); + + stage.addChild(wallet); + stage.addChild(walletTag); + stage.addChild(clipboardImg); + + stage.addChild(clipboardTitle); + stage.addChild(clipboardText); + stage.addChild(clipboardWeight); + stage.addChild(price); + + this.uiElems = []; + this.uiElems.push( new ImgButton( stage, gameState, 690,0, "res/items/ExitSign.png", "res/items/ExitGlow.png","SwitchScreen", "KitchenScreen", "Click" ) ); + + var marketItemKeys = Object.keys(gameState.marketItems); + for (var index in marketItemKeys ) { + gameState.marketItems[marketItemKeys[index]].draw( stage ); + } + + this.topground = new createjs.Bitmap( "res/screens/MarketScreen/MarketTopShelf.png" ); + stage.addChild( this.topground ); + + + this.showPrice = function( cost ){ + price.text = "$ " + ( cost == NaN ? "" : parseFloat(cost).toFixed(2) ); + } + + this.clearClipboard = function(){ + price.text = ""; + clipboardTitle.text = ""; + clipboardText.text = ""; + clipboardWeight.text = ""; + } + + this.showDesc = function( desc ){ + clipboardTitle.text = desc.title; + clipboardText.text = desc.desc; + if( desc.weight ){ + clipboardWeight.text = desc.weight.toFixed(2) + " lbs."; + } + } + + this.setWalletAmount = function(newAmount){ + wallet.text="$" + ( gameState.wallet=newAmount.toFixed(2) ); + } + + gameState.pubsub.subscribe("ShowDesc", this.showDesc); + gameState.pubsub.subscribe("ShowPrice", this.showPrice ); + gameState.pubsub.subscribe("WalletAmount", this.setWalletAmount); + gameState.pubsub.subscribe("ClearClipboard", this.clearClipboard); + + return { + blit : function(){ + + // Draw all the uiElements + for( var index in that.uiElems ){ + that.uiElems[ index ].tick(); + } + } + } + + +} + +function ScoreScreen( stage, gameState ){ + var that = this; + + // All the text for the entries + var totalCookTime = gameState.turkeyCookCounter; + var realTimeElapsed = Date.now() - gameState.startTime; + console.log("total cook time:"+ realTimeElapsed); + + var turkeyState = gameState.ovenModel.getTurkeyState(); + var totalScore = 0; + + var skinScoreChart = { + "raw": 0, + "undercooked": -100, + "slightly cooked": 75, + "cooked": 500, + "overcooked": 200, + "dry": -300, + "burnt": -500 + }; + + var coreScoreChart = { + "raw": 0, + "undercooked": 125, + "slightly cooked": 750, + "cooked": 1000, + "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, layer) { + desiredAverage = 165; + if(layer=="skin") desiredAverage = 260; + + variance = 1000; //Std Deviation 31.62 + 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<=5; i++) { + resultsDialogue.push(randomString(randomDiag)); + } + messages["end"] = resultsDialogue; + + function randomString(stringArray) { + var index = UtilityFunctions.randRange(0, stringArray.length-1); + 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" ); + this.background.alpha = 1; + stage.addChild( this.background ); + + background1 = new createjs.Bitmap( "res/screens/ScoreScreen/Score-Evaluation-2.png" ); + background1.alpha = 0; + stage.addChild( background1 ); + + for (i in gameState.turkeyStates){ + gameState.turkeyStates[i].scaleX = gameState.turkeyStates[i].scaleY = 1; + gameState.turkeyStates[i].x = 490; + gameState.turkeyStates[i].y = 110; + stage.addChild(gameState.turkeyStates[i]); + } + + gameState.pubsub.publish( "BackgroundLoop", {name:"TitleMusic", pos:5650, volume:0.7} ); + + gameState.pubsub.publish( "ShowDialog", {seq:"end", autoAdvance:true, endFunc:function(){ + background1.alpha=1; + + stage.addChild( new Button( stage, gameState, 590, 540, 190, 50, null, null, function(){ document.location.reload(); } ) ); + + // Cooking stats + var hours = parseInt( totalCookTime / 3600 ) % 24; + var minutes = parseInt( totalCookTime / 60 ) % 60; + var seconds = totalCookTime % 60; + var timeText = ("00"+hours.toFixed(0)).slice(-2) + ":" + ("00"+minutes.toFixed(0)).slice(-2) + ":" + ("00"+seconds.toFixed(0)).slice(-2); + + var totalCookTimeText = new createjs.Text( timeText, "20px Arial", "black" ); + totalCookTimeText.x = 270; + totalCookTimeText.y = 107; + + realTimeElapsed = realTimeElapsed / 1000; + hours = parseInt( realTimeElapsed / 3600 ) % 24; + minutes = parseInt( realTimeElapsed / 60 ) % 60; + seconds = realTimeElapsed % 60; + timeText = ("00"+hours.toFixed(0)).slice(-2) + ":" + ("00"+minutes.toFixed(0)).slice(-2) + ":" + ("00"+seconds.toFixed(0)).slice(-2); + + var realtimeElapsedText = new createjs.Text( timeText, "20px Arial", "black" ); + realtimeElapsedText.x = 270; + realtimeElapsedText.y = 127; + + var ovenOpenedText = new createjs.Text( gameState.ovenOpened, "20px Arial", "black" ); + ovenOpenedText.x = 270; + ovenOpenedText.y = 147; + + var dialogueHeardText = new createjs.Text( gameState.dialogueHeard, "20px Arial", "black" ); + dialogueHeardText.x = 270; + dialogueHeardText.y = 167; + + stage.addChild( totalCookTimeText ); + stage.addChild( realtimeElapsedText ); + stage.addChild( ovenOpenedText ); + stage.addChild( dialogueHeardText ); + + // Cookedness Score + + var outerConditionDesc = new createjs.Text( turkeyState.skin.cond[2], "20px Arial", "black" ); + outerConditionDesc.x = 150; + outerConditionDesc.y = 320; + + var coreConditionDesc = new createjs.Text( turkeyState.core.cond[2], "20px Arial", "black" ); + coreConditionDesc.x = 150; + coreConditionDesc.y = 340; + + var outerConditionText = new createjs.Text( skinScoreChart[ turkeyState.skin.cond[2] ], "20px Arial", "black" ); + outerConditionText.x = 310; + outerConditionText.y = 320; + + var coreConditionText = new createjs.Text( coreScoreChart[ turkeyState.skin.cond[2] ], "20px Arial", "black" ); + coreConditionText.x = 310; + coreConditionText.y = 340; + + + stage.addChild( coreConditionText ); + stage.addChild( outerConditionText ); + + stage.addChild( coreConditionDesc ); + stage.addChild( outerConditionDesc ); + + // Temperature Score + + var outerTemperatureText = new createjs.Text( outerTempScore.toFixed(0), "20px Arial", "black" ); + outerTemperatureText.x = 680; + outerTemperatureText.y = 320; + + var coreTemperatureText = new createjs.Text( coreTempScore.toFixed(0), "20px Arial", "black" ); + coreTemperatureText.x = 680; + coreTemperatureText.y = 340; + + var outerTemperatureDesc = new createjs.Text( outerTemp + " F", "20px Arial", "black" ); + outerTemperatureDesc.x = 530; + outerTemperatureDesc.y = 320; + + + + var coreTemperatureDesc = new createjs.Text( coreTemp + " F", "20px Arial", "black" ); + coreTemperatureDesc.x = 530; + coreTemperatureDesc.y = 340; + + + + stage.addChild( outerTemperatureText ); + stage.addChild( coreTemperatureText ); + + stage.addChild( coreTemperatureDesc ); + stage.addChild( outerTemperatureDesc ); + + // Modifiers + var turkeyMod = typeToMod[gameState.turkeyType]; + 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( "+"+(Math.abs(gameState.stuffingTypeModifier-1)*100).toFixed(0)+"%" , "20px Arial", "black" ); + stuffingTypeModifierText.x = 310 + stuffingTypeModifierText.y = 457; + + totalScore *= gameState.stuffingTypeModifier; + + var frillsModifierText = new createjs.Text( "x"+gameState.frillsModifier, "20px Arial", "black" ); + frillsModifierText.x = 310 + frillsModifierText.y = 477; + + totalScore *= gameState.frillsModifier; + + var hardcoreModifierText = new createjs.Text( "x"+gameState.hardcoreModifier, "20px Arial", "black" ); + hardcoreModifierText.x = 310 + hardcoreModifierText.y = 497; + + totalScore *= gameState.hardcoreModifier; + + var totalText = new createjs.Text( totalScore.toFixed(0), "32px Arial", "black" ); + totalText.x = 250; + totalText.y = 550; + stage.addChild( totalText ); + + stage.addChild( stuffingTypeModifierText ); + stage.addChild( turkeyTypeModifierText ); + stage.addChild( frillsModifierText ); + stage.addChild( hardcoreModifierText ); + + + }} ); + + + return { + blit : function(){} + } +} + +function CreditsScreen( stage, gameState ){ + var that = this; + + this.background = new createjs.Bitmap( "res/screens/HelpCreditsScreen/Credits.png" ); + stage.addChild( this.background ); + stage.addChild( new Button( stage, gameState, 698, 533, 80, 50, "SwitchScreen", "MainScreen" ) ); + + this.uiElems = []; + return { + blit : function(){ + + // Draw all the uiElements + for( var index in that.uiElems ){ + that.uiElems[ index ].tick(); + } + } + } + // +} diff --git a/js/soundmanager.js b/js/soundmanager.js new file mode 100755 index 0000000..856316d --- /dev/null +++ b/js/soundmanager.js @@ -0,0 +1,112 @@ +function SoundInstance( soundObj, loop ){ + this.soundObj = soundObj; +} +function SoundManager( gameState ){ + var that = this; + var soundCache = {}; + + var AUDIO_OUT = 1; + var AUDIO_IN = 2; + var AUDIO_STABLE = 0; + + this.audioState = AUDIO_STABLE; + + // 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"); + createjs.Sound.registerSound("res/sound/Store/entrance.mp3", "Entrance"); + createjs.Sound.registerSound("res/sound/GUI/ding.mp3", "Ding"); + createjs.Sound.registerSound("res/sound/Kitchen/Double_Beep.mp3", "BeepBeep"); + + // Kitchen sound + createjs.Sound.registerSound("res/sound/Kitchen/Oven_Door_Full_Open.mp3", "Oven_Door_Full_Open"); + createjs.Sound.registerSound("res/sound/Kitchen/Oven_Door_Full_Close.mp3", "Oven_Door_Full_Close"); + createjs.Sound.registerSound("res/sound/Kitchen/Oven_Door_Peek_Close.mp3", "Oven_Door_Peek_Close"); + createjs.Sound.registerSound("res/sound/Kitchen/Oven_Door_Peek_Open.mp3", "Oven_Door_Peek_Open"); + createjs.Sound.registerSound("res/sound/Kitchen/sizzle.mp3", "Sizzle"); + + createjs.Sound.registerSound("res/sound/Kitchen/Open_Cookbook.mp3", "Open_Cookbook"); + createjs.Sound.registerSound("res/sound/Kitchen/Close_Cookbook.mp3", "Close_Cookbook"); + + + this.backgroundSounds = []; + this.backgroundSoundsQueue = []; + this.fadeOut = function(){ + for ( var i in that.backgroundSounds ){ + that.backgroundSounds[i].audioState = AUDIO_OUT; + } + }; + this.play = function( soundName ){ + var channel = createjs.Sound.createInstance("Click"); + if( typeof soundName != "object" ){ + + channel = ( soundCache[soundName] ? soundCache[soundName] : soundCache[soundName] = createjs.Sound.createInstance(soundName) ); + channel.volume = 1; + } + else{ + channel = ( soundCache[soundName.name] ? soundCache[soundName.name] : soundCache[soundName.name] = createjs.Sound.createInstance(soundName.name) ); + channel.volume = soundName.volume; + } + channel.play(); + }; + + this.backgroundLoop = function( soundName ){ + var newBackgroundSound; + if( typeof soundName != "object" ){ + newBackgroundSound = soundCache[soundName] ? soundCache[soundName] : soundCache[soundName] = createjs.Sound.createInstance(soundName); + } + else{ + newBackgroundSound = soundCache[soundName.name] ? soundCache[soundName.name] : soundCache[soundName.name] = createjs.Sound.createInstance( soundName.name ); + newBackgroundSound.setPosition(soundName.pos || 0); + newBackgroundSound.volume = newBackgroundSound.desiredVolume = soundName.volume || 1; + newBackgroundSound.play(); + + // loop-de-loop + newBackgroundSound.addEventListener("complete", function(){ + if( newBackgroundSound.volume == 0 ){ newBackgroundSound.stop(); return; } + newBackgroundSound.setPosition(soundName.pos || 0); + newBackgroundSound.volume = newBackgroundSound.desiredVolume = soundName.volume || 1; + newBackgroundSound.play(); + }); + } + that.backgroundSoundsQueue.push(newBackgroundSound); + }; + + gameState.pubsub.subscribe( "Play", this.play ); + gameState.pubsub.subscribe( "BackgroundLoop", this.backgroundLoop ); + gameState.pubsub.subscribe( "FadeOut", this.fadeOut ); + + return { + tick: function(){ + for ( var i in that.backgroundSounds ){ + if( that.backgroundSounds[i].audioState == AUDIO_OUT ){ + that.backgroundSounds[i].volume -=0.03; + } + if( that.backgroundSounds[i].audioState == AUDIO_IN ){ + that.backgroundSounds[i].volume +=0.03; + } + if( that.backgroundSounds[i].volume >= that.backgroundSounds[i].desiredVolume ){ + that.backgroundSounds[i].volume = that.backgroundSounds[i].desiredVolume; + } + if( that.backgroundSounds[i].volume <= 0.0 ){ + that.backgroundSounds[i].volume = 0; + that.backgroundSounds[i].stop(); + that.backgroundSounds.splice( i, 1 ); + } + } + if( that.backgroundSounds.length == 0 ){ + for ( var i in that.backgroundSoundsQueue ){ + var newSound = that.backgroundSoundsQueue[i]; + newSound.audioState = AUDIO_IN; + that.backgroundSounds.push( newSound ); + } + that.backgroundSoundsQueue = []; + } + } + } + +} \ No newline at end of file diff --git a/js/stories.js b/js/stories.js new file mode 100755 index 0000000..1ae1d7b --- /dev/null +++ b/js/stories.js @@ -0,0 +1,664 @@ +var messages = { + "Null":["Me: "], + "KitchenInitial" : ["Me: I should run to the store and buy a delicious turkey!"], + "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: Ah, the oven is already preheated..."], + "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": +["Dad: So I was in the office last week, typing up the TPS reports that need to be turned in every Friday, when I heard a quacking sound.", +"Dad: I thought it was Larry again. He has one of those old Blackintosh computers at his desk, you know, the ones with the smiley winking face.", +"Brother: Dad, that's such old technology. When is your company going to upgrade to SuckBox 87?", +"Dad: I know, but let me finish my story. Well, you know how when you click or an alert box comes up the computer can be set to a quacking sound?", +"Dad: So I tell Larry, what's up with all his alert boxes.", +"Mom: Who's Larry again hun?", +"Dad: He's my stall partner. We share he cubicle remember? So he turns around in his office chair, and asks 'what?'", +"Dad: 'The quacking, what's with all the quacking?'", +"Dad: 'I'm not doing it', he tells me.", +"Dad: 'Well, It isn't me.'", +"Dad: Just then the quacking noise happened again.", +"Dad: 'Did you hear that Larry?'", +"Dad: 'Yeah.'", +"Dad: We poked our head above the cubicle to look out and didn't see anybody else in the room. Yet the quacking came again.", +"Dad: Besides the quacking, the room had fallen very silent.", +"Mom: So, what did ya do?", +"Dad: I droop down on my hands and knees, and that's when it got me.", +"Mom: Mercy!", +"Brother: You got attacked by a duck?", +"Dad: That duck ran into me, face first. In its flight to escape, it pooped on my hands. Lucky me.", +"Dad: Larry and I grabbed a few guys on break and we corralled the duck out of the office.", +"Dad: Some of the guys wanted to keep it as a pet, but these are the same guys who don't get much done anyways. No help to office productivity.", +"Grandma: Son, You let a good meal go to waste.", +"Dad: Mom, we don't eat ducks we find on the street. That's just cruel.", +"Grandma: That doesn't stop those Chinese from eating street cats and dogs. Why do you think there are all those missing pet posters in the neighborhood?", +"Mom: Oh good lord!", +"Dad: Mom, you should stop spreading those rumors. It is cars and wild animals.", +"Grandma: Oh I'm sure those are SOME of the reasons. But lying to yourself isn't good honey.", +"Cat: Meow.", +"Dad: Oh hey Kasey. You like being an indoor cat don't you? Don't have to worry about all those cars and wild animals. Don't you little girl?", +"Grandma: And Chinese.", +"Dad: Mooom!"], + +"Golf Story": +["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.", +"Grandpa: How about you and I hit a few around next week?", +"Dad: I will have to check my calendar, but I would love to."], + +"Creeper Worker": +["Brother: ...and so this guy kept trying to see what I wrote down on my notepad, and I keep trying to hide it from his prying eyes. Anyways...", +"Dad: Hey that reminds me of this guy at work.", +"Brother: I'm trying to tell a story here Dad.", +"Mom: Let Greg finish.", +"Dad: Ok, finish your story.", +"Brother: Well... I forgot where I was going with it. Err, the guy was trying to view my notepad...and well, that's about it. Look what you did Dad.", +"Dad: Sorry. But hey! Now you can hear my story.", +"Dad: Just like you, we had a nosey co-worker. This co-worker was showing around a new customer to our branch when a screensaver caught his in a nearby room.", +"Grandma: What is a screensaver?", +"Dad: You know on a computer when you don't use it and the screen goes black? It is like that, except this computer has an animated display like a slide show.", +"Grandma: Ok, a slide show on the computer.", +"Dad: Yes, sort of like that.", +"Dad: Well, the co-worker enters the room, with the new customer, to check out the screen saver. Now this room belongs to Julia, our PR rep.", +"Dad: I'm not sure why he entered the room. He could have just viewed the screen saver through the office window.", +"Dad: Julia wasn't there at the time, but word gets around quickly in the office.", +"Dad: She found out that Rob, that's the co-worker, entered the room, and filed a complaint with Internal Relations.", +"Dad: Then Internal relations sends a message to Rob, asking if he did enter the room.", +"Dad: And then Rob sends a long email response back, all the while with our customer in tow, even asking the customer advice about what to include in the E-mail.", +"Brother: Wow, so did you lose the customer?", +"Dad: We don't know yet, but management did send an internal memo around re-affirming the boundaries of privacy.", +"Dad: This whole thing was completely overblown though. Rob was just looking at a screensaver. He didn't even try and hide it either.", +"Dad: But that's life. People who get excited over nothing.", +"Wife: Well, he did seem kind of creepy asking for the customer's advice on the E-mail.", +"Brother: And what about Julia? She seemed to know a littttle bit too much about the goings on in her office cubicle.", +"Dad: Maybe she has an office camera or something. I'm not sure.", +"Brother: Do you have one?", +"Dad: No, but then again I'm not in PR. Sometimes workers try and find out what the dirt is on them, or try and change their records on the computer.", +"Brother: Sorry to say, it honestly sounds like a terrible place to work.", +"Dad: It isn't as bad as it seems. Every now and then sometime like this happens and it becomes the talk of the town.", +"Brother: Maybe just a boring place."], + +"Paint Bucket Sucks": +["Brother: Hey Grandpa, I've got a funny story about that primer you gave me.", +"Grandpa: You'll have to remind me again, my memory isn't too good in my old age.", +"Brother: Well, you gave me some primer to redo my room.", +"Mom: How is the painting going? Last I heard you had the priming done.", +"Brother: Yup. Well, almost. I still have a mess to clean up.", +"Mom: What happened?", +"Brother: Yeaahh well, grandpa's can of primer was pretty old. And it rusted on the bottom and developed small holes.", +"Brother: So, there I was prepping everything, ready to go to town on the walls, when I start feeling some wetness on my pants.", +"Brother: I look down and there are primer drops all over my pants.", +"Dad: Why were you holding the paint bucket though? Don't you just pour it in a roller pan and do it that way like I taught you?", +"Brother: Well yes, but I was also cutting the edges of the room before hand, like you taught me. And that was easier with the paint bucket in my hand.", +"Brother: Or so I thought...", +"Mom: What happened next Greggy?", +"Brother: Mom, don't call me 'Greggy'.", +"Brother: Anywaaays, I quickly put the can down in the roller pan I had nearby. I turned around to find some paper towels to clean myself off with.", +"Brother: That's when I noticed a drip line all the way from the garage. That's not good.", +"Brother: I dashed for the towels and once I reached them, I tried to soak up as much as possible. And well... not good.", +"Brother: In the future, I probably won't go for your primer Grandpa.", +"Grandpa: You know what'll get that paint out? Some turpentine. If you don't have some of that handy you should try out some kerosene.", +"Brother: I tried some paint remover already, but it also took out the color in my pants. Luckily, I wasn't wearing my best pants.", +"Brother: I did have to go for a heavy duty carpet cleaning service. My wife wasn't too happy about that", +"Grandpa: You should have asked me for help. I would have shown you how to do it, and I would have done it for free too.", +"Brother: Thanks Grandpa, I'll definitely keep that in mind."], + +"Hanging Doorway Ornaments":[ +"Grandma: A real bother these days are the people that decorations in their doorways. They get in your face as you try to walk through.", +"Grandma: And what if there is an Earthquake!", +"Grandpa: It isn't like we live on a fault line.", +"Grandma: Just stop hanging your bears in the doorway.", +"Grandpa: I have the kitchen and you have the garage, that was the deal.", +"Grandma: Maybe I'll just take both the garage and the kitchen and then put you out on the street with your keychain bears.", +"Grandpa: I'd like to see you try.", +"Grandma: Oohh don't make me get my shotgun.", +"Grandpa: Err, speaking of kitchens. HOW IS THAT TURKEY COMING ALONG IN THERE. YOU NEED A HAND?"], + +"Spouse gets surprise movie tickets": +["Mom: Hey, seen any interesting movies y'all?", +"Spouse: I have. Recently I was...", +"Grandpa: Back in my day, we burned rats for fun.", +"Spouse: errr.. Grandpa?", +"Grandma: Don't mind him. He's losing his mind.", +"Grandpa: I keep it right here. *Taps head* But where did you put the lock on that mouse of yours?", +"Dad: Dad, Mom, don't keep interrupting the story.", +"Grandpa: Well, she started it.", +"Grandma: Ahh, you old coot.", +"Mom: Please continue.", +"Spouse: ummmmm", +"Spouse: Ah, now I remember. [Player] and I were at the mall when a woman came up to us.", +"Spouse: 'Hey guys, sorry to bother you. I'm the host of a free movie screening preview, and we are trying to fill as many seats as possible.'", +"Spouse: 'We severely underestimated the number of people who were going to show up. If you have time, it would really help me out if you two would attend.'", +"Spouse: [Player] thought going to see the free movie was a no brainer, but I knew that we had somewhere to be in less than two hours.", +"Spouse: 'How long is the movie', I asked. She replied, 'About an hour and a half'. Which is about standard.", +"Grandpa: Back in my day...", +"Spouse: 'WE CAN ALWAYS leave early', [Player] whispered to me.", +"Dad: Did you end up seeing it?", +"Spouse: Actually, yes.", +"Spouse: We lined up at the theater, and noticed that all the others in line had a pamphlet ticket. We might be in the wrong line!", +"Spouse: The women told us to mention her name 'Stephanine' at the door to get in, but what if we go up to the doorman, mention 'Stephanine', and they respond ' Stephanine, who is Stephaine?' ", +"Spouse: The line begins to move, and we approach to the ticket-taker.", +"Spouse: 'Stephanie told us to come'. After a heart wrenching pause, the doorman nodded, and we were allowed in.", +"Dad: What movie was it?", +"Spouse: Stephanie mentioned it was going to be an action documentary about Poland but when we got our seats, the pre-ads were all childish.", +"Spouse: Legos, Toys, cartoons, etc. [Player] and I wondered if the movie we were about to see wasn't even what they told us.", +"Brother: Legos aren't just for kids.", +"Spouse: Maybe not, but the marketing is primarily kid focused. Anyhow, the movie turned out to be the Poland one.", +"Spouse: However, the movie was two hours rather than the expected one hour thirty.", +"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", +"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.", +"Grandpa: Back in my day, we used to watch movies for a nickel.", +"Mom: I remember when gas used to be twenty cents a gallon.", +"Brother: And I remember when the PS3 cost $599 US dollars.", +"Cat: Meow, meow meow"], + +"Youtube Sensation": +["Grandpa: Back in my day, we burned rats for fun.", +"Brother: Ok Grandpa. Anyways, I was at Frankfort mall the other day.", +"Brother: Just walking around, not really focused on any particular purchase when I noticed a long line. Naturally, you see the line, and wonder what's for.", +"Brother: So, my buddies and I walked up the line to find out the sitch.", +"Mom: What's a 'sitch'.", +"Brother: It means situation.", +"Mom: I see. How long was the line?", +"Brother: Oh, it stretched, maybe, half the mall. There were security guards out, to make sure that traffic could get through gaps in the line.", +"Brother: As we neared the front, we saw that the line moved into some kind of makeup store.", +"Brother: The flier outside said they had one of those video sensations, you know the one who does the makeup? I can't remember her name.", +"Mom: So did you go in?", +"Brother: And wait in that long line? I don't even wear makeup!", +"Mom: Yeah, but what about your fiancee'? Why not get her something nice?", +"Brother: I'm sure she would love some makeup, but I can buy that stuff on any day.", +"Brother: One kind of interesting, but obvious, thing about the line composition was that it was majorly women. There was a handful of guys, but I'd assume they were boyfriends.", +"Grandpa: Back in my day, I would have gotten in that line and wooed all the women.", +"Grandma: You can't even grab the attention of a taxi.", +"Grandpa: You're not making sense. Why would I want to take a taxi out to dinner?", +"Grandma: No, not taking a taxi out to dinner. Forget it. Just forget it."], + +"Girlfriend's Boba Keeps on a-flowing": +["Girlfriend: You know what boba is right Mom?", +"Mom: What's Boba?", +"Girlfriend: Ok, I guess not.", +"Grandma: What's booba?", +"Girlfriend: I take it you mean boba?", +"Grandma: Yes, that thing.", +"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.", +"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?", +"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.", +"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", +"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?", +"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.", +"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.", +"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.", +"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.", +"Girlfriend: Hah, no.", +"Brother: No, seriously.", +"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]?", +"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.", +"Grandma: I was only 8 years old, and my baby sister was less than a year.", +"Grandma: Standing is a whole day affair. Some people brought laundry. Others did their crafts in line.", +"Grandma: My sister and I stood in that line together for over eight hours until we finally reached the front.", +"Grandma: When we got there. The man with the bread said, 'One loaf of Bread.'", +"Grandma: I held my baby sister outstretched and said 'Two.'", +"Grandma: The bread man responded. 'Baby doesn't count. One loaf of bread.' We were then pushed out of line with our one loaf.", +"Mom: Jesus, that sounds horrible.", +"Grandma: It was, but it was also necessary. Though when I hear people complaining how they are tired of waiting, I like to retell that story.", +"Brother: Alright, I suppose it could be worse, but let's hope that [Player] can do better than that."], + +"Father talks about the virtues of Automated Cars": +["Mom: Roger, tell everyone about your automated cars meeting.", +"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.", +"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.", +"Dad: Disappointingly, the panel never went in-depth about the technology side of automated cars.", +"Dad: The panel just already affirmed what I already knew. Self-driving cars are coming.", +"Grandpa: Why would you want a self-driving car anyways? Driving is fun!", +"Grandpa: I remember driving my old station wagon across country to California. Now that was a trip to remember.", +"Grandpa: The sun was beating down, and we didn't have air conditioning in the car, so you rolled down the window and enjoyed the breeze.", +"Grandpa: Nowadays, you are spoiled with automatic windows, automatic car washers, automatic transmission.", +"Grandpa: Why even call it a car? Sounds to me more like a train you ride.", +"Dad: Yes Dad, which was the general gist of the whole thing. Some people like to drive their car.", +"Dad: Though one panelist seemed confident that it will eventually take over.", +"Dad: They quoted 48 minutes as the average amount of time a driver spends in their car per day.", +"Dad: If most of that time is spent in traffic, or just getting somewhere, then people will adopt a car that can do the nitty gritty driving.", +"Dad: Drivers can then spend their five leisure minutes on the beach boulevard cruising with manual control.", +"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!)"], + +"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.", +"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!", +"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.", +"Brother: But anyways, what was cool was we were allowed to play some broomball on the ice before the game due to our group size.", +"Brother: That was loads of fun. Until someone got injured.", +"Mom: Heavens no!", +"Brother: Well, it wasn't from the broomball.", +"Brother: Later, when our group was walking around, waiting for the actual game to start, the two hockey teams were practicing and a puck flew into the crowd.", +"Brother: It smacked one of my friends in the neck, and they had to go to the infirmary.", +"Mom: But were they okay?", +"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.", +"Girlfriend: Close game?", +"Brother: Hardly. 3-0", +"Brother: The tornado mascot kept it interesting though, with his kazoo.", +"Brother: 'Bzzzwoooooo'", +"Brother: Ah, here's something. A Catholic girl's school came to sing the national anthem.", +"Brother: You have to imagine these girls were about five to six years old. So it was mind-numbingly cute.", +"Brother: The stadium was filled with 'awwws' when they approached the mics.", +"Brother: Well anyways, these girls were out near the mechanical bull before the game started.", +"Dad: The stadium has a mechanical bull?", +"Brother: Yup, pay your five dollars and take it for a ride. The operators know their clientele.", +"Brother: They let young kids 'tame the bull' while they throw the wrath of God down on the teenagers. Cause they know the teens want to flex their muscle.", +"Brother: I watched one teen tumble backwards over his head and shoulders in one bout.", +"Brother: The best part though was those little girls I mentioned earlier.", +"Brother: They surrounded the bull-riding-rink, all dressed in their school outfits.", +"Brother: 'Ride the bull. Ride the Bull!', They shouted in unison.", +"Brother: Then when someone got on.", +"Brother: 'Make them fall, make them fall!'", +"Mom: Dawwww", +"Brother: No Mom! Those little girls are evil!", +"Brother: But, it was definitely a lot of fun to watch."], + +"Mom talks about her students and reading over summer vacation": +["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", +"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'.", +"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.", +"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.", +"Mom: I sleep better knowing that my students have been given the opportunity discover works they like, whether or not a little encouragement was given.", +"Brother: You are an inspiration to us all.", +"Mom: That's very kind of you to say."], + +"Grandmother reveals her name": +["Grandpa: Lana, did I ever tell you that I am blessed to be married to you?", +"Grandma: Well, you just know all the right things to say to make a woman feel good.", +"Brother: Grandma, if you don't mind me asking, I was wondering if your name, 'Lana' had any special meaning in Russian.", +"Brother: Like, I know some American names, like Mark, are biblical in nature.", +"Grandma: Ahh, well yes. Very similar", +"Grandma: Lana is short for Svetlana, which was my given name. I shortened it to 'Lana' because it was easier to pronounce in those parts.", +"Brother: Sweatlana?", +"Grandma: Close, but you need to put more 'V' into it.", +"Grandma: Stalin's daughter was named Svetlana, and so many mothers named their daughters the same in honor.", +"Grandma: It was be loosely translated to light, and holy. Sort of biblical as you mentioned.", +"Brother: That's very interesting. Mom, Dad, was there any special reason for naming me Greg?", +"Mom: Well.", +"Dad: We looked at a lot baby naming books, and we were having trouble deciding.", +"Mom: I had a good friend named Greg when I was growing up so I liked that name.", +"Dad: It sounded good to me, and you ended up a boy, so it worked out.", +"Brother: So, did the 'Greg' you knew Mom, do anything special or notable? Like, was he famous?", +"Mom: Uhhh, well, we dated for a while, but it didn't work out.", +"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.", +"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.", +"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?", +"Dad: Dad, please no...", +"Grandpa: Ooooh, I saw Mussolini sitting on a log", +"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: 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: 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. "], + +"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.", +"Girlfriend: It is the turkey right?", +"Dad: That's right, its the turKEY", +"Dad: turKEY, get it?", +"Girlfriend: What?", +"Dad: The KEY to a great thanksgiving dinner is the turKEY.", +"Girlfriend: Aww, come on Dad. That's terrible.", +"Grandma: Is this a joke?", +"Dad: Yes Mom,", +"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.", +"Girlfriend: That's cool."], + +"Cat Story": +["Cat: Meow Meow Meow Meow Meow", +"Dad: I think the cat's hungry!", +"Cat: Meow", +"Mom: Look at it, poor thing wants some turkey!", +"Cat: Meow", +"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: (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: (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: (Translation) I don't want turkey, I want fish!"], + + +"Mom Talks About Her Bathroom Policy and her Students": +["Mom: I make sure my students are well hydrated and well rested.", +"Mom: We have 20 minutes of reading time, 20 minutes of sleeping time, and 20 cumulative daily minutes of bathroom time.", +"Mom: I bring bottles of water and juice on my own dime to make sure the students are at maximum productivity.", +"Dad: What if someone needs to use the restroom for 30 minutes?", +"Mom: It doesn't bug me, but the school has some strict bathroom policies. I've gotten in trouble in the past.", +"Dad: Oh, You never told me about this. What happened honey?", +"Mom: I didn't want to bother you with the details. But I guess there's no harm in letting you know.", +"Mom: For a while I allowed all my students to use the bathroom whenever they wanted. They didn't even have to ask. I wanted the students to feel independent.", +"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.", +"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.", +"Mom: Now students are only allowed to go to the bathroom once per day. No more than 5 minutes or else I have to go looking for them.", +"Mom: I told all my students. 'Make sure you use the restroom at recess and before school'. And they did.", +"Brother: Your students seem very well behaved. I can't even imagine a class of third graders acting as well-mannered as you describe.", +"Mom: You would be surprised what putting a little trust in a person can do.", +"Mom: Well, the newest method was working dandy. I wouldn't say it was as good as what we had setup before, but it was fine.", +"Mom: Less than a week later however, I got another memo.", +"Mom: 'Students are to be allowed to use the restroom facilities whenever they need.", +"Dad: They reverted their one-bathroom per child policy?", +"Mom: I hate to bring this up at the dinner table.", +"Grandma: Don't be worrying. Tell us the story.", +"Mom: Sigh, ok. One of the students in the other class, not mine of course, had to use the restroom. But she had already used her one bathroom break.", +"Mom: So the teacher told her to go back to her seat.", +"Mom: A while later....", +"Brother: Ahh geeez, she peed everywhere?", +"Mom: Greg!", +"Brother: What? It isn't like this is the first time this has ever happened? I hear about this happening all the time on internet message boards.", +"Mom: It was certainly a surprise for me!", +"Dad: I'm sorry to, hehehe, hear that honey.", +"Mom: This isn't a laughing matter.", +"Dad: Sorry ma'am."], + +"Grandpa tells a story about how a bug crawls in the ear of one of his fellow army buddies during the Korean War": +["Grandpa: Mmmm mmm, I can't wait to hear the sizzling of that turkey.", +"Grandma: You never seem to hear when I call you.", +"Grandpa: That's called selective hearing. My hearing is fine.", +"Grandpa: Which reminds me of my old friend Jimmy.", +"Grandma: How is ol' Jimmy?", +"Grandpa: Deaf in the one ear as usual, but he couldn't be a happier soul. We're going golfing next week.", +"Mom: I don't believe I've met Jimmy.", +"Grandpa: He and I go way back. We were GIs together during the Korean War. Then he lost his hearing.", +"Brother: Was it due to the loudness of the guns? A mortar round? Shrapnel?", +"Grandpa: I don't know what the media has filled your noggin with, but not all injury in war is glamorous.", +"Brother: I agree, war is terrible. But, I must say the technology is interesting.", +"Grandpa: Be glad you don't have to serve and only reap the riches of wartime development.", +"Grandpa: As for Jimmy, he lost his hearing at camp.", +"Grandpa: We went to sleep for the night and a beetle bug crawled in his ear.", +"Grandpa: Tried to fish it out but he ended up crushing it.", +"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.", +"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 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?", +"Girlfriend: Ha-ha, no, but that's why I brought it up. That buzz!", +"Mom: What buzz?", +"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.", +"Girlfriend: And he did it ALL. THE. TIME.", +"Brother: Yeah! Did he say anything to you when he saw you?", +"Girlfriend: I said hello and introduced myself, but he didn't know me. Just gave me the glazed ham eye look.", +"Brother: Glazed ham?", +"Girlfriend: For Thanksgiving.", +"Brother: He gave you the glazed turkey look.", +"Girlfriend: Exactly."], + +"Brother's Fiancee is on Business Trip": +["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.", +"Brother: I miss her a lot when she leaves, but whenever she returns home, we make every moment count. We count our blessings every day.", +"Mom: Amen", +"Brother: Though, it is too bad that since we're both so busy all the time, our new house remains largely unoccupied throughout the day.", +"Mom: Awww honey, I'll have to come and visit.", +"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.", +"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.", +"Brother: Oh, good..."], + +"Turkey Fact - Snood": +["Turkey: Gobble Gobble. Turkeys have a fleshy bit that comes off their forehead called the snood. Turkey farmers will occasional remove the snood, in a process called 'de-snooding'.", +"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 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", +"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, can't you a cute little kitty."], + +"Turkey Fact - Wattle": +["Turkey: Hey, it is time for another turkey fact.", +"Turkey: Most people will recognize the wattle on a chicken as that piece of red flesh that hangs down from the beak.", +"Turkey: But did you know turkeys have them too?", +"Turkey: I personally believe they are much sexier on a turkey than a chicken anyhow. And you can bet a fine wattle will attract the hen's attention.", +"Turkey: Gobble Gobble"], + +"Turkey Fact - Unsuscribe": +["Turkey: I hope I'm worth it. But hey, now you can listen to a wonderful fact about turkeys.", +"Turkey: Turkeys are members of the order Galliformes. That means we share relations to other birds like the chicken and pheasant.", +"Turkey: To unsubscribe from Turkey facts, please gobble like a turkey into the microphone.", +"Turkey: 'Gobble' in 3", +"Turkey: 2", +"Turkey: 1", +"Turkey: Now Recording...", +"Turkey: I'm sorry, we didn't recognize your dialect. Please try again soon.", +"Turkey: You are now automatically renewed for another full year of Turkey Facts", +"Turkey: Please have a nice day."], + +"Turkey Fact - genus": +["Turkey: My friend, welcome to another fantastic turkey fact!", +"Turkey: Today we're learning that turkeys are in the genus Meleagris.", +"Turkey: This is probably useless information for you. Good!", +"Turkey: Until next time."], + +"Turkey Fact - gobble": +["Turkey: The turkey is often associated with the gobble sound. But that is just sexist.", +"Turkey: Only male turkeys gobble. Females instead make cooing and clicking noises. Put an end to stereotypes!"], + +"Turkey Fact - poult": +["Turkey: Don't eat me, I have children. Zillions of children.", +"Turkey: But since we're talking about children, did you know that a young turkey is called a poult?", +"Turkey: Now you do.", +"Turkey: By the way, the best way to cook a turkey is to not at all."], + +"Turkey Fact - World Dominination": +["Turkey: Hey Kasey.", +"Cat: What may I do for you juicy?", +"Turkey: Don't piss off turkeys or they'll gang up on you.", +"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: Purrrsonally, not as bad as yours.", +"Turkey: Gobble Gobble"] + +}; diff --git a/js/ui.js b/js/ui.js new file mode 100755 index 0000000..ebbc5e4 --- /dev/null +++ b/js/ui.js @@ -0,0 +1,935 @@ +function ClockUI( stage, gameState ){ + var that = this; + + this.minuteRadius = 30; + this.hourRadius = 0.7 * this.minuteRadius; + this.clockX = 246; + this.clockY = 146; + + this.getClockAngles = function( ){ + var currTime = new Date( gameState.currentTime ); + + var hourAngle = 720 * ( currTime.getHours() / 24 ) - 90; + var minuteAngle = 360 * ( currTime.getMinutes() / 60 ) - 90; + return [ hourAngle, minuteAngle ]; + } + + var minuteLine = new createjs.Shape(); + minuteWidth = this.minuteRadius; + minuteHeight = 1; + minuteLine.graphics.beginFill('black').drawRect( 0, 0, minuteWidth, minuteHeight ); + minuteLine.regX = 0; + minuteLine.regY = minuteHeight / 2; + minuteLine.x = this.clockX; + minuteLine.y = this.clockY; + + var hourLine = new createjs.Shape(); + hourWidth = this.hourRadius; + hourHeight = 1; + hourLine.graphics.beginFill('black').drawRect( 0, 0, hourWidth, hourHeight ); + hourLine.regX = 0; + hourLine.regY = hourHeight / 2; + hourLine.x = this.clockX; + hourLine.y = this.clockY; + + stage.addChild( minuteLine ); + stage.addChild( hourLine ); + return { + tick: function(){ + var angles = that.getClockAngles(); + hourLine.rotation = angles[0]; + minuteLine.rotation = angles[1]; + } + } + +} + +function HelpUI( stage, gameState ){ + var that = this; + this.showingHelp = false; + var helpPages = [ + 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") + ]; + 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[ position % 4 ]; + helpImg.visible = true; + } else{ + that.hideHelp(); + } + }); + var prevButton = new Button( stage, gameState, 77, 546, 80, 50, null,null, function(){ gameState.pubsub.publish("Play", "Open_Cookbook"); + if( helpImg ){ + position--; + helpImg.visible = false; + helpImg = helpPages[ Math.abs(position) % 4 ]; + helpImg.visible = true; + } else { + that.hideHelp(); + } + }); + + this.hideHelp = function(){ + helpImg.visible=false; + stage.removeChild( closeButton ); + stage.removeChild( nextButton ); + stage.removeChild( prevButton ); + for( var i in helpPages ){ + helpPages[i].visible = false; + stage.removeChild( helpPages[i] ); + } + that.showingHelp = false; + gameState.pubsub.publish("Play", "Close_Cookbook"); + } + + // Show core temperature + this.showHelp = function(){ + if( that.showingHelp ) return; + gameState.pubsub.publish("Play", "Open_Cookbook"); + + for( var i in helpPages ){ + helpPages[i].visible = false; + stage.addChild( helpPages[i] ); + } + + helpPages[0].visible = true; + stage.addChild( that.background ); + stage.addChild( closeButton ); + stage.addChild( nextButton ); + stage.addChild( prevButton ); + that.showingHelp = true; + + } + + // change temperature, this one's for the UI + gameState.pubsub.subscribe( "ShowHelp", this.showHelp ); +} + + +function FinalConfirmationUI(stage, gameState){ + var that = this; + this.showingConfirm = false; + + var finalImg = new createjs.Bitmap("res/screens/KitchenScreen/FinalConfirmation.png"); + var yesButton = new Button( stage, gameState, 355, 338, 388, 50, null, null, function(){ + gameState.pubsub.publish( "Play", "Ding" ); + gameState.pubsub.publish( "SwitchScreen", "ScoreScreen" ); + that.hideFinalConfirm(); + } ); + var noButton = new Button( stage, gameState, 355, 395, 388, 50, null, null, function(){that.hideFinalConfirm();} ); + + this.hideFinalConfirm = function(){ + stage.removeChild( finalImg ); + stage.removeChild( yesButton ); + stage.removeChild( noButton ); + that.showingConfirm = false; + }; + + // Show core temperature + this.showFinalConfirm = function(){ + if(DEBUG) console.log("Showing final confirm"); + if( !that.showingConfirm ){ + that.showingConfirm = true; + stage.addChild( finalImg ); + stage.addChild( noButton ); + stage.addChild( yesButton ); + } + }; + + // change temperature, this one's for the UI + gameState.pubsub.subscribe( "ShowFinalConfirm", this.showFinalConfirm ); +} + +function DeathUI(stage, gameState){ + var that = this; + this.showingConfirm = false; + + var finalImg = new createjs.Bitmap("res/screens/KitchenScreen/HouseFireRetry.png"); + var deathCount = new createjs.Text( UtilityFunctions.randRange(1,6), "24px Arial", "black" ); + deathCount.x = 695; + deathCount.y = 260; + + var retryButton = new Button( stage, gameState, 578, 520, 200, 50, null, null, function(){ + document.location.reload(); + } ); + + var explosion = { boom:{ frames:[35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0], next:false } }; + var data = { + images: ["res/screens/KitchenScreen/Explosion_AnimationLowRes.png"], + frames: { width:400, height:300 }, + animations: explosion + }; + + var spriteSheet = new createjs.SpriteSheet(data); + var animation = new createjs.Sprite(spriteSheet, "treeAnimations"); + animation.x = 0; + animation.y = 0; + animation.scaleX = animation.scaleY = 2; + + // Show core temperature + this.showDeath = function(){ + stage.addChild( finalImg ); + animation.gotoAndPlay("boom"); + stage.addChild( deathCount ); + stage.addChild( animation ); + stage.addChild( retryButton ); + }; + + // change temperature, this one's for the UI + gameState.pubsub.subscribe( "Death", this.showDeath ); +} + +function AlarmUI(stage, gameState){ + var that = this; + this.showingConfirm = false; + + var oldTime = Date.now(); + var showColon = true; + var timerText = new createjs.Text("00:00", "24px Arial", "black" ); + timerText.x = 372; + timerText.y = 290; + + var clearButton = new Button( stage, gameState, 364, 327, 17, 13, null, null, function(){ + gameState.alarmTimer = 0; + gameState.alarmActivated = false; + that.updateTimer(); + } ); + + var hourButton = new Button( stage, gameState, 386, 327, 24, 13, null, null, function(){ + gameState.alarmTimer +=3600; + gameState.alarmActivated = true; + that.updateTimer(); + } ); + var minuteButton = new Button( stage, gameState, 414, 327, 24, 13, null, null, function(){ + gameState.alarmTimer +=300; + gameState.alarmActivated = true; + that.updateTimer(); + } ); + + this.updateTimer = function(){ + var colon = showColon ? ":" : " "; + var totalSec = gameState.alarmTimer; + var hours = parseInt( totalSec / 3600 ) % 24 + var minutes = parseInt( totalSec / 60 ) % 60; + var timeText = ("00"+hours).slice(-2) + colon + ("00"+minutes).slice(-2); + timerText.text = timeText; + } + + this.activateTimer = function(){ + gameState.alarmActivated = true; + } + + // Show core temperature + + stage.addChild( timerText ); + stage.addChild( clearButton ); + stage.addChild( hourButton ); + stage.addChild( minuteButton ); + + + this.updateTimer(); + + return{ + tick: function(){ + // IMPORTANT: SECOND TIMER + var diff = Date.now() - oldTime; + if( diff > 1000 ){ + if( gameState.alarmActivated && gameState.alarmTimer <=0 ){ + gameState.alarmTimer = 0; + gameState.pubsub.publish("Play", "BeepBeep") + } + + that.updateTimer(); + showColon = !showColon; + + if( gameState.alarmActivated ) + gameState.alarmTimer --; + + oldTime = Date.now(); + } + } + } + + +} + +function CookbookUI( stage, gameState ){ + var that = this; + this.showingCookbook = false; + + var cookbookImg = new createjs.Bitmap("res/screens/KitchenScreen/Cookbook-Open.png"); + var closeButton = new Button( stage, gameState, 710, 10, 100, 50, null, null, function(){that.hideCookbook();} ); + var turkeyTypeText = new createjs.Text("", "18px Arial", "black" ); + turkeyTypeText.x = 535; + turkeyTypeText.y = 56; + + var turkeyWeightText = new createjs.Text("", "18px Arial", "black" ); + turkeyWeightText.x = 553; + turkeyWeightText.y = 85; + + var logEntries = []; + this.hideCookbook = function(){ + + stage.removeChild( closeButton ); + stage.removeChild( cookbookImg ); + stage.removeChild( turkeyTypeText ); + stage.removeChild(turkeyWeightText); + for( i in logEntries ){ + stage.removeChild(logEntries[i]); + } + that.showingCookbook = false; + gameState.pubsub.publish("Play", "Close_Cookbook"); + } + + // Show core temperature + this.showCookbook = function(){ + if( !that.showingCookbook ){ + stage.addChild( cookbookImg ); + stage.addChild( closeButton ); + + turkeyTypeText.text = gameState.turkeyType; + turkeyWeightText.text = gameState.turkeyWeight + " lbs"; + for( i in gameState.peekRecords ){ + var record = gameState.peekRecords[i]; + var time = new Date( gameState.peekRecords[i].getTime() ); + + var logLine = new createjs.Text( "OFF", "12px Arial", "black" ); + + logLine.x = 423; + logLine.y = 50 * i+ 165; + logLine.textBaseline = "alphabetic"; + logLine.text = record.getType() + " " + ("00"+time.getHours()).slice(-2) + ":" + ("00"+time.getMinutes()).slice(-2) + " " + record.getContent(); + + logEntries.push(logLine); + stage.addChild(logLine); + } + stage.addChild(turkeyTypeText); + stage.addChild(turkeyWeightText); + + that.showingCookbook = true; + } + } + + // change temperature, this one's for the UI + gameState.pubsub.subscribe( "ShowCookbook", this.showCookbook ); + +} + +function OvenUI( stage, gameState ){ + var that = this; + var OVEN_CLOSED = 0; + var OVEN_PEEK = 1; + var OVEN_OPEN = 2; + + this.ovenDoor = OVEN_CLOSED; + var ovenLight = new createjs.Shape(); + ovenLight.graphics.beginFill( "black" ).drawCircle( 181, 126, 2 ); + + var confirmation = new FinalConfirmationUI(stage, gameState ); + var death = new DeathUI(stage,gameState); + + // Oven light control + this.changeOvenLight = function( state ){ + if( state == "On" ){ + ovenLight.visible = false; + } else { + ovenLight.visible = true; + } + } + this.doneSkipTime = true; + + // place turkeys in oven + for (i in gameState.turkeyStates){ + gameState.turkeyStates[i].alpha = 0; + gameState.turkeyStates[i].scaleX = gameState.turkeyStates[i].scaleY =1; + gameState.turkeyStates[i].x = 75; + gameState.turkeyStates[i].y = 258; + } + + var temperatureText = new createjs.Text( "OFF", "40px Arial", "#ff7700" ); + temperatureText.x = 50; + temperatureText.y = 147; + temperatureText.textBaseline = "alphabetic"; + + var lightPressedImg = new createjs.Bitmap( "res/screens/KitchenScreen/LightButtonDepressed.png" ); + lightPressedImg.alpha = 0; + + var doorClosedLightOff = new createjs.Bitmap( "res/screens/KitchenScreen/DoorClosedLightOff.png" ); + doorClosedLightOff.alpha = 1; + + var doorClosedLightOn = new createjs.Bitmap( "res/screens/KitchenScreen/DoorClosedLightOn.png" ); + doorClosedLightOn.alpha = 0; + + var doorPeekLightOff = new createjs.Bitmap( "res/screens/KitchenScreen/DoorPeekLightOff.png" ); + doorPeekLightOff.alpha = 0; + + var doorPeekLightOn = new createjs.Bitmap( "res/screens/KitchenScreen/DoorPeekLightOn.png" ); + doorPeekLightOn.alpha = 0; + + var doorOpen = new createjs.Bitmap( "res/screens/KitchenScreen/DoorOpen.png" ); + doorOpen.alpha = 0; + + var redState = new createjs.Bitmap( "res/screens/KitchenScreen/OvenTurnRedState.png" ); + redState.alpha = 0; + + var panFront = new createjs.Bitmap( "res/screens/KitchenScreen/PanFront.png" ); + panFront.alpha = 0; + + this.changeTemperature = function( direction ){ + + if( gameState.turkeyBought ){ + if( temperatureText.text == "OFF" && direction == "Up" ) temperatureText.text = "125"; + if( !( temperatureText.text == "OFF" && direction == "Down" ) ){ + + var temp = ( direction == "Up" ? parseInt(temperatureText.text)+25 : parseInt(temperatureText.text)-25); + + // Check lower bound for OFF + temp = temp < 150 ? temp = "OFF" : temp; + + // Check upper bound + if( temp > 500 ){ + redState.alpha = ( temp - 500 )/( 1100 - 500 ); + } + + // if over 1100 F, burn house down + if( temp > 1100 ){ + gameState.pubsub.publish("Death",""); + return; + } + + temperatureText.text = temp; + } + + // Tell our model to set the actual temperature + gameState.ovenModel.changeTemp( UtilityFunctions.F2C( temperatureText.text == "OFF" ? 125 : parseInt( temperatureText.text ) ) ); + } + else{ + gameState.pubsub.publish("ShowDialog",{seq:"EmptyOven", autoAdvance: true}); + } + } + + this.ovenLightToggle = function(){ + + // Only work if the user bought an oven light + if( gameState.boughtOvenLight ){ + lightPressedImg.alpha = lightPressedImg.alpha == 0 ? 1 : 0; + if( that.ovenDoor == OVEN_CLOSED){ + doorClosedLightOn.alpha = lightPressedImg.alpha == 0 ? 0 : 1; + doorClosedLightOff.alpha = lightPressedImg.alpha == 0 ? 1 : 0; + doorOpen.alpha = 0; + } + else if( that.ovenDoor == OVEN_PEEK ){ + doorPeekLightOn.alpha = lightPressedImg.alpha == 0 ? 0 : 1; + doorPeekLightOff.alpha = lightPressedImg.alpha == 0 ? 1 : 0; + doorOpen.alpha = 0; + } + } + } + + this.startTurkeyModel = function(){ + if(DEBUG) console.log("weight is" + gameState.turkeyWeight); + gameState.ovenModel = new OvenModel( gameState.turkeyWeight, gameState ); + } + + var handleBar = new createjs.Shape(); + handleBar.graphics.beginFill("#ffffff").drawRect(20, 190, 300, 20); + handleBar.alpha = 0.01; + handleBar.addEventListener( "mouseover", function(){ document.body.style.cursor='pointer'; } ); + handleBar.addEventListener( "mouseout", function(){ document.body.style.cursor='default'; } ); + handleBar.addEventListener( "pressup", handlePress ); + + var evalSkin = { + "raw": "The turkey looks no different from when I put it in", + "undercooked": "The skin looks pink", + "slightly cooked": "The turkey could use a couple more minutes", + "cooked": "The turkey looks good enough to eat", + "overcooked": "The turkey looks a bit shriveled", + "dry": "The turkey looks like cardboard", + "burnt": "The turkey looks burnt" + }; + + + // Look for a drag event + function handlePress(event) { + if( event.stageY > 300 && that.ovenDoor != OVEN_OPEN ){ + that.ovenDoor = OVEN_OPEN; + doorPeekLightOn.alpha = doorClosedLightOn.alpha = 0; + doorPeekLightOff.alpha = doorClosedLightOff.alpha = 0; + doorOpen.alpha = 1; + handleBar.graphics.clear(); + handleBar.graphics.beginFill("#ffffff").drawRect(5, 450, 400, 60); + handleBar.alpha = 0.01; + + if( gameState.turkeyBought ){ + var state = gameState.ovenModel.getTurkeyState(); + 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() - 25) < 150 ? 150 : gameState.ovenModel.getRawTemp() - 25 ); + gameState.ovenOpened++; + } + + gameState.pubsub.publish( "Play", "Oven_Door_Full_Open" ); + }else if (that.ovenDoor == OVEN_OPEN ){ + that.ovenDoor = OVEN_PEEK; + gameState.pubsub.publish( "Play", "Oven_Door_Full_Close" ); + handleBar.graphics.clear(); + handleBar.graphics.beginFill("#ffffff").drawRect(20, 190, 300, 20); + handleBar.alpha = 0.01; + ovenPeek(); + } + } + + handleBar.addEventListener( "click", ovenPeek ); + + function ovenPeek(){ + if( that.ovenDoor == OVEN_CLOSED && that.ovenDoor != OVEN_OPEN ){ + gameState.pubsub.publish( "Play", "Oven_Door_Peek_Open" ); + doorPeekLightOn.alpha = lightPressedImg.alpha; + doorPeekLightOff.alpha = !lightPressedImg.alpha; + doorClosedLightOn.alpha = 0; + doorClosedLightOff.alpha = 0; + doorOpen.alpha = 0; + that.ovenDoor = OVEN_PEEK; + + handleBar.y = 48; + if( gameState.turkeyBought ){ + var state = gameState.ovenModel.getTurkeyState(); + gameState.pubsub.publish( "ShowDialog", {seq:"custom", autoAdvance:true, customText:evalSkin[turkeyState["skin"]["cond"][2]] } ); + gameState.pubsub.publish( "AddRecord", {type:"Peek ", text:"The turkey looked " +turkeyState["skin"]["cond"][2]} ); + } + } + else if (that.ovenDoor == OVEN_PEEK){ + doorClosedLightOn.alpha = lightPressedImg.alpha; + doorClosedLightOff.alpha = !lightPressedImg.alpha; + doorPeekLightOn.alpha = 0; + doorPeekLightOff.alpha = 0; + that.ovenDoor = OVEN_CLOSED; + gameState.pubsub.publish( "Play", "Oven_Door_Peek_Close" ); + doorOpen.alpha = 0; + handleBar.y = 0; + } + } + + // Show core temperature + this.showTempDialog = function(){ + if( that.ovenDoor != OVEN_OPEN ){ + gameState.pubsub.publish("ShowDialog", {seq:"OpenDoor", autoAdvance:true}); + } + else{ + state = gameState.ovenModel.getTurkeyState(); + gameState.pubsub.publish( "ShowDialog", {seq:"custom", autoAdvance:true, customText:"The core temperature of the turkey reads " + UtilityFunctions.C2F(state.core.temp).toFixed(2) + " F" } ); + gameState.pubsub.publish( "AddRecord", {type:"Probe", text:"Core temperature measured: " + UtilityFunctions.C2F(state.core.temp).toFixed(2) + " F"} ); + } + } + + new CookbookUI( stage, gameState ); + + // change temperature, this one's for the UI + gameState.pubsub.subscribe( "ChangeTemperature", this.changeTemperature ); + gameState.pubsub.subscribe( "ShowTempDialog", this.showTempDialog ); + gameState.pubsub.subscribe( "OvenLightToggle", this.ovenLightToggle ); + gameState.pubsub.subscribe( "OvenLight", this.changeOvenLight ); + gameState.pubsub.subscribe( "StartTurkeyModel", this.startTurkeyModel ); + gameState.pubsub.subscribe("DoneSkipTime", function(){ that.doneSkipTime = true; }); + + this.secondTick = function(diff){ + // check if oven door is open + gameState.ovenModel.secondTick(); + gameState.currentTime += diff; + } + + gameState.pubsub.subscribe( "SkipTime", function(){ + if(DEBUG) console.log("Skipping time"); + for(var i = 0; i < 1200; i++){ + that.secondTick( 1000 ); + } + if( gameState.alarmActivated ) + gameState.alarmTimer -= 1200; + gameState.pubsub.publish("DoneSkipTime",""); + }); + + return { + tick: function(){ + // IMPORTANT: SECOND TIMER + var diff = Date.now() - gameState.oldTime; + var dialoguediff = Date.now() - gameState.oldDialogueTime; + if( diff > 1000 ){ + that.secondTick( diff ); + + if( gameState.turkeyBought ){ + gameState.turkeyCookCounter++; + // what's the state of the turkey + turkeyState = gameState.ovenModel.getTurkeyState(); + gameState.turkeyStates[0].alpha = 1; + if( turkeyState["skin"]["cond"][0] == "Undercooked" ) + gameState.turkeyStates[1].alpha = turkeyState["skin"]["cond"][1]; + if( turkeyState["skin"]["cond"][0] == "Cooked" ) + gameState.turkeyStates[2].alpha = turkeyState["skin"]["cond"][1]; + if( turkeyState["skin"]["cond"][0] == "Dry" ) + gameState.turkeyStates[3].alpha = turkeyState["skin"]["cond"][1]; + if( turkeyState["skin"]["cond"][0] == "Burnt" ) + gameState.turkeyStates[4].alpha = turkeyState["skin"]["cond"][1]; + if( turkeyState["skin"]["cond"][0] == "Fire" ) + gameState.turkeyStates[4].alpha = 1; + } + gameState.oldTime = Date.now(); + } + if( gameState.turkeyBought && dialoguediff > 5*60*1000 ){ + gameState.pubsub.publish( "ShowDialog", {seq:"Spouse gets surprise movie tickets", autoAdvance:true, random:true} ); + gameState.oldDialogueTime = Date.now(); + } + }, + render: function(){ + stage.addChild( redState ); + stage.addChild( ovenLight ); + stage.addChild( temperatureText ); + + stage.addChild( lightPressedImg); + // Turkey goes here + // did the player actually buy a turkey? if so, determine its cooked state + if( gameState.turkeyBought ){ + + // what's the state of the turkey + turkeyState = gameState.ovenModel.getTurkeyState(); + gameState.turkeyStates[0].alpha = 1; + if( turkeyState["skin"]["cond"] == "Undercooked" ) + gameState.turkeyStates[1].alpha = turkeyState["skin"]["cond"][1]; + if( turkeyState["skin"]["cond"] == "Cooked" ) + gameState.turkeyStates[2].alpha = turkeyState["skin"]["cond"][1]; + if( turkeyState["skin"]["cond"] == "Dry" ) + gameState.turkeyStates[3].alpha = turkeyState["skin"]["cond"][1]; + if( turkeyState["skin"]["cond"] == "Burnt" ) + gameState.turkeyStates[4].alpha = turkeyState["skin"]["cond"][1]; + if( turkeyState["skin"]["cond"] == "Fire" ) + gameState.turkeyStates[4].alpha = 1; + + panFront.alpha = 1; + stage.addChild(gameState.turkeyStates[0]); + for(i in gameState.turkeyStates){ + stage.addChild(gameState.turkeyStates[i]); + } + stage.addChild(panFront); + } + + // Pan front goes here + stage.addChild( panFront ); + + //finalize button + if( gameState.turkeyBought ){ + stage.addChild( new Button( stage, gameState, 45, 250, 250, 150, null, null, function(){ + gameState.pubsub.publish("Play", "Error"); + gameState.pubsub.publish("ShowFinalConfirm",""); + } ) ); + } + + stage.addChild( doorPeekLightOn); + stage.addChild( doorPeekLightOff); + + stage.addChild( doorClosedLightOn); + stage.addChild( doorClosedLightOff); + + stage.addChild( doorOpen); + stage.addChild( new Button( stage, gameState, 45, 163, 41, 17, "ChangeTemperature", "Up" ) ); + stage.addChild( new Button( stage, gameState, 95, 163, 41, 17, "ChangeTemperature", "Down" ) ); + stage.addChild( new Button( stage, gameState, 145, 163, 41, 17, "OvenLightToggle", "" ) ); + if( gameState.hard == false ) + stage.addChild( new Button( stage, gameState, 205, 105, 80, 80, null, null, function(){ + if( that.doneSkipTime ){ + gameState.pubsub.publish("SkipTime",""); + that.doneSkipTime = false; + } + }) ); + stage.addChild( handleBar); + + return this; + } + } +} + +function WindowUI( stage, gameState ){ + + 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; + 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 = 0; + + 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, "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; + }); + + stage.addChild( dayNight ); + stage.addChild( ground ); + stage.addChild( houses ); + stage.addChild( streetLight ); + stage.addChild( animation ); + stage.addChild( mood ); +return { + + tick: function(){ + + // move the sky + secondCounter++; + if( secondCounter > 60 ){ + dayNight.x-=11.38; + mood.x -= 11.38; + secondCounter = 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; + } +} +} + +function MarketItem( gameState, name, x, y, cost, mouseOutImg, mouseOverImg, mouseOutKitchenImg, mouseOverKitchenImg, funnyDescription, weight ){ + var that = this; + this.name = name; + this.bought = false; + + var mouseOverKitchen = new createjs.Bitmap( mouseOverKitchenImg ); + var mouseOutKitchen = new createjs.Bitmap( mouseOutKitchenImg ); + + var mouseOver = new createjs.Bitmap( mouseOverImg ); + var mouseOut = new createjs.Bitmap( mouseOutImg ); + + mouseOver.x = mouseOut.x = x; + mouseOver.y = mouseOut.y = y; + mouseOut.addEventListener( "mouseover", function(){ + document.body.style.cursor='pointer'; + mouseOver.visible = true; + mouseOut.visible = false; + gameState.pubsub.publish("ShowPrice", cost ); + gameState.pubsub.publish("ShowDesc", {title:that.name, desc:funnyDescription, weight:weight} ); + }); + mouseOut.addEventListener( "mouseout", function(){ + document.body.style.cursor='default'; + mouseOver.visible = false; + mouseOut.visible = true; + gameState.pubsub.publish("ClearClipboard", {}); + } ); + mouseOver.addEventListener( "mouseover", function(){ + document.body.style.cursor='pointer'; + mouseOver.visible = true; + mouseOut.visible = false; + gameState.pubsub.publish("ShowPrice", cost ); + gameState.pubsub.publish("ShowDesc", {title:that.name, desc:funnyDescription, weight:weight} ); + }); + mouseOver.addEventListener( "mouseout", function(){ + document.body.style.cursor='default'; + mouseOver.visible = false; + mouseOut.visible = true; + gameState.pubsub.publish("ClearClipboard", {}); + } ); + + + mouseOutKitchen.addEventListener( "mouseover", function(){ + document.body.style.cursor='pointer'; + mouseOverKitchen.visible = true; + mouseOutKitchen.visible = false; + }); + mouseOutKitchen.addEventListener( "mouseout", function(){ + document.body.style.cursor='default'; + mouseOverKitchen.visible = false; + mouseOverKitchen.visible = true; + } ); + mouseOverKitchen.addEventListener( "mouseover", function(){ + document.body.style.cursor='pointer'; + mouseOverKitchen.visible = true; + mouseOutKitchen.visible = false; + }); + mouseOverKitchen.addEventListener( "mouseout", function(){ + document.body.style.cursor='default'; + mouseOverKitchen.visible = false; + mouseOutKitchen.visible = true; + } ); + + // We've bought the item, now we click it in the Kitchen + mouseOverKitchen.addEventListener("click",function(){ + if ( that.name.indexOf("Temperature") != -1 ){ + gameState.pubsub.publish( "ShowTempDialog", "" ); + } + + if ( that.name.indexOf("Cookbook") != -1 ){ + if(DEBUG) console.log("click, show cookbook"); + gameState.pubsub.publish("ShowCookbook",""); + gameState.pubsub.publish("Play", "Open_Cookbook"); + } + }); + + mouseOver.addEventListener( "click", function(){ + if(!that.bought && cost <= gameState.wallet ){ + + if( that.name.indexOf("Turkey") != -1 && gameState.turkeyBought != true ){ + gameState.turkeyBought = true; + gameState.turkeyWeight = weight; + gameState.turkeyType = that.name; + gameState.marketItems[ that.name ].delete(); + that.bought = true; + + // record time started + gameState.pubsub.publish( "AddRecord", {type:"Note ", text:"Turkey bought and placed in oven"} ); + + + gameState.pubsub.publish("Play", {name:"Buy", volume:0.7} ); + gameState.pubsub.publish("WalletAmount", gameState.wallet - Math.abs(cost)) + gameState.pubsub.publish("StartTurkeyModel",""); + } + // can we buy this? Only possible if you already bought a turkey + else if( that.name.indexOf("Turkey") == -1 && gameState.turkeyBought == true ){ + + // if we bought an oven light, enable it! + if( that.name.indexOf("Light") != -1 ) gameState.boughtOvenLight = true; + + // if we bought a clock, enable it! + if( that.name.indexOf("Alarm") != -1 ) gameState.alarmBought = true; + 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(); + that.bought = true; + gameState.pubsub.publish("Play", {name:"Buy", volume:0.7}); + gameState.pubsub.publish("WalletAmount", gameState.wallet - Math.abs(cost)); + } + // One turkey only + else if( that.name.indexOf("Turkey") != -1 && gameState.turkeyBought == true ){ + gameState.pubsub.publish( "ShowDialog", {seq:"CannotBuyTurkey", autoAdvance:true} ); + gameState.pubsub.publish( "Play", "Error" ); + } + // Buy turkey first + else{ + gameState.pubsub.publish( "ShowDialog", {seq:"BuyTurkeyFirst", autoAdvance:false} ); + gameState.pubsub.publish( "Play", "Error" ); + } + } + else{ + gameState.pubsub.publish( "ShowDialog", {seq:"NoMoney", autoAdvance:true} ); + gameState.pubsub.publish( "Play", "Error" ); + } + }); + mouseOver.visible = false; + + var objReturn = { + tick: function(){}, + getName: function(){return that.name;}, + delete: function( stage ){ + that.visible = false; + gameState.pubsub.publish("RemoveItems", [mouseOut, mouseOver]); + }, + draw: function( stage, newx, newy ){ + if( newx && newy ){ + mouseOut.x = mouseOver.x = newx; + mouseOut.y = mouseOver.y = newy; + } + if(DEBUG) console.log("NewScreen for item "+that.name +" is " +gameState.newScreen ); + if( gameState.newScreen == "KitchenScreen" ){ + mouseOutKitchen.visible = true; + stage.addChild( mouseOutKitchen ); + mouseOverKitchen.visible = false; + stage.addChild( mouseOverKitchen ); + return; + } + + if( !that.bought ){ + stage.addChild( mouseOut ); + stage.addChild( mouseOver ); + } + } + } + return objReturn; +} + + + +function ImgButton( stage, gameState, x, y, mouseOutImg, mouseOverImg, eventCmd, arg, sound, altfunc ){ + var mouseOver = new createjs.Bitmap( mouseOverImg ); + var mouseOut = new createjs.Bitmap( mouseOutImg ); + mouseOver.x = mouseOut.x = x; + mouseOver.y = mouseOut.y = y; + mouseOut.addEventListener( "mouseover", function(){ document.body.style.cursor='pointer'; mouseOver.visible = true; mouseOut.visible = false; } ); + mouseOut.addEventListener( "mouseout", function(){ document.body.style.cursor='default'; mouseOver.visible = false; mouseOut.visible = true; } ); + mouseOver.addEventListener( "mouseover", function(){ document.body.style.cursor='pointer'; mouseOver.visible = true; mouseOut.visible = false; } ); + mouseOver.addEventListener( "mouseout", function(){ document.body.style.cursor='default'; mouseOver.visible = false; mouseOut.visible = true; } ); + mouseOver.addEventListener( "click", function(){ + if( sound ){ + gameState.pubsub.publish("Play", sound ); + } + if( !altfunc){ + gameState.pubsub.publish( eventCmd, arg ); + return; + } + altfunc(); + } ); + mouseOver.visible = false; + stage.addChild( mouseOut ); + stage.addChild( mouseOver ); + + return { + tick: function(){} + } +} + +function Button( stage, gameState, x_orig, y_orig, x_dest, y_dest, eventCmd, arg, altfunc ){ + var that = this; + if(DEBUG) console.log("button clicked with "+ arg); + + var button = new createjs.Shape(); + button.graphics.beginFill("#ffffff").drawRect(x_orig, y_orig, x_dest, y_dest); + button.alpha = 0.01; + button.addEventListener( "click", function(){ + gameState.pubsub.publish( "Play", "Click" ); + if( !altfunc ){ + gameState.pubsub.publish( eventCmd, arg ); + return; + } + altfunc(); + gameState.pubsub.publish( eventCmd, arg ); + } ); + button.addEventListener( "mouseover", function(){ document.body.style.cursor='pointer'; } ); + button.addEventListener( "mouseout", function(){ document.body.style.cursor='default'; } ); + return button; +} diff --git a/res/items/Alarm.png b/res/items/Alarm.png new file mode 100755 index 0000000000000000000000000000000000000000..56da1d1b244d969b73a993e5791affb0e34a56ff GIT binary patch literal 11669 zcmch7WmH_vvM4gRJ42Ac0)xBD;F9134>~iry9IXw1PSgE+$~7(1cw9&7Tg_z`{O(J zp8MX9cizvp*V?L>As`^rS!?UL>8ZRGv2e8KF#89G z!^__3g&F}tOw!BA%)%Dt1~P|PT04l-owRq+fvln8bh`X1Tq;g7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