Browse Source

More bugfixes

Load_Fix
Robert Chen 11 years ago
parent
commit
a268f5843b
  1. 2
      index.html
  2. 36
      js/main.js
  3. 7
      js/screens.js
  4. 20
      js/ui.js
  5. BIN
      res/screens/.DS_Store
  6. BIN
      res/screens/KitchenScreen/.DS_Store

2
index.html

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

36
js/main.js

@ -173,21 +173,27 @@ function GameState(){ @@ -173,21 +173,27 @@ function GameState(){
];
this.marketItems = {
"Frills Box" : new MarketItem( this, "Frills Box", 133,92, 3.00, "res/items/FrillsBox.png", "res/items/FrillsBoxGlow.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", "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", "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", "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", "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","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", "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", "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]*2.00, "res/items/Turkey5.png", "res/items/Turkey5Glow.png", "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.25, "res/items/Turkey4.png", "res/items/Turkey4Glow.png", "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.85, "res/items/Turkey3.png", "res/items/Turkey3Glow.png", "100% Turkey product from Sunny Farms Heavy Industries, Ltd.", parseFloat(randomWeight[2]) ),
"Pastured Turkey": new MarketItem( this, "Pastured Turkey", 474,357, randomWeight[3]*1.75, "res/items/Turkey2.png", "res/items/Turkey2Glow.png", "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]*1.00, "res/items/Turkey1.png", "res/items/Turkey1Glow.png", "100% General Satisfaction Guaranteed", parseFloat(randomWeight[4]) )
"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/StuffingRepurposed.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]*2.00, "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.25, "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.85, "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.75, "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]*1.00, "res/items/Turkey1.png", "res/items/Turkey1Glow.png",null,null, "100% General Satisfaction Guaranteed", parseFloat(randomWeight[4]) )
};
this.purchasedItems = [];

7
js/screens.js

@ -218,6 +218,7 @@ function DifficultyScreen( stage, gameState ){ @@ -218,6 +218,7 @@ function DifficultyScreen( stage, gameState ){
if(keynum == 8 && nameInput.text.length > 0 )
nameInput.text = nameInput.text.substr(0, nameInput.text.length-1);
event.preventDefault();
}
gameState.name = nameInput.text;
@ -268,7 +269,7 @@ function KitchenScreen( stage, gameState ){ @@ -268,7 +269,7 @@ function KitchenScreen( stage, gameState ){
for(var i in gameState.purchasedItems ){
console.log(gameState.purchasedItems);
gameState.purchasedItems[i].draw( stage, 403+100*i, 350 );
gameState.purchasedItems[i].draw( stage );
}
this.uiElems.push( gameState.ovenUI ? gameState.ovenUI.render() : ( gameState.ovenUI = new OvenUI( stage, gameState ) ).render() );
@ -276,7 +277,8 @@ function KitchenScreen( stage, gameState ){ @@ -276,7 +277,8 @@ function KitchenScreen( 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, 14, 17, 73, 45, "SwitchScreen", "HelpScreen" ) );
new ImgButton( stage, gameState, 571,527, "res/screens/KitchenScreen/StoreBrochure.png", "res/screens/KitchenScreen/StoreBrochureGlow.png", "SwitchScreen", "MarketScreen", "Click" );
new ImgButton( stage, gameState, 0,0, "res/screens/KitchenScreen/StoreBrochure.png", "res/screens/KitchenScreen/StoreBrochureGlow.png", "SwitchScreen", "MarketScreen", "Click" );
// If player did not buy a turkey, tell them
if( !gameState.turkeyBought ){
@ -349,6 +351,7 @@ function MarketScreen( stage, gameState ){ @@ -349,6 +351,7 @@ function MarketScreen( stage, gameState ){
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 ) {
console.log("drawing"+gameState.marketItems[marketItemKeys[index]].name + " on screen " + gameState.currentScreen );
gameState.marketItems[marketItemKeys[index]].draw( stage );
}

20
js/ui.js

@ -255,12 +255,17 @@ return { @@ -255,12 +255,17 @@ return {
}
}
function MarketItem( gameState, name, x, y, cost, mouseOutImg, mouseOverImg, funnyDescription, weight ){
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(){
@ -289,6 +294,8 @@ function MarketItem( gameState, name, x, y, cost, mouseOutImg, mouseOverImg, fun @@ -289,6 +294,8 @@ function MarketItem( gameState, name, x, y, cost, mouseOutImg, mouseOverImg, fun
mouseOut.visible = true;
gameState.pubsub.publish("ClearClipboard", {});
} );
mouseOver.addEventListener( "click", function(){
if(!that.bought && cost <= gameState.wallet ){
console.log(that.name);
@ -329,12 +336,23 @@ function MarketItem( gameState, name, x, y, cost, mouseOutImg, mouseOverImg, fun @@ -329,12 +336,23 @@ function MarketItem( gameState, name, x, y, cost, mouseOutImg, mouseOverImg, fun
getName: function(){return that.name;},
delete: function( stage ){
gameState.pubsub.publish("RemoveItems", [mouseOut, mouseOver]);
// replace image with transparency
},
draw: function( stage, newx, newy ){
if( newx && newy ){
mouseOut.x = mouseOver.x = newx;
mouseOut.y = mouseOver.y = newy;
}
if( gameState.newScreen == "KitchenScreen" ){
console.log("In the kitchen");
stage.addChild( mouseOutKitchen );
stage.addChild( mouseOverKitchen );
return;
}
stage.addChild( mouseOut );
stage.addChild( mouseOver );
}

BIN
res/screens/.DS_Store vendored

Binary file not shown.

BIN
res/screens/KitchenScreen/.DS_Store vendored

Binary file not shown.
Loading…
Cancel
Save