From 7d6da514513105df8ed84c92bb6932697ae74e5c Mon Sep 17 00:00:00 2001 From: Robert Chen Date: Sun, 1 Dec 2013 03:34:27 -0800 Subject: [PATCH] Fixed tree animation --- js/ui.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/js/ui.js b/js/ui.js index 5e49428..22f5bb6 100755 --- a/js/ui.js +++ b/js/ui.js @@ -696,14 +696,14 @@ function WindowUI( stage, gameState ){ var streetLight = new createjs.Bitmap( "res/screens/Window/StreetlightGlow.png" ); streetLight.alpha = 0; - var treeAnimations = { rustle:[0,17,"rustle"], still:[0,0,"still"] }; + var treeAnimations = { rustle:{ frames:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17], next:false } }; var data = { images: ["res/screens/Window/Tree_Animation.png"], frames: { width:386, height:287 }, animations: treeAnimations }; var spriteSheet = new createjs.SpriteSheet(data); - var animation = new createjs.Sprite(spriteSheet, "treeAnimations"); + var animation = new createjs.Sprite(spriteSheet); animation.x = 415; animation.y = 30; @@ -742,6 +742,10 @@ return { mood.x -= 11.38; secondCounter = 0; + // move tree sometimes + if( UtilityFunctions.randRange(0,1) ) + animation.gotoAndPlay("rustle"); + // turn on lights if( dayNight.x < 0 && dayNight.x > -4545 ){ for( var i in smallWindows ){