Browse Source

Oven sounds and bugfixes

Load_Fix
Robert Chen 11 years ago
parent
commit
88eaeddae1
  1. 9
      js/main.js
  2. 43
      js/screens.js
  3. 16
      js/soundmanager.js
  4. 44
      js/ui.js
  5. BIN
      res/Difficulty-Selection.png
  6. BIN
      res/Loading-Title.png
  7. BIN
      res/screens/.DS_Store
  8. BIN
      res/sound/.DS_Store
  9. BIN
      res/sound/Events/.DS_Store
  10. BIN
      res/sound/Events/Fire/.DS_Store
  11. BIN
      res/sound/GUI/.DS_Store
  12. BIN
      res/sound/Kitchen/.DS_Store
  13. BIN
      res/sound/Kitchen/Oven_Door_Full_Close.mp3
  14. BIN
      res/sound/Kitchen/Oven_Door_Full_Open.mp3
  15. BIN
      res/sound/Kitchen/Oven_Door_Peek_Close.mp3
  16. BIN
      res/sound/Kitchen/Oven_Door_Peek_Open.mp3
  17. BIN
      res/sound/Music/Waterford.mp3

9
js/main.js

@ -98,8 +98,15 @@ function GameState(){ @@ -98,8 +98,15 @@ function GameState(){
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"});
// Market Items
// 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"});
// 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"});

43
js/screens.js

@ -179,6 +179,47 @@ function DifficultyScreen( stage, gameState ){ @@ -179,6 +179,47 @@ function DifficultyScreen( stage, gameState ){
this.femaleSelection.alpha = 0;
stage.addChild( this.femaleSelection );
var nameInput = new createjs.Text( "", "48px Arial", "#00000000" );
nameInput.x = 47;
nameInput.y = 85;
nameInput.lineWidth = 175;
stage.addChild( nameInput );
// handle keyboard typing
document.onkeyup = function(event){
// keycode
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 < 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);
}
// 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" ) );
@ -278,7 +319,7 @@ function MarketScreen( stage, gameState ){ @@ -278,7 +319,7 @@ function MarketScreen( stage, gameState ){
var clipboardText = new createjs.Text( "Turkey", "16px Arial", "#00000000" );
clipboardText.x = 23;
clipboardText.y = 425;
clipboardText.lineWidth = 175;
clipboardText.lineWidth = 173;
var clipboardWeight = new createjs.Text( "", "16px Arial", "#00000000" );
clipboardWeight.x = 120;

16
js/soundmanager.js

@ -3,7 +3,7 @@ function SoundInstance( soundObj, loop ){ @@ -3,7 +3,7 @@ function SoundInstance( soundObj, loop ){
}
function SoundManager( gameState ){
var that = this;
var soundCache = [];
var soundCache = {};
var AUDIO_OUT = 1;
var AUDIO_IN = 2;
@ -14,7 +14,7 @@ function SoundManager( gameState ){ @@ -14,7 +14,7 @@ function SoundManager( gameState ){
// Register all sounds loaded in gameState
createjs.Sound.registerSound("res/sound/turkey_in_the_straw.mp3", "TitleMusic");
createjs.Sound.registerSound("res/sound/Store/supermarket.mp3", "MarketBackgroundSound");
createjs.Sound.registerSound("res/sound/Music/Waterford.mp3", "MarketMusic");
createjs.Sound.registerSound("res/sound/Store/Waterford.mp3", "MarketMusic");
createjs.Sound.registerSound("res/sound/GUI/pop.mp3", "Pop");
createjs.Sound.registerSound("res/sound/GUI/lowclick.mp3", "LowClick");
createjs.Sound.registerSound("res/sound/GUI/click.mp3", "Click");
@ -22,6 +22,12 @@ function SoundManager( gameState ){ @@ -22,6 +22,12 @@ function SoundManager( gameState ){
createjs.Sound.registerSound("res/sound/Store/buy.mp3", "Buy");
createjs.Sound.registerSound("res/sound/Store/entrance.mp3", "Entrance");
// 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");
this.backgroundSounds = [];
this.backgroundSoundsQueue = [];
@ -33,10 +39,12 @@ function SoundManager( gameState ){ @@ -33,10 +39,12 @@ function SoundManager( gameState ){
this.play = function( soundName ){
var channel = createjs.Sound.createInstance("Pop");
if( typeof soundName != "object" ){
channel = soundCache[soundName] ? soundCache[soundName] : soundCache[soundName] = createjs.Sound.createInstance(soundName);
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 = ( soundCache[soundName.name] ? soundCache[soundName.name] : soundCache[soundName.name] = createjs.Sound.createInstance(soundName.name) );
channel.volume = soundName.volume;
}
channel.play();

44
js/ui.js

@ -146,8 +146,10 @@ function OvenUI( stage, gameState ){ @@ -146,8 +146,10 @@ function OvenUI( stage, gameState ){
doorPeekLightOff.alpha = doorClosedLightOff.alpha = 0;
doorOpen.alpha = 1;
handleBar.y = 330;
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" );
ovenPeek();
}
}
@ -155,13 +157,15 @@ function OvenUI( stage, gameState ){ @@ -155,13 +157,15 @@ function OvenUI( stage, gameState ){
handleBar.addEventListener( "click", ovenPeek );
function ovenPeek(){
if( that.ovenDoor == OVEN_CLOSED || that.ovenDoor == OVEN_OPEN ){
if( that.ovenDoor == OVEN_CLOSED && that.ovenDoor != OVEN_OPEN ){
gameState.pubsub.publish( "Play", "Oven_Door_Peek_Open" );
doorPeekLightOn.alpha = lightPressedImg.alpha == 0 ? 0 : 1;
doorPeekLightOff.alpha = lightPressedImg.alpha == 0 ? 1 : 0;
doorClosedLightOn.alpha = 0;
doorClosedLightOff.alpha = 0;
doorOpen.alpha = 0;
that.ovenDoor = OVEN_PEEK;
handleBar.y = 48;
}
else if (that.ovenDoor == OVEN_PEEK){
@ -170,6 +174,7 @@ function OvenUI( stage, gameState ){ @@ -170,6 +174,7 @@ function OvenUI( stage, gameState ){
doorPeekLightOn.alpha = 0;
doorPeekLightOff.alpha = 0;
that.ovenDoor = OVEN_CLOSED;
gameState.pubsub.publish( "Play", "Oven_Door_Peek_Close" );
doorOpen.alpha = 0;
handleBar.y = 0;
}
@ -185,28 +190,29 @@ function OvenUI( stage, gameState ){ @@ -185,28 +190,29 @@ function OvenUI( stage, gameState ){
setInterval(this.secondTick, 1000);
stage.addChild( this.text );
stage.addChild(lightPressedImg);
// Turkey goes here
stage.addChild(doorPeekLightOn);
stage.addChild(doorPeekLightOff);
stage.addChild(doorClosedLightOn);
stage.addChild(doorClosedLightOff);
stage.addChild(doorOpen);
stage.addChild(handleBar);
return {
tick: function(){},
render: function(){
//Set position of Shape instance.
stage.addChild( ovenLight );
stage.addChild( temperatureText );
stage.addChild( this.text );
stage.addChild( lightPressedImg);
// Turkey goes here
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", "" ) );
stage.addChild( temperatureText );
stage.addChild( handleBar);
return this;
}
}
@ -263,7 +269,7 @@ function MarketItem( gameState, name, x, y, cost, mouseOutImg, mouseOverImg, fun @@ -263,7 +269,7 @@ function MarketItem( gameState, name, x, y, cost, mouseOutImg, mouseOverImg, fun
gameState.pubsub.publish("WalletAmount", gameState.wallet - Math.abs(cost))
}
// can we buy this? Only possible if you already bought a turkey
else if( !that.name.indexOf("Turkey") != -1 && gameState.turkeyBought == true ){
else if( that.name.indexOf("Turkey") == -1 && gameState.turkeyBought == true ){
gameState.purchasedItems.push( objReturn );
gameState.marketItems[ that.name ].delete();
that.bought = true;
@ -341,7 +347,9 @@ function Button( stage, gameState, x_orig, y_orig, x_dest, y_dest, eventCmd, arg @@ -341,7 +347,9 @@ function Button( stage, gameState, x_orig, y_orig, x_dest, y_dest, eventCmd, arg
button.addEventListener( "click", function(){ gameState.pubsub.publish( eventCmd, arg ) } );
button.addEventListener( "mouseover", function(){ document.body.style.cursor='pointer'; } );
button.addEventListener( "mouseout", function(){ document.body.style.cursor='default'; } );
gameState.pubsub.publish( "Play", "Click" );
return button;
button.addEventListener( "click", function(){
gameState.pubsub.publish( "Play", "Click" );
});
return button;
}

BIN
res/Difficulty-Selection.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

BIN
res/Loading-Title.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 112 KiB

BIN
res/screens/.DS_Store vendored

Binary file not shown.

BIN
res/sound/.DS_Store vendored

Binary file not shown.

BIN
res/sound/Events/.DS_Store vendored

Binary file not shown.

BIN
res/sound/Events/Fire/.DS_Store vendored

Binary file not shown.

BIN
res/sound/GUI/.DS_Store vendored

Binary file not shown.

BIN
res/sound/Music/.DS_Store → res/sound/Kitchen/.DS_Store vendored

Binary file not shown.

BIN
res/sound/Kitchen/Oven_Door_Full_Close.mp3

Binary file not shown.

BIN
res/sound/Kitchen/Oven_Door_Full_Open.mp3

Binary file not shown.

BIN
res/sound/Kitchen/Oven_Door_Peek_Close.mp3

Binary file not shown.

BIN
res/sound/Kitchen/Oven_Door_Peek_Open.mp3

Binary file not shown.

BIN
res/sound/Music/Waterford.mp3

Binary file not shown.
Loading…
Cancel
Save