Browse Source

Sky fix

Load_Fix
Robert Chen 11 years ago
parent
commit
3e37ad8f93
  1. 16
      js/model.js
  2. 2
      js/screens.js
  3. 16
      js/ui.js

16
js/model.js

@ -21,7 +21,7 @@ function TurkeyLayer( name, percentRadius, turkeyModel, ovenModel ){
ovenModel.globalTime ); ovenModel.globalTime );
that.waterLost = that.waterLost + UtilityFunctions.waterLoss( that.finalTemperature ); that.waterLost = that.waterLost + UtilityFunctions.waterLoss( that.finalTemperature );
that.cookCondition = UtilityFunctions.cookCondition(that.waterLost); that.cookCondition = UtilityFunctions.cookCondition(that.waterLost);
console.log( that.name + ": "+ that.waterLost + " " + that.cookCondition); //console.log( that.name + ": "+ that.waterLost + " " + that.cookCondition);
}, },
resetLayerTemps: function(){ resetLayerTemps: function(){
that.initialTemp = that.finalTemperature; that.initialTemp = that.finalTemperature;
@ -118,7 +118,7 @@ function OvenModel( turkeyWeight, gameState ) {
}; };
}, },
changeTemp: function(setTemp){ changeTemp: function(setTemp){
console.log("temp changed to " + setTemp); //console.log("temp changed to " + setTemp);
that.setTemp = setTemp; that.setTemp = setTemp;
}, },
secondTick: function(){ secondTick: function(){
@ -134,9 +134,9 @@ function OvenModel( turkeyWeight, gameState ) {
// Turn off oven light // Turn off oven light
gameState.pubsub.publish( "OvenLight", "Off" ); gameState.pubsub.publish( "OvenLight", "Off" );
} }
console.log("Steady Temp " + that.steadyTemp) //console.log("Steady Temp " + that.steadyTemp)
console.log("Steady Timer " + that.steadyTimer) //console.log("Steady Timer " + that.steadyTimer)
console.log("Oven Temp " + that.tempInfini ) //console.log("Oven Temp " + that.tempInfini )
turkey.updateLayerTemps(); 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 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 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("Simple Radius " + simpleRadius + " Meters")
console.log("Complex Radius " + complexRadius + " Meters") //console.log("Complex Radius " + complexRadius + " Meters")
return complexRadius; return complexRadius;
}, },
@ -262,7 +262,7 @@ UtilityFunctions = {
tempAtTimeAndRadius=(sum*(tempInitial-tempInfini))+tempInfini 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) return(tempAtTimeAndRadius)
}, },

2
js/screens.js

@ -269,7 +269,7 @@ function KitchenScreen( stage, gameState ){
this.background = new createjs.Bitmap( "res/screens/KitchenScreen/KitchenScreen.png" ); this.background = new createjs.Bitmap( "res/screens/KitchenScreen/KitchenScreen.png" );
stage.addChild( this.background ); stage.addChild( this.background );
console.log(gameState.purchasedItems); console.log(gameState.purchasedItems);
console.log("KitchenScreen") console.log("KitchenScreen");
for(var i in gameState.purchasedItems ){ for(var i in gameState.purchasedItems ){
console.log(gameState.purchasedItems); console.log(gameState.purchasedItems);
gameState.purchasedItems[i].draw( stage ); gameState.purchasedItems[i].draw( stage );

16
js/ui.js

@ -300,6 +300,7 @@ function OvenUI( stage, gameState ){
} }
gameState.pubsub.subscribe( "SkipTime", function(){ gameState.pubsub.subscribe( "SkipTime", function(){
console.log("Skipping time");
for(var i = 0; i < 1200; i++){ for(var i = 0; i < 1200; i++){
that.secondTick( 1000 ); that.secondTick( 1000 );
} }
@ -388,7 +389,8 @@ function WindowUI( stage, gameState ){
var dayNight = new createjs.Bitmap("res/Test4-217.svg"); var dayNight = new createjs.Bitmap("res/Test4-217.svg");
dayNight.y=30; 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 ground = new createjs.Bitmap( "res/screens/Window/Ground.png" );
var houses = new createjs.Bitmap( "res/screens/Window/Housefar.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"); var animation = new createjs.Sprite(spriteSheet, "treeAnimations");
animation.x = 415; animation.x = 415;
animation.y = 30; 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( dayNight );
stage.addChild( ground ); stage.addChild( ground );
@ -417,7 +423,11 @@ return {
tick: function(){ tick: function(){
// move the sky // move the sky
dayNight.x-=25; secondCounter++;
if( secondCounter > 60 ){
dayNight.x-=11.38;
secondCounter = 0;
}
// move the overlay // move the overlay
//console.log(dayNight.x); //console.log(dayNight.x);

Loading…
Cancel
Save