mirror of
https://github.com/wassname/phaser.git
synced 2026-08-16 11:25:21 +08:00
Added Spring class. Fixed reason why World wasn't pre and post updating (Stage didn't have an exists property).
This commit is contained in:
+9
-3
@@ -734,7 +734,9 @@ Phaser.Group.prototype.preUpdate = function () {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (var i = this.children.length - 1; i >= 0; i--)
|
||||
var i = this.children.length;
|
||||
|
||||
while (i--)
|
||||
{
|
||||
this.children[i].preUpdate();
|
||||
}
|
||||
@@ -750,7 +752,9 @@ Phaser.Group.prototype.preUpdate = function () {
|
||||
*/
|
||||
Phaser.Group.prototype.update = function () {
|
||||
|
||||
for (var i = this.children.length - 1; i >= 0; i--)
|
||||
var i = this.children.length;
|
||||
|
||||
while (i--)
|
||||
{
|
||||
this.children[i].update();
|
||||
}
|
||||
@@ -771,7 +775,9 @@ Phaser.Group.prototype.postUpdate = function () {
|
||||
this.y = this.game.camera.view.y + this.cameraOffset.y;
|
||||
}
|
||||
|
||||
for (var i = this.children.length - 1; i >= 0; i--)
|
||||
var i = this.children.length;
|
||||
|
||||
while (i--)
|
||||
{
|
||||
this.children[i].postUpdate();
|
||||
}
|
||||
|
||||
@@ -49,6 +49,12 @@ Phaser.Stage = function (game, width, height) {
|
||||
*/
|
||||
this.checkOffsetInterval = 2500;
|
||||
|
||||
/**
|
||||
* @property {boolean} exists - If exists is true the Stage and all children are updated, otherwise it is skipped.
|
||||
* @default
|
||||
*/
|
||||
this.exists = true;
|
||||
|
||||
/**
|
||||
* @property {number} _nextOffsetCheck - The time to run the next offset check.
|
||||
* @private
|
||||
|
||||
@@ -95,81 +95,6 @@ Phaser.World.prototype.setBounds = function (x, y, width, height) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This is called automatically after the plugins preUpdate and before the State.update.
|
||||
* Most objects have preUpdate methods and it's where initial movement and positioning is done.
|
||||
*
|
||||
* @method Phaser.World#preUpdate
|
||||
*/
|
||||
Phaser.World.prototype.preUpdate = function () {
|
||||
|
||||
this.currentRenderOrderID = 0;
|
||||
|
||||
var i = this.children.length;
|
||||
|
||||
while (i--)
|
||||
{
|
||||
this.children[i].preUpdate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This is called automatically after the State.update, but before particles or plugins update.
|
||||
*
|
||||
* @method Phaser.World#update
|
||||
*/
|
||||
Phaser.World.prototype.update = function () {
|
||||
|
||||
var i = this.children.length;
|
||||
|
||||
while (i--)
|
||||
{
|
||||
this.children[i].update();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This is called automatically before the renderer runs and after the plugins have updated.
|
||||
* In postUpdate this is where all the final physics calculatations and object positioning happens.
|
||||
* The objects are processed in the order of the display list.
|
||||
* The only exception to this is if the camera is following an object, in which case that is updated first.
|
||||
*
|
||||
* @method Phaser.World#postUpdate
|
||||
*/
|
||||
Phaser.World.prototype.postUpdate = function () {
|
||||
|
||||
if (this.game.world.camera.target)
|
||||
{
|
||||
this.game.world.camera.target.postUpdate();
|
||||
|
||||
this.game.world.camera.update();
|
||||
|
||||
var i = this.children.length;
|
||||
|
||||
while (i--)
|
||||
{
|
||||
if (this.children[i] !== this.game.world.camera.target)
|
||||
{
|
||||
this.children[i].postUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.game.world.camera.update();
|
||||
|
||||
var i = this.children.length;
|
||||
|
||||
while (i--)
|
||||
{
|
||||
this.children[i].postUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroyer of worlds.
|
||||
* @method Phaser.World#destroy
|
||||
|
||||
Reference in New Issue
Block a user