Browse Source

Loading screen actual commit

Load_Fix
Robert Chen 11 years ago
parent
commit
b665b2cc74
  1. 8
      index.html
  2. 2
      js/dialogue.js
  3. 110
      js/main.js
  4. 83
      js/screens.js
  5. 11
      js/soundmanager.js
  6. 2
      js/stories.js
  7. 16
      js/ui.js
  8. BIN
      res/DialogueBox.png
  9. BIN
      res/Grass.png
  10. BIN
      res/Loading/.DS_Store
  11. BIN
      res/Loading/Loading-Title-Mockup.png
  12. BIN
      res/Loading/Loading-Title.png
  13. BIN
      res/Loading/PanFront.png
  14. BIN
      res/Loading/TextCooking.png
  15. BIN
      res/Loading/TextDone.png
  16. BIN
      res/Loading/Turkey0.png
  17. BIN
      res/Loading/Turkey25.png
  18. BIN
      res/Loading/Turkey50.png
  19. BIN
      res/Loading/Turkey75.png
  20. BIN
      res/Loading/TurkeyDone.png
  21. BIN
      res/Main-Screen.png
  22. BIN
      res/MainScreen/.DS_Store
  23. BIN
      res/MainScreen/ButtonCredits.png
  24. BIN
      res/MainScreen/ButtonHelp.png
  25. BIN
      res/MainScreen/ButtonStart.png
  26. BIN
      res/Untitled-1.png
  27. BIN
      res/items/Bottle1.png
  28. BIN
      res/items/Bottle1Glow.png
  29. BIN
      res/items/Bottle2.png
  30. BIN
      res/items/Bottle2Glow.png
  31. BIN
      res/items/Bottle3.png
  32. BIN
      res/items/Bottle3Glow.png
  33. BIN
      res/screens/MarketScreen.png
  34. BIN
      res/screens/MarketTopShelf.png
  35. BIN
      res/sound/Store/Background Sounds/.DS_Store
  36. BIN
      res/sound/Store/Background Sounds/72565__wrinex__supermarkt-ms Loop 2.ogg
  37. BIN
      res/sound/Store/Background Sounds/72565__wrinex__supermarkt-ms Loop 3.mp3
  38. BIN
      res/sound/Store/Background Sounds/72565__wrinex__supermarkt-ms Loop 3.ogg
  39. BIN
      res/sound/Store/Background Sounds/72565__wrinex__supermarkt-ms Loop 4.ogg
  40. BIN
      res/sound/Store/Background Sounds/72565__wrinex__supermarkt-ms Loop 5.ogg
  41. BIN
      res/sound/Store/Background Sounds/72565__wrinex__supermarkt-ms Loop 6.ogg
  42. BIN
      res/sound/Store/Background Sounds/72565__wrinex__supermarkt-ms Loop1.mp3
  43. BIN
      res/sound/Store/Background Sounds/72565__wrinex__supermarkt-ms Loop1.ogg
  44. BIN
      res/sound/Store/backgroundSound.mp3
  45. BIN
      res/sound/Waterford.mp3
  46. BIN
      res/sound/supermarket.mp3

8
index.html

@ -6,7 +6,7 @@
<br/><br/><br/><br/> <br/><br/><br/><br/>
<center> <center>
<div class="canvasContainer"> <div class="canvasContainer">
<canvas onmousemove="showXY(event)" id="demoCanvas" width="800" height="600" style="border:1px solid #000000"></canvas> <canvas id="demoCanvas" width="800" height="600" style="border:1px solid #000000"></canvas>
</div> </div>
</center> </center>
<script> <script>
@ -23,7 +23,7 @@
<script src="js/main.js"></script> <script src="js/main.js"></script>
<script> <script>
new GameState(); new GameState();
/*
function showXY(e) function showXY(e)
{ {
var mouseX, mouseY; var mouseX, mouseY;
@ -37,8 +37,8 @@
mouseY = e.layerY; mouseY = e.layerY;
} }
console.log("x: " + mouseX + "y :" + mouseY); console.log("x: " + mouseX + "y :" + mouseY);
/* do something with mouseX/mouseY */
} }*/
</script> </script>
<!-- Load all the things! --> <!-- Load all the things! -->
</html> </html>

2
js/dialogue.js

@ -27,7 +27,7 @@ function DialogUI( stage, gameState ){
this.currDialogueSeq = new DialogueSequence("Null"); this.currDialogueSeq = new DialogueSequence("Null");
dialogQueue = []; dialogQueue = [];
this.dialogBox = new createjs.Bitmap("res/DialogueBox.png"); this.dialogBox = new createjs.Bitmap("res/screens/GUI/DialogueBox.png");
this.dialogBox.x = 10; this.dialogBox.x = 10;
this.dialogBox.y = 675; this.dialogBox.y = 675;

110
js/main.js

@ -12,13 +12,88 @@ function GameState(){
// Load all our resources: // Load all our resources:
var queue = new createjs.LoadQueue(true); 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.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"} );*/
//queue.addEventListener("fileload", handleFileComplete); //queue.addEventListener("fileload", handleFileComplete);
// 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: "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: "TitleMusicFile", src:"res/sound/turkey_in_the_straw.mp3"} );
queue.loadFile( {id: "MarketBackgroundSoundFile", src:"res/sound/supermarket.mp3"} ); queue.loadFile( {id: "MarketBackgroundSoundFile", src:"res/sound/Store/supermarket.mp3"} );
queue.loadFile( {id: "MarketBackgroundSoundFile", src:"res/items/FrillsBox.png"} ); queue.loadFile( {id: "MarketSoundFile", src:"res/sound/Store/Waterford.mp3"} );
queue.loadFile( {id: "TurkeySpriteFile", src:"res/TurkeySprite.png"} );
// UI sounds
queue.loadFile( {id: "UIPopFile", src:"res/sound/GUI/pop.mp3"} );
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"} );
// Market Items
queue.loadFile( {id: "FrillsBox.png", src:"res/items/FrillsBox.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"});
this.screenState = 0; this.screenState = 0;
this.newScreen = ""; this.newScreen = "";
@ -49,9 +124,6 @@ function GameState(){
// did we already show the player the kitchen intro? // did we already show the player the kitchen intro?
this.kitchenIntro = false; this.kitchenIntro = false;
this.mainUI = new GameUI( "demoCanvas", this );
createjs.Ticker.addEventListener( "tick", gameLoop );
function addHighScore(name, turkeyPoundage, cookTime, score){ function addHighScore(name, turkeyPoundage, cookTime, score){
var scores = {}; var scores = {};
var now = new Date(); var now = new Date();
@ -77,28 +149,6 @@ function GameState(){
// "main": this // "main": this
} }
} }
/*
createjs.Sound.registerSound("res/sound/supermarket.mp3", "TitleMusic");
var backgroundSound = createjs.Sound.createInstance("TitleMusic"); // play using id. Could also use full sourcepath or event.src.
var backgroundSounds = createjs.Sound.createInstance("TitleMusic");
backgroundSound.setPosition(0);
backgroundSound.volume = 1;
setTimeout(function(){ backgroundSounds.play();},2000);
backgroundSound.play();
// loop-de-loop
backgroundSound.addEventListener("complete", playAgain);
backgroundSound.addEventListener("complete", playAgainMe);
function playAgain(event) {
backgroundSound.setPosition(0);
backgroundSound.play();
}
function playAgainMe(event){
setTimeout(function(){ backgroundSounds.play();},1000);
}
*/
function GameUI( canvasElem, gameState ){ function GameUI( canvasElem, gameState ){
var that = this; var that = this;
@ -115,7 +165,7 @@ function GameUI( canvasElem, gameState ){
/* Initialize All Screens */ /* Initialize All Screens */
this.screens = { this.screens = {
"LoadingTitleScreen" : LoadingTitleScreen, "LoadingScreen" : LoadingScreen,
"InfoHelpScreen" : InfoHelpScreen, "InfoHelpScreen" : InfoHelpScreen,
"MainScreen" : MainScreen, "MainScreen" : MainScreen,
"DifficultyScreen" : DifficultyScreen, "DifficultyScreen" : DifficultyScreen,
@ -129,7 +179,7 @@ function GameUI( canvasElem, gameState ){
var soundManager = new SoundManager( gameState ); var soundManager = new SoundManager( gameState );
this.activeScreenObj = new MainScreen( this.stage, gameState ); this.activeScreenObj = new LoadingScreen( this.stage, gameState );
var textContent = new createjs.Text( "", "20px Arial", "#00000000" ); var textContent = new createjs.Text( "", "20px Arial", "#00000000" );
textContent.x = 750; textContent.x = 750;
textContent.y = 30; textContent.y = 30;

83
js/screens.js

@ -1,22 +1,62 @@
/* Screens, inheritance would be nice */ /* Screens, inheritance would be nice */
function LoadingTitleScreen( stage, gameState ){ function LoadingScreen( stage, gameState ){
var that = this; var that = this;
this.picture = new createjs.Bitmap( "res/Loading-Title.png" ); this.lastPercent = -1;
this.ovenLight = new createjs.Shape(); this.picture = new createjs.Bitmap( "res/screens/LoadingScreen/Loading-Title.png" );
this.ovenLight.graphics.beginFill( "red" ).drawCircle( 396, 318, 5 ); 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", "#ffffffff" );
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 );
}
stage.addChild( this.picture ); //If we're still on image one, don't fade it out, it's the base image!
stage.addChild( this.ovenLight ); 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 );
this.uiElems = [];
this.uiElems.push( new DialogUI( stage, gameState ) );
return { return {
blit : function(){ blit : function(){
// Draw all the uiElements
for( var index in that.uiElems ){
that.uiElems[ index ].tick();
}
} }
} }
} }
@ -44,7 +84,7 @@ function InfoHelpScreen( stage, gameState ){
function MainScreen( stage, gameState ){ function MainScreen( stage, gameState ){
var that = this; var that = this;
this.background = new createjs.Bitmap( "res/Main-Screen.png" ); this.background = new createjs.Bitmap( "res/screens/MainScreen/Main-Screen.png" );
stage.addChild( this.background ); stage.addChild( this.background );
var turkeyAnimations = { peck:[14,24,"peck"], ruffle:[0,13,"ruffle"], stare:[25,35,"stare"] }; var turkeyAnimations = { peck:[14,24,"peck"], ruffle:[0,13,"ruffle"], stare:[25,35,"stare"] };
@ -68,13 +108,13 @@ function MainScreen( stage, gameState ){
} }
stage.addChild(animation); stage.addChild(animation);
this.grassLayer = new createjs.Bitmap( "res/Grass.png" ); this.grassLayer = new createjs.Bitmap( "res/screens/MainScreen/Grass.png" );
stage.addChild( this.grassLayer ); stage.addChild( this.grassLayer );
// buttons info/credits/start // buttons info/credits/start
new ImgButton( stage, gameState, 571,527, "res/MainScreen/ButtonStart.png", "res/MainScreen/ButtonStart.png","SwitchScreen", "DifficultyScreen", "Click" ); 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/MainScreen/ButtonHelp.png", "res/MainScreen/ButtonHelp.png","SwitchScreen", "InfoScreen", "Click" ); new ImgButton( stage, gameState, 17,470, "res/screens/MainScreen/ButtonHelp.png", "res/screens/MainScreen/ButtonHelp.png","SwitchScreen", "InfoScreen", "Click" );
new ImgButton( stage, gameState, 17,527, "res/MainScreen/ButtonCredits.png", "res/MainScreen/ButtonCredits.png","SwitchScreen", "CreditsScreen", "Click" ); 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:1} ); gameState.pubsub.publish( "BackgroundLoop", {name:"TitleMusic", pos:5650, volume:1} );
this.uiElems = []; this.uiElems = [];
@ -135,7 +175,7 @@ function KitchenScreen( stage, gameState ){
gameState.purchasedItems[i].draw( stage, 403+100*i, 350 ); gameState.purchasedItems[i].draw( stage, 403+100*i, 350 );
} }
this.uiElems.push( gameState.ovenUI ? gameState.ovenUI : ( gameState.ovenUI = new OvenUI( stage, gameState ) ) ); this.uiElems.push( gameState.ovenUI ? gameState.ovenUI.render() : ( gameState.ovenUI = new OvenUI( stage, gameState ) ).render() );
this.uiElems.push( new ClockUI( stage, gameState ) ); this.uiElems.push( new ClockUI( stage, gameState ) );
this.uiElems.push( new WindowUI( stage, gameState ) ) this.uiElems.push( new WindowUI( stage, gameState ) )
stage.addChild( new Button( stage, gameState, 500, 40, 450, 105, "SwitchScreen", "MarketScreen" ) ); stage.addChild( new Button( stage, gameState, 500, 40, 450, 105, "SwitchScreen", "MarketScreen" ) );
@ -159,7 +199,7 @@ function KitchenScreen( stage, gameState ){
function MarketScreen( stage, gameState ){ function MarketScreen( stage, gameState ){
var that = this; var that = this;
this.background = new createjs.Bitmap( "res/screens/MarketScreen.png" ); this.background = new createjs.Bitmap( "res/screens/MarketScreen/MarketScreen.png" );
var price = new createjs.Text( "100", "24px Arial", "#00000000" ); var price = new createjs.Text( "100", "24px Arial", "#00000000" );
price.x = 725; price.x = 725;
price.y = 500; price.y = 500;
@ -171,7 +211,7 @@ function MarketScreen( stage, gameState ){
// Play soundz // Play soundz
gameState.pubsub.publish( "Play", {name:"Entrance", volume:0.3} ); gameState.pubsub.publish( "Play", {name:"Entrance", volume:0.3} );
gameState.pubsub.publish( "BackgroundLoop", {name:"MarketMusic", volume:1} ); gameState.pubsub.publish( "BackgroundLoop", {name:"MarketMusic", volume:1} );
gameState.pubsub.publish( "BackgroundLoop", {name:"MarketSound", volume:0.4} ); gameState.pubsub.publish( "BackgroundLoop", {name:"MarketBackgroundSound", volume:0.4} );
stage.addChild( this.background ); stage.addChild( this.background );
stage.addChild(price); stage.addChild(price);
@ -185,7 +225,6 @@ function MarketScreen( stage, gameState ){
} }
this.topground = new createjs.Bitmap( "res/screens/MarketTopShelf.png" ); this.topground = new createjs.Bitmap( "res/screens/MarketTopShelf.png" );
stage.addChild( this.topground ); stage.addChild( this.topground );
this.showPrice = function( cost ){ this.showPrice = function( cost ){
price.text = cost; price.text = cost;

11
js/soundmanager.js

@ -13,7 +13,7 @@ function SoundManager( gameState ){
// Register all sounds loaded in gameState // Register all sounds loaded in gameState
createjs.Sound.registerSound("res/sound/turkey_in_the_straw.mp3", "TitleMusic"); createjs.Sound.registerSound("res/sound/turkey_in_the_straw.mp3", "TitleMusic");
createjs.Sound.registerSound("res/sound/supermarket.mp3", "MarketBackgroundSound"); createjs.Sound.registerSound("res/sound/Store/supermarket.mp3", "MarketBackgroundSound");
createjs.Sound.registerSound("res/sound/Music/Waterford.mp3", "MarketMusic"); createjs.Sound.registerSound("res/sound/Music/Waterford.mp3", "MarketMusic");
createjs.Sound.registerSound("res/sound/GUI/pop.mp3", "Pop"); createjs.Sound.registerSound("res/sound/GUI/pop.mp3", "Pop");
createjs.Sound.registerSound("res/sound/GUI/lowclick.mp3", "LowClick"); createjs.Sound.registerSound("res/sound/GUI/lowclick.mp3", "LowClick");
@ -21,7 +21,6 @@ function SoundManager( gameState ){
createjs.Sound.registerSound("res/sound/GUI/buzz.mp3", "Error"); createjs.Sound.registerSound("res/sound/GUI/buzz.mp3", "Error");
createjs.Sound.registerSound("res/sound/Store/buy.mp3", "Buy"); createjs.Sound.registerSound("res/sound/Store/buy.mp3", "Buy");
createjs.Sound.registerSound("res/sound/Store/entrance.mp3", "Entrance"); createjs.Sound.registerSound("res/sound/Store/entrance.mp3", "Entrance");
createjs.Sound.registerSound("res/sound/Store/backgroundSound.mp3", "MarketSound");
this.backgroundSounds = []; this.backgroundSounds = [];
@ -51,14 +50,14 @@ function SoundManager( gameState ){
else{ else{
newBackgroundSound = soundCache[soundName.name] ? soundCache[soundName.name] : soundCache[soundName.name] = createjs.Sound.createInstance( soundName.name ); newBackgroundSound = soundCache[soundName.name] ? soundCache[soundName.name] : soundCache[soundName.name] = createjs.Sound.createInstance( soundName.name );
newBackgroundSound.setPosition(soundName.pos || 0); newBackgroundSound.setPosition(soundName.pos || 0);
newBackgroundSound.volume = soundName.volume || 1; newBackgroundSound.volume = newBackgroundSound.desiredVolume = soundName.volume || 1;
newBackgroundSound.play(); newBackgroundSound.play();
// loop-de-loop // loop-de-loop
newBackgroundSound.addEventListener("complete", function(){ newBackgroundSound.addEventListener("complete", function(){
if( newBackgroundSound.volume == 0 ){ newBackgroundSound.stop(); return; } if( newBackgroundSound.volume == 0 ){ newBackgroundSound.stop(); return; }
newBackgroundSound.setPosition(soundName.pos || 0); newBackgroundSound.setPosition(soundName.pos || 0);
newBackgroundSound.volume = soundName.volume || 1; newBackgroundSound.volume = newBackgroundSound.desiredVolume = soundName.volume || 1;
newBackgroundSound.play(); newBackgroundSound.play();
}); });
} }
@ -78,8 +77,8 @@ function SoundManager( gameState ){
if( that.backgroundSounds[i].audioState == AUDIO_IN ){ if( that.backgroundSounds[i].audioState == AUDIO_IN ){
that.backgroundSounds[i].volume +=0.03; that.backgroundSounds[i].volume +=0.03;
} }
if( that.backgroundSounds[i].volume >= 1.0 ){ if( that.backgroundSounds[i].volume >= that.backgroundSounds[i].desiredVolume ){
that.backgroundSounds[i].volume = 1; that.backgroundSounds[i].volume = that.backgroundSounds[i].desiredVolume;
} }
if( that.backgroundSounds[i].volume <= 0.0 ){ if( that.backgroundSounds[i].volume <= 0.0 ){
that.backgroundSounds[i].volume = 0; that.backgroundSounds[i].volume = 0;

2
js/stories.js

@ -3,7 +3,7 @@ var story = {
"KitchenInitial" : ["Me: I need to buy a turkey..."], "KitchenInitial" : ["Me: I need to buy a turkey..."],
"CannotBuyTurkey" : ["Me: I've barely have time for ONE turkey, let alone TWO!"], "CannotBuyTurkey" : ["Me: I've barely have time for ONE turkey, let alone TWO!"],
"NoMoney" : ["Me: I can't afford this!"], "NoMoney" : ["Me: I can't afford this!"],
"BuyTurkeyFirst" : ["Me: You should buy a turkey first!"], "BuyTurkeyFirst" : ["Me: I should buy a turkey first!"],
"PaintStory" : ["Brother: Hey Grandpa, I've got a funny story about that primer you gave me", "PaintStory" : ["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", "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.", "Brother: Well, you gave me some primer to redo my room.",

16
js/ui.js

@ -75,12 +75,7 @@ function OvenUI( stage, gameState ){
this.circle.x = 0; this.circle.x = 0;
this.circle.y = 0; this.circle.y = 0;
//Set position of Shape instance.
stage.addChild( this.circle );
stage.addChild( ovenLight );
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( temperatureText );
this.changeTemperature = function( direction ){ this.changeTemperature = function( direction ){
@ -125,6 +120,15 @@ function OvenUI( stage, gameState ){
// Will cause the circle to wrap back // Will cause the circle to wrap back
if ( that.circle.x > stage.canvas.width ) { that.circle.x = 0; } if ( that.circle.x > stage.canvas.width ) { that.circle.x = 0; }
},
render: function(){
//Set position of Shape instance.
stage.addChild( that.circle );
stage.addChild( ovenLight );
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( temperatureText );
return this;
} }
} }
} }

BIN
res/DialogueBox.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

BIN
res/Grass.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 324 KiB

BIN
res/Loading/.DS_Store vendored

Binary file not shown.

BIN
res/Loading/Loading-Title-Mockup.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 324 KiB

BIN
res/Loading/Loading-Title.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 240 KiB

BIN
res/Loading/PanFront.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

BIN
res/Loading/TextCooking.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

BIN
res/Loading/TextDone.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

BIN
res/Loading/Turkey0.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 KiB

BIN
res/Loading/Turkey25.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 KiB

BIN
res/Loading/Turkey50.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 KiB

BIN
res/Loading/Turkey75.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 KiB

BIN
res/Loading/TurkeyDone.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 111 KiB

BIN
res/Main-Screen.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 593 KiB

BIN
res/MainScreen/.DS_Store vendored

Binary file not shown.

BIN
res/MainScreen/ButtonCredits.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

BIN
res/MainScreen/ButtonHelp.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

BIN
res/MainScreen/ButtonStart.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

BIN
res/Untitled-1.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

BIN
res/items/Bottle1.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

BIN
res/items/Bottle1Glow.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.9 KiB

BIN
res/items/Bottle2.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

BIN
res/items/Bottle2Glow.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

BIN
res/items/Bottle3.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB

BIN
res/items/Bottle3Glow.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.7 KiB

BIN
res/screens/MarketScreen.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 518 KiB

BIN
res/screens/MarketTopShelf.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

BIN
res/sound/Store/Background Sounds/.DS_Store vendored

Binary file not shown.

BIN
res/sound/Store/Background Sounds/72565__wrinex__supermarkt-ms Loop 2.ogg

Binary file not shown.

BIN
res/sound/Store/Background Sounds/72565__wrinex__supermarkt-ms Loop 3.mp3

Binary file not shown.

BIN
res/sound/Store/Background Sounds/72565__wrinex__supermarkt-ms Loop 3.ogg

Binary file not shown.

BIN
res/sound/Store/Background Sounds/72565__wrinex__supermarkt-ms Loop 4.ogg

Binary file not shown.

BIN
res/sound/Store/Background Sounds/72565__wrinex__supermarkt-ms Loop 5.ogg

Binary file not shown.

BIN
res/sound/Store/Background Sounds/72565__wrinex__supermarkt-ms Loop 6.ogg

Binary file not shown.

BIN
res/sound/Store/Background Sounds/72565__wrinex__supermarkt-ms Loop1.mp3

Binary file not shown.

BIN
res/sound/Store/Background Sounds/72565__wrinex__supermarkt-ms Loop1.ogg

Binary file not shown.

BIN
res/sound/Store/backgroundSound.mp3

Binary file not shown.

BIN
res/sound/Waterford.mp3

Binary file not shown.

BIN
res/sound/supermarket.mp3

Binary file not shown.
Loading…
Cancel
Save