@@ -60,9 +60,9 @@ Phaser.Component.Transform = function (gameObject, x, y, scaleX, scaleY)
6060 // that are children of the owner of this Transform
6161 this . children = [ ] ;
6262
63- // if (parent)
63+ // if (gameObject. parent && gameObject.parent.transform )
6464 // {
65- // parent.children .add(this);
65+ // gameObject. parent.transform .add(this);
6666 // }
6767} ;
6868
@@ -313,7 +313,7 @@ Phaser.Component.Transform.prototype = {
313313 // updated, in the correct order, so we can now do this one
314314 // and any of its children too
315315
316- return this . update ( ) ;
316+ this . update ( ) ;
317317 } ,
318318
319319 updateChildren : function ( )
@@ -322,8 +322,21 @@ Phaser.Component.Transform.prototype = {
322322 {
323323 this . children [ i ] . update ( ) ;
324324 }
325+ } ,
325326
326- return this ;
327+ updateFromDirtyParent : function ( )
328+ {
329+ this . updateFromParent ( ) ;
330+
331+ if ( this . children . length )
332+ {
333+ for ( var i = 0 ; i < this . children . length ; i ++ )
334+ {
335+ this . children [ i ] . updateFromDirtyParent ( ) ;
336+ }
337+ }
338+
339+ this . _dirty = false ;
327340 } ,
328341
329342 update : function ( )
@@ -332,7 +345,7 @@ Phaser.Component.Transform.prototype = {
332345
333346 if ( ! this . _dirty )
334347 {
335- return this ;
348+ return ;
336349 }
337350
338351 // If we got this far then this Transform is dirty
@@ -354,13 +367,11 @@ Phaser.Component.Transform.prototype = {
354367 {
355368 for ( var i = 0 ; i < len ; i ++ )
356369 {
357- this . children [ i ] . update ( ) ;
370+ this . children [ i ] . updateFromDirtyParent ( ) ;
358371 }
359372 }
360373
361374 this . _dirty = false ;
362-
363- return this ;
364375 } ,
365376
366377 updateCache : function ( )
0 commit comments