You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Updated all Game Objects so they all have preUpdate, update and postUpdate functions (even if empty). Updated World so when it iterates through them all it no longer checks if those functions are present before calling them. Was wasting a lot of time doing that before.
Copy file name to clipboardExpand all lines: src/core/Group.js
+8-17Lines changed: 8 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -7,10 +7,10 @@
7
7
/**
8
8
* Phaser Group constructor.
9
9
* @class Phaser.Group
10
-
* @classdesc A Group is a container for display objects that allows for fast pooling, recyclingand collision checks.
10
+
* @classdesc A Group is a container for display objects that allows for fast pooling and object recycling. Groups can be nested within other Groups and have their own local transforms.
11
11
* @constructor
12
12
* @param {Phaser.Game} game - A reference to the currently running game.
13
-
* @param {*} parent - The parent Group, DisplayObject or DisplayObjectContainer that this Group will be added to. If undefined or null it will use game.world.
13
+
* @param {Phaser.Group|Phaser.Sprite} parent - The parent Group, DisplayObject or DisplayObjectContainer that this Group will be added to. If undefined or null it will use game.world.
14
14
* @param {string} [name=group] - A name for this Group. Not used internally but useful for debugging.
15
15
* @param {boolean} [addToStage=false] - If set to true this Group will be added directly to the Game.Stage instead of Game.World.
16
16
*/
@@ -708,12 +708,9 @@ Phaser.Group.prototype.callAll = function (method, context) {
708
708
*/
709
709
Phaser.Group.prototype.preUpdate=function(){
710
710
711
-
for(vari=0,len=this.children.length;i<len;i++)
711
+
for(vari=this.children.length-1;i>=0;i--)
712
712
{
713
-
if(this.children[i]['preUpdate'])
714
-
{
715
-
this.children[i].preUpdate();
716
-
}
713
+
this.children[i].preUpdate();
717
714
}
718
715
719
716
}
@@ -725,12 +722,9 @@ Phaser.Group.prototype.preUpdate = function () {
725
722
*/
726
723
Phaser.Group.prototype.update=function(){
727
724
728
-
for(vari=0,len=this.children.length;i<len;i++)
725
+
for(vari=this.children.length-1;i>=0;i--)
729
726
{
730
-
if(this.children[i]['update'])
731
-
{
732
-
this.children[i].update();
733
-
}
727
+
this.children[i].update();
734
728
}
735
729
736
730
}
@@ -742,12 +736,9 @@ Phaser.Group.prototype.update = function () {
* Indicates the rotation of the Sprite, in degrees, from its original orientation. Values from 0 to 180 represent clockwise rotation; values from 0 to -180 represent counterclockwise rotation.
Copy file name to clipboardExpand all lines: src/gameobjects/Text.js
+13-3Lines changed: 13 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -121,6 +121,16 @@ Phaser.Text.prototype.preUpdate = function () {
121
121
122
122
}
123
123
124
+
/**
125
+
* Override and use this function in your own custom objects to handle any update requirements you may have.
126
+
*
127
+
* @method Phaser.Text#update
128
+
* @memberof Phaser.Text
129
+
*/
130
+
Phaser.Text.prototype.update=function(){
131
+
132
+
}
133
+
124
134
/**
125
135
* Automatically called by World.postUpdate.
126
136
* @method Phaser.Text.prototype.postUpdate
@@ -219,7 +229,7 @@ Phaser.Text.prototype.setStyle = function (style) {
219
229
this.style=style;
220
230
this.dirty=true;
221
231
222
-
};
232
+
}
223
233
224
234
/**
225
235
* Renders text. This replaces the Pixi.Text.updateText function as we need a few extra bits in here.
@@ -299,7 +309,7 @@ Phaser.Text.prototype.updateText = function () {
299
309
}
300
310
301
311
this.updateTexture();
302
-
};
312
+
}
303
313
304
314
/**
305
315
* Greedy wrapping algorithm that will wrap words as the line grows longer than its horizontal bounds.
@@ -347,7 +357,7 @@ Phaser.Text.prototype.runWordWrap = function (text) {
347
357
348
358
returnresult;
349
359
350
-
};
360
+
}
351
361
352
362
/**
353
363
* Indicates the rotation of the Text, in degrees, from its original orientation. Values from 0 to 180 represent clockwise rotation; values from 0 to -180 represent counterclockwise rotation.
* Indicates the rotation of the Sprite, in degrees, from its original orientation. Values from 0 to 180 represent clockwise rotation; values from 0 to -180 represent counterclockwise rotation.
0 commit comments