From 3e37ad8f93b10f49f0ad357080aabef14135a566 Mon Sep 17 00:00:00 2001 From: Robert Chen Date: Fri, 29 Nov 2013 15:25:58 -0800 Subject: [PATCH] Sky fix --- js/model.js | 16 ++++++++-------- js/screens.js | 2 +- js/ui.js | 16 +++++++++++++--- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/js/model.js b/js/model.js index 18b24d9..f9cd569 100644 --- a/js/model.js +++ b/js/model.js @@ -21,7 +21,7 @@ function TurkeyLayer( name, percentRadius, turkeyModel, ovenModel ){ ovenModel.globalTime ); that.waterLost = that.waterLost + UtilityFunctions.waterLoss( that.finalTemperature ); that.cookCondition = UtilityFunctions.cookCondition(that.waterLost); - console.log( that.name + ": "+ that.waterLost + " " + that.cookCondition); + //console.log( that.name + ": "+ that.waterLost + " " + that.cookCondition); }, resetLayerTemps: function(){ that.initialTemp = that.finalTemperature; @@ -118,7 +118,7 @@ function OvenModel( turkeyWeight, gameState ) { }; }, changeTemp: function(setTemp){ - console.log("temp changed to " + setTemp); + //console.log("temp changed to " + setTemp); that.setTemp = setTemp; }, secondTick: function(){ @@ -134,9 +134,9 @@ function OvenModel( turkeyWeight, gameState ) { // Turn off oven light gameState.pubsub.publish( "OvenLight", "Off" ); } - console.log("Steady Temp " + that.steadyTemp) - console.log("Steady Timer " + that.steadyTimer) - console.log("Oven Temp " + that.tempInfini ) + //console.log("Steady Temp " + that.steadyTemp) + //console.log("Steady Timer " + that.steadyTimer) + //console.log("Oven Temp " + that.tempInfini ) turkey.updateLayerTemps(); } } @@ -163,8 +163,8 @@ UtilityFunctions = { 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 - console.log("Simple Radius " + simpleRadius + " Meters") - console.log("Complex Radius " + complexRadius + " Meters") + //console.log("Simple Radius " + simpleRadius + " Meters") + //console.log("Complex Radius " + complexRadius + " Meters") return complexRadius; }, @@ -262,7 +262,7 @@ UtilityFunctions = { tempAtTimeAndRadius=(sum*(tempInitial-tempInfini))+tempInfini - console.log("The Temperature at radius " + rPosition + " m and time " + t/60/60 + " hours is " + tempAtTimeAndRadius + " C or " + this.C2F(tempAtTimeAndRadius) + " F"); + //console.log("The Temperature at radius " + rPosition + " m and time " + t/60/60 + " hours is " + tempAtTimeAndRadius + " C or " + this.C2F(tempAtTimeAndRadius) + " F"); return(tempAtTimeAndRadius) }, diff --git a/js/screens.js b/js/screens.js index 927f245..d4b6439 100644 --- a/js/screens.js +++ b/js/screens.js @@ -269,7 +269,7 @@ function KitchenScreen( stage, gameState ){ this.background = new createjs.Bitmap( "res/screens/KitchenScreen/KitchenScreen.png" ); stage.addChild( this.background ); console.log(gameState.purchasedItems); - console.log("KitchenScreen") + console.log("KitchenScreen"); for(var i in gameState.purchasedItems ){ console.log(gameState.purchasedItems); gameState.purchasedItems[i].draw( stage ); diff --git a/js/ui.js b/js/ui.js index 19b5234..4d115db 100644 --- a/js/ui.js +++ b/js/ui.js @@ -300,6 +300,7 @@ function OvenUI( stage, gameState ){ } gameState.pubsub.subscribe( "SkipTime", function(){ + console.log("Skipping time"); for(var i = 0; i < 1200; i++){ that.secondTick( 1000 ); } @@ -388,7 +389,8 @@ function WindowUI( stage, gameState ){ var dayNight = new createjs.Bitmap("res/Test4-217.svg"); dayNight.y=30; - //dayNight.x = gameState.currentTime + var secondCounter = 0; + dayNight.x = -(new Date().getHours()*682.625); var ground = new createjs.Bitmap( "res/screens/Window/Ground.png" ); var houses = new createjs.Bitmap( "res/screens/Window/Housefar.png" ); @@ -405,7 +407,11 @@ function WindowUI( stage, gameState ){ var animation = new createjs.Sprite(spriteSheet, "treeAnimations"); animation.x = 415; animation.y = 30; - + + // Fast forward, move sky + gameState.pubsub.subscribe( "SkipTime", function(){ + dayNight.x -= dayNight.x < -15583 ? 0 : (11.38 * 20); + }); stage.addChild( dayNight ); stage.addChild( ground ); @@ -417,7 +423,11 @@ return { tick: function(){ // move the sky - dayNight.x-=25; + secondCounter++; + if( secondCounter > 60 ){ + dayNight.x-=11.38; + secondCounter = 0; + } // move the overlay //console.log(dayNight.x);