Skip to content

Commit 5415d9b

Browse files
committed
Stage and Group postUpdate methods iterate the same way now.
1 parent cd8bb5a commit 5415d9b

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

src/core/Group.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1493,10 +1493,7 @@ Phaser.Group.prototype.postUpdate = function () {
14931493
this.y = this.game.camera.view.y + this.cameraOffset.y;
14941494
}
14951495

1496-
// Goes in reverse to match the Stage postUpdate cycle, also again children may destroy themselves here.
1497-
var i = this.children.length;
1498-
1499-
while (i--)
1496+
for (var i = 0; i < this.children.length; i++)
15001497
{
15011498
this.children[i].postUpdate();
15021499
}

src/core/Stage.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -182,20 +182,23 @@ Phaser.Stage.prototype.postUpdate = function () {
182182
// Apply the camera shake, fade, bounds, etc
183183
this.game.camera.update();
184184

185-
var i = this.children.length;
185+
// Camera target first?
186+
if (this.game.camera.target)
187+
{
188+
this.game.camera.target.postUpdate();
186189

187-
while (i--)
190+
this.updateTransform();
191+
192+
this.game.camera.updateTarget();
193+
}
194+
195+
for (var i = 0; i < this.children.length; i++)
188196
{
189197
this.children[i].postUpdate();
190198
}
191199

192200
this.updateTransform();
193201

194-
if (this.game.camera.target)
195-
{
196-
this.game.camera.updateTarget();
197-
}
198-
199202
};
200203

201204
/**

0 commit comments

Comments
 (0)