Browse Source

fixes, help/credit screens

Load_Fix
Robert Chen 11 years ago
parent
commit
4f7fa6b8a4
  1. 11
      js/main.js
  2. 18
      js/model.js
  3. 56
      js/screens.js
  4. 23
      js/ui.js
  5. BIN
      res/screens/.DS_Store
  6. BIN
      res/screens/HelpCreditsScreen/.DS_Store
  7. BIN
      res/screens/HelpCreditsScreen/Help.png

11
js/main.js

@ -6,6 +6,7 @@ function GameState(){
this.currentTime = new Date().getTime(); this.currentTime = new Date().getTime();
this.oldTime = new Date().getTime(); this.oldTime = new Date().getTime();
this.gameStarted = false;
this.name = ""; this.name = "";
this.gender = "Male"; this.gender = "Male";
this.wallet = 45.00; this.wallet = 45.00;
@ -55,7 +56,13 @@ function GameState(){
queue.loadFile( {id: "HelpButtonFile", src:"res/screens/MainScreen/ButtonHelp.png"} ); queue.loadFile( {id: "HelpButtonFile", src:"res/screens/MainScreen/ButtonHelp.png"} );
queue.loadFile( {id: "CreditsButtonFile", src:"res/screens/MainScreen/ButtonCredits.png"} ); queue.loadFile( {id: "CreditsButtonFile", src:"res/screens/MainScreen/ButtonCredits.png"} );
queue.loadFile( {id: "HelpCreditsScreen", src:"res/screens/HelpCreditsScreen/Help.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: "HelpScreenFile", src:"res/screens/HelpCreditsScreen/Credits.png" } );
queue.loadFile( {id: "MarketScreenfile", src:"res/screens/MarketScreen/MarketScreen.png"} ); queue.loadFile( {id: "MarketScreenfile", src:"res/screens/MarketScreen/MarketScreen.png"} );
@ -291,7 +298,7 @@ function GameUI( canvasElem, gameState ){
/* Initialize All Screens */ /* Initialize All Screens */
this.screens = { this.screens = {
"LoadingScreen" : LoadingScreen, "LoadingScreen" : LoadingScreen,
"InfoHelpScreen" : InfoHelpScreen, "HelpScreen" : HelpScreen,
"MainScreen" : MainScreen, "MainScreen" : MainScreen,
"DifficultyScreen" : DifficultyScreen, "DifficultyScreen" : DifficultyScreen,
"KitchenScreen" : KitchenScreen, "KitchenScreen" : KitchenScreen,

18
js/model.js

@ -282,22 +282,28 @@ UtilityFunctions = {
cookCondition: function(cookValue,volume){ cookCondition: function(cookValue,volume){
var multiplier = 1; var multiplier = 1;
if (cookValue>=multiplier*600000) { if (cookValue>=multiplier*600000) {
return ["House Fire", (cookValue-600000)/(multiplier*600000)]; return ["House Fire", (cookValue-600000)/(multiplier*600000),"on fire"];
} }
else if(cookValue>=multiplier*250000) { else if(cookValue>=multiplier*250000) {
return ["Charcoal", (cookValue-250000)/(multiplier*600000)]; return ["Burnt", (cookValue-250000)/(multiplier*600000), "burnt"];
} }
else if (cookValue>=multiplier*150000) { else if (cookValue>=multiplier*150000) {
return ["Dry", (cookValue-150000)/(multiplier*250000)]; return ["Dry", (cookValue-150000)/(multiplier*250000), "dry"];
}
else if (cookValue>=multiplier*85000){
return ["Cooked", (cookValue-12000)/(multiplier*150000), "overcooked"];
} }
else if (cookValue>=multiplier*12000) { else if (cookValue>=multiplier*12000) {
return ["Cooked", (cookValue-12000)/(multiplier*150000)]; 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) { else if (cookValue>=multiplier*5000) {
return ["Undercooked", (cookValue-5000)/(multiplier*12000)]; return ["Undercooked", (cookValue-5000)/(multiplier*12000), "undercooked"];
} }
else { else {
return ["Raw", 1]; return ["Raw", 1, "raw"];
} }
} }
} }

56
js/screens.js

@ -60,25 +60,6 @@ function LoadingScreen( stage, gameState ){
} }
} }
function InfoHelpScreen( stage, gameState ){
var that = this;
this.background = new createjs.Bitmap( "res/screens/HelpCreditsScreen/Help.png" );
stage.addChild( this.background );
this.uiElems = [];
return {
blit : function(){
// Draw all the uiElements
for( var index in that.uiElems ){
that.uiElems[ index ].tick();
}
}
}
}
function MainScreen( stage, gameState ){ function MainScreen( stage, gameState ){
var that = this; var that = this;
@ -113,7 +94,7 @@ function MainScreen( stage, gameState ){
// buttons info/credits/start // 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, 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","SwitchScreen", "InfoScreen", "Click" ); new ImgButton( stage, gameState, 17,470, "res/screens/MainScreen/ButtonHelp.png", "res/screens/MainScreen/ButtonHelp.png","SwitchScreen", "HelpScreen", "Click" );
new ImgButton( stage, gameState, 17,527, "res/screens/MainScreen/ButtonCredits.png", "res/screens/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} );
@ -227,8 +208,8 @@ function DifficultyScreen( stage, gameState ){
stage.addChild( new Button( stage, gameState, 500, 235, 100, 55, "ChangeGender", "Male" ) ); 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, 500, 300, 100, 55, "ChangeGender", "Female" ) );
stage.addChild( new Button( stage, gameState, 503, 370, 200, 55, null, null, function(){ gameState.hard = false; gameState.pubsub.publish("SwitchScreen", "KitchenScreen"); } ) ); stage.addChild( new Button( stage, gameState, 503, 370, 200, 55, null, null, function(){ gameState.hard = false; gameState.gameStarted = true; gameState.pubsub.publish("SwitchScreen", "KitchenScreen"); } ) );
stage.addChild( new Button( stage, gameState, 500, 495, 205, 55, null, null, function(){ gameState.hard = true; 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.pubsub.publish("SwitchScreen", "KitchenScreen"); } ) );
stage.addChild( new Button( stage, gameState, 35, 495, 85, 55, "SwitchScreen", "MainScreen" ) ); stage.addChild( new Button( stage, gameState, 35, 495, 85, 55, "SwitchScreen", "MainScreen" ) );
@ -462,11 +443,38 @@ function ScoreScreen( stage, gameState ){
// Retry Button // Retry Button
} }
function HelpScreen( stage, gameState ){
var that = this;
this.background = new createjs.Bitmap( "res/screens/HelpCreditsScreen/HelpP1P2.png" );
stage.addChild( this.background );
stage.addChild( new Button( stage, gameState, 698, 15, 80, 50,null, null, function(){
if( !gameState.gameStarted )
gameState.pubsub.publish("SwitchScreen", "MainScreen");
else
gameState.pubsub.publish("SwitchScreen", "KitchenScreen");
} ));
this.uiElems = [];
return {
blit : function(){
// Draw all the uiElements
for( var index in that.uiElems ){
that.uiElems[ index ].tick();
}
}
}
//
}
function CreditsScreen( stage, gameState ){ function CreditsScreen( stage, gameState ){
var that = this; var that = this;
this.background = new createjs.Bitmap( "res/screens/HelpCreditsScreen/Help.png" ); this.background = new createjs.Bitmap( "res/screens/HelpCreditsScreen/Credits.png" );
stage.addChild( this.background ); stage.addChild( this.background );
stage.addChild( new Button( stage, gameState, 698, 533, 80, 50, "SwitchScreen", "MainScreen" ) );
this.uiElems = []; this.uiElems = [];
return { return {

23
js/ui.js

@ -77,7 +77,7 @@ function CookbookUI( stage, gameState ){
logLine.x = 423; logLine.x = 423;
logLine.y = 50 * i+ 165; logLine.y = 50 * i+ 165;
logLine.textBaseline = "alphabetic"; logLine.textBaseline = "alphabetic";
logLine.text = record.getType() + " " + time.getHours() + ":" + time.getMinutes() + " " + record.getContent(); logLine.text = record.getType() + " " + ("00"+time.getHours()).slice(-2) + ":" + ("00"+time.getMinutes()).slice(-2) + " " + record.getContent();
logEntries.push(logLine); logEntries.push(logLine);
stage.addChild(logLine); stage.addChild(logLine);
@ -234,6 +234,12 @@ function OvenUI( stage, gameState ){
handleBar.graphics.beginFill("#ffffff").drawRect(5, 450, 400, 60); handleBar.graphics.beginFill("#ffffff").drawRect(5, 450, 400, 60);
handleBar.alpha = 0.5; handleBar.alpha = 0.5;
if( gameState.turkeyBought ){
var state = ovenModel.getTurkeyState();
gameState.pubsub.publish( "ShowDialog", {seq:"custom", autoAdvance:false, customText:"Hmm... Looks " + turkeyState["skin"]["cond"][2] + "." } );
gameState.pubsub.publish( "AddRecord", {type:"Open ", text:"The turkey looked " + turkeyState["skin"]["cond"][2]} );
}
gameState.pubsub.publish( "Play", "Oven_Door_Full_Open" ); gameState.pubsub.publish( "Play", "Oven_Door_Full_Open" );
}else if (that.ovenDoor == OVEN_OPEN ){ }else if (that.ovenDoor == OVEN_OPEN ){
that.ovenDoor = OVEN_PEEK; that.ovenDoor = OVEN_PEEK;
@ -258,6 +264,11 @@ function OvenUI( stage, gameState ){
that.ovenDoor = OVEN_PEEK; that.ovenDoor = OVEN_PEEK;
handleBar.y = 48; handleBar.y = 48;
if( gameState.turkeyBought ){
var state = ovenModel.getTurkeyState();
gameState.pubsub.publish( "ShowDialog", {seq:"custom", autoAdvance:false, customText:"Looks " + turkeyState["skin"]["cond"][2] } );
gameState.pubsub.publish( "AddRecord", {type:"Peek ", text:"The turkey looked " + turkeyState["skin"]["cond"][2]} );
}
} }
else if (that.ovenDoor == OVEN_PEEK){ else if (that.ovenDoor == OVEN_PEEK){
doorClosedLightOn.alpha = lightPressedImg.alpha == 0 ? 0 : 1; doorClosedLightOn.alpha = lightPressedImg.alpha == 0 ? 0 : 1;
@ -294,6 +305,10 @@ function OvenUI( stage, gameState ){
gameState.pubsub.subscribe("DoneSkipTime", function(){ that.doneSkipTime = true; }); gameState.pubsub.subscribe("DoneSkipTime", function(){ that.doneSkipTime = true; });
this.secondTick = function(diff){ this.secondTick = function(diff){
// check if oven door is open
if( that.ovenDoor == OVEN_OPEN ){
// - 25 + penalty 5 degrees a second for opening the oven.
}
ovenModel.secondTick(); ovenModel.secondTick();
gameState.currentTime += diff; gameState.currentTime += diff;
} }
@ -326,7 +341,7 @@ function OvenUI( stage, gameState ){
turkeyStates[2].alpha = turkeyState["skin"]["cond"][1]; turkeyStates[2].alpha = turkeyState["skin"]["cond"][1];
if( turkeyState["skin"]["cond"][0] == "Dry" ) if( turkeyState["skin"]["cond"][0] == "Dry" )
turkeyStates[3].alpha = turkeyState["skin"]["cond"][1]; turkeyStates[3].alpha = turkeyState["skin"]["cond"][1];
if( turkeyState["skin"]["cond"][0] == "Charcoal" ) if( turkeyState["skin"]["cond"][0] == "Burnt" )
turkeyStates[4].alpha = turkeyState["skin"]["cond"][1]; turkeyStates[4].alpha = turkeyState["skin"]["cond"][1];
if( turkeyState["skin"]["cond"][0] == "House Fire" ) if( turkeyState["skin"]["cond"][0] == "House Fire" )
turkeyStates[4].alpha = 1; turkeyStates[4].alpha = 1;
@ -353,7 +368,7 @@ function OvenUI( stage, gameState ){
turkeyStates[2].alpha = turkeyState["skin"]["cond"][1]; turkeyStates[2].alpha = turkeyState["skin"]["cond"][1];
if( turkeyState["skin"]["cond"] == "Dry" ) if( turkeyState["skin"]["cond"] == "Dry" )
turkeyStates[3].alpha = turkeyState["skin"]["cond"][1]; turkeyStates[3].alpha = turkeyState["skin"]["cond"][1];
if( turkeyState["skin"]["cond"] == "Charcoal" ) if( turkeyState["skin"]["cond"] == "Burnt" )
turkeyStates[4].alpha = turkeyState["skin"]["cond"][1]; turkeyStates[4].alpha = turkeyState["skin"]["cond"][1];
if( turkeyState["skin"]["cond"] == "House Fire" ) if( turkeyState["skin"]["cond"] == "House Fire" )
turkeyStates[4].alpha = 1; turkeyStates[4].alpha = 1;
@ -641,7 +656,7 @@ function Button( stage, gameState, x_orig, y_orig, x_dest, y_dest, eventCmd, arg
var button = new createjs.Shape(); var button = new createjs.Shape();
button.graphics.beginFill("#ffffff").drawRect(x_orig, y_orig, x_dest, y_dest); button.graphics.beginFill("#ffffff").drawRect(x_orig, y_orig, x_dest, y_dest);
button.alpha = 0.1; button.alpha = 0.01;
button.addEventListener( "click", function(){ button.addEventListener( "click", function(){
gameState.pubsub.publish( "Play", "Click" ); gameState.pubsub.publish( "Play", "Click" );
if( !altfunc ){ if( !altfunc ){

BIN
res/screens/.DS_Store vendored

Binary file not shown.

BIN
res/screens/HelpCreditsScreen/.DS_Store vendored

Binary file not shown.

BIN
res/screens/HelpCreditsScreen/Help.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 363 KiB

Loading…
Cancel
Save