Skip to content

Commit 90b9faf

Browse files
committed
New build files for the weekend :)
1 parent 3e6a88f commit 90b9faf

7 files changed

Lines changed: 450 additions & 120 deletions

File tree

build/custom/phaser-arcade-physics.js

Lines changed: 138 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* Phaser - http://phaser.io
99
*
10-
* v2.0.4 "Mos Shirare" - Built: Tue Apr 15 2014 15:38:35
10+
* v2.0.4 "Mos Shirare" - Built: Thu Apr 17 2014 14:58:26
1111
*
1212
* By Richard Davey http://www.photonstorm.com @photonstorm
1313
*
@@ -9702,7 +9702,7 @@ PIXI.RenderTexture.tempMatrix = new PIXI.Matrix();
97029702
*
97039703
* Phaser - http://phaser.io
97049704
*
9705-
* v2.0.4 "Mos Shirare" - Built: Tue Apr 15 2014 15:38:35
9705+
* v2.0.4 "Mos Shirare" - Built: Thu Apr 17 2014 14:58:26
97069706
*
97079707
* By Richard Davey http://www.photonstorm.com @photonstorm
97089708
*
@@ -15964,6 +15964,31 @@ Phaser.Group.prototype.updateZ = function () {
1596415964

1596515965
};
1596615966

15967+
/**
15968+
* Sets the Group cursor to the first object in the Group. If the optional index parameter is given it sets the cursor to the object at that index instead.
15969+
*
15970+
* @method Phaser.Group#resetCursor
15971+
* @param {number} [index=0] - Set the cursor to point to a specific index.
15972+
* @return {*} The child the cursor now points to.
15973+
*/
15974+
Phaser.Group.prototype.resetCursor = function (index) {
15975+
15976+
if (typeof index === 'undefined') { index = 0; }
15977+
15978+
if (index > this.children.length - 1)
15979+
{
15980+
index = 0;
15981+
}
15982+
15983+
if (this.cursor)
15984+
{
15985+
this._cache[8] = index;
15986+
this.cursor = this.children[this._cache[8]];
15987+
return this.cursor;
15988+
}
15989+
15990+
};
15991+
1596715992
/**
1596815993
* Advances the Group cursor to the next object in the Group. If it's at the end of the Group it wraps around to the first object.
1596915994
*
@@ -16221,9 +16246,7 @@ Phaser.Group.prototype.setProperty = function (child, key, value, operation) {
1622116246

1622216247
operation = operation || 0;
1622316248

16224-
// As ugly as this approach looks, and although it's limited to a depth of only 4, it's extremely fast.
16225-
// Much faster than a for loop or object iteration. There are no checks, so if the key isn't valid then it'll fail
16226-
// but as you are likely to call this from inner loops that have to perform well, I'll take that trade off.
16249+
// As ugly as this approach looks, and although it's limited to a depth of only 4, it's much faster than a for loop or object iteration.
1622716250

1622816251
// 0 = Equals
1622916252
// 1 = Add
@@ -16233,31 +16256,31 @@ Phaser.Group.prototype.setProperty = function (child, key, value, operation) {
1623316256

1623416257
var len = key.length;
1623516258

16236-
if (len == 1)
16259+
if (len === 1 && child.hasOwnProperty(key[0]))
1623716260
{
1623816261
if (operation === 0) { child[key[0]] = value; }
1623916262
else if (operation == 1) { child[key[0]] += value; }
1624016263
else if (operation == 2) { child[key[0]] -= value; }
1624116264
else if (operation == 3) { child[key[0]] *= value; }
1624216265
else if (operation == 4) { child[key[0]] /= value; }
1624316266
}
16244-
else if (len == 2)
16267+
else if (len === 2 && child.hasOwnProperty(key[0]) && child[key[0]].hasOwnProperty(key[1]))
1624516268
{
1624616269
if (operation === 0) { child[key[0]][key[1]] = value; }
1624716270
else if (operation == 1) { child[key[0]][key[1]] += value; }
1624816271
else if (operation == 2) { child[key[0]][key[1]] -= value; }
1624916272
else if (operation == 3) { child[key[0]][key[1]] *= value; }
1625016273
else if (operation == 4) { child[key[0]][key[1]] /= value; }
1625116274
}
16252-
else if (len == 3)
16275+
else if (len === 3 && child.hasOwnProperty(key[0]) && child[key[0]].hasOwnProperty(key[1]) && child[key[0]][key[1]].hasOwnProperty(key[2]))
1625316276
{
1625416277
if (operation === 0) { child[key[0]][key[1]][key[2]] = value; }
1625516278
else if (operation == 1) { child[key[0]][key[1]][key[2]] += value; }
1625616279
else if (operation == 2) { child[key[0]][key[1]][key[2]] -= value; }
1625716280
else if (operation == 3) { child[key[0]][key[1]][key[2]] *= value; }
1625816281
else if (operation == 4) { child[key[0]][key[1]][key[2]] /= value; }
1625916282
}
16260-
else if (len == 4)
16283+
else if (len === 4 && child.hasOwnProperty(key[0]) && child[key[0]].hasOwnProperty(key[1]) && child[key[0]][key[1]].hasOwnProperty(key[2]) && child[key[0]][key[1]][key[2]].hasOwnProperty(key[3]))
1626116284
{
1626216285
if (operation === 0) { child[key[0]][key[1]][key[2]][key[3]] = value; }
1626316286
else if (operation == 1) { child[key[0]][key[1]][key[2]][key[3]] += value; }
@@ -17001,7 +17024,8 @@ Phaser.Group.prototype.getRandom = function (startIndex, length) {
1700117024
};
1700217025

1700317026
/**
17004-
* Removes the given child from this Group and sets its group property to null.
17027+
* Removes the given child from this Group. This will dispatch an onRemovedFromGroup event from the child (if it has one),
17028+
* reset the Group cursor and optionally destroy the child.
1700517029
*
1700617030
* @method Phaser.Group#remove
1700717031
* @param {Any} child - The child to remove.
@@ -17012,7 +17036,7 @@ Phaser.Group.prototype.remove = function (child, destroy) {
1701217036

1701317037
if (typeof destroy === 'undefined') { destroy = false; }
1701417038

17015-
if (this.children.length === 0)
17039+
if (this.children.length === 0 || this.children.indexOf(child) === -1)
1701617040
{
1701717041
return false;
1701817042
}
@@ -17033,7 +17057,7 @@ Phaser.Group.prototype.remove = function (child, destroy) {
1703317057

1703417058
if (destroy && removed)
1703517059
{
17036-
removed.destroy();
17060+
removed.destroy(true);
1703717061
}
1703817062

1703917063
return true;
@@ -17067,7 +17091,7 @@ Phaser.Group.prototype.removeAll = function (destroy) {
1706717091

1706817092
if (destroy && removed)
1706917093
{
17070-
removed.destroy();
17094+
removed.destroy(true);
1707117095
}
1707217096
}
1707317097
while (this.children.length > 0);
@@ -17112,7 +17136,7 @@ Phaser.Group.prototype.removeBetween = function (startIndex, endIndex, destroy)
1711217136

1711317137
if (destroy && removed)
1711417138
{
17115-
removed.destroy();
17139+
removed.destroy(true);
1711617140
}
1711717141

1711817142
if (this.cursor === this.children[i])
@@ -17147,10 +17171,12 @@ Phaser.Group.prototype.destroy = function (destroyChildren, soft) {
1714717171

1714817172
if (!soft)
1714917173
{
17150-
this.parent.removeChild(this);
17174+
if (this.parent)
17175+
{
17176+
this.parent.removeChild(this);
17177+
}
1715117178

1715217179
this.game = null;
17153-
1715417180
this.exists = false;
1715517181
}
1715617182

@@ -17374,6 +17400,65 @@ Phaser.World.prototype.shutdown = function () {
1737417400

1737517401
};
1737617402

17403+
/**
17404+
* This will take the given game object and check if its x/y coordinates fall outside of the world bounds.
17405+
* If they do it will reposition the object to the opposite side of the world, creating a wrap-around effect.
17406+
*
17407+
* @method Phaser.World#wrap
17408+
* @param {Phaser.Sprite|Phaser.Image|Phaser.TileSprite|Phaser.Text} sprite - The object you wish to wrap around the world bounds.
17409+
* @param {number} [padding=0] - Extra padding added equally to the sprite.x and y coordinates before checking if within the world bounds. Ignored if useBounds is true.
17410+
* @param {boolean} [useBounds=false] - If useBounds is false wrap checks the object.x/y coordinates. If true it does a more accurate bounds check, which is more expensive.
17411+
*/
17412+
Phaser.World.prototype.wrap = function (sprite, padding, useBounds) {
17413+
17414+
if (typeof padding === 'undefined') { padding = 0; }
17415+
if (typeof useBounds === 'undefined') { useBounds = false; }
17416+
17417+
if (!useBounds)
17418+
{
17419+
if (sprite.x + padding < this.bounds.x)
17420+
{
17421+
sprite.x = this.bounds.right + padding;
17422+
}
17423+
else if (sprite.x - padding > this.bounds.right)
17424+
{
17425+
sprite.x = this.bounds.left - padding;
17426+
}
17427+
17428+
if (sprite.y + padding < this.bounds.top)
17429+
{
17430+
sprite.y = this.bounds.bottom + padding;
17431+
}
17432+
else if (sprite.y - padding > this.bounds.bottom)
17433+
{
17434+
sprite.y = this.bounds.top - padding;
17435+
}
17436+
}
17437+
else
17438+
{
17439+
sprite.getBounds();
17440+
17441+
if (sprite._currentBounds.right < this.bounds.x)
17442+
{
17443+
sprite.x = this.bounds.right;
17444+
}
17445+
else if (sprite._currentBounds.x > this.bounds.right)
17446+
{
17447+
sprite.x = this.bounds.left;
17448+
}
17449+
17450+
if (sprite._currentBounds.bottom < this.bounds.top)
17451+
{
17452+
sprite.y = this.bounds.bottom;
17453+
}
17454+
else if (sprite._currentBounds.top > this.bounds.bottom)
17455+
{
17456+
sprite.y = this.bounds.top;
17457+
}
17458+
}
17459+
17460+
};
17461+
1737717462
/**
1737817463
* @name Phaser.World#width
1737917464
* @property {number} width - Gets or sets the current width of the game world.
@@ -23700,7 +23785,10 @@ Phaser.InputHandler = function (sprite) {
2370023785
this.enabled = false;
2370123786

2370223787
/**
23703-
* @property {number} priorityID - The PriorityID controls which Sprite receives an Input event first if they should overlap.
23788+
* The priorityID is used to determine which game objects should get priority when input events occur. For example if you have
23789+
* several Sprites that overlap, by default the one at the top of the display list is given priority for input events. You can
23790+
* stop this from happening by controlling the priorityID value. The higher the value, the more important they are considered to the Input events.
23791+
* @property {number} priorityID
2370423792
* @default
2370523793
*/
2370623794
this.priorityID = 0;
@@ -34039,15 +34127,15 @@ Phaser.Math = {
3403934127
},
3404034128

3404134129
/**
34042-
* Keeps an angle value between -180 and +180<br>
34043-
* Should be called whenever the angle is updated on the Sprite to stop it from going insane.
34130+
* Keeps an angle value between -180 and +180.
3404434131
*
3404534132
* @method Phaser.Math#wrapAngle
3404634133
* @param {number} angle - The angle value to check
34047-
* @param {boolean} radians - True if angle sizes are expressed in radians.
34134+
* @param {boolean} radians - True if angle is given in radians.
3404834135
* @return {number} The new angle value, returns the same as the input angle if it was within bounds.
3404934136
*/
3405034137
wrapAngle: function (angle, radians) {
34138+
3405134139
var radianFactor = (radians) ? Math.PI / 180 : 1;
3405234140
return this.wrap(angle, -180 * radianFactor, 180 * radianFactor);
3405334141

@@ -34957,6 +35045,12 @@ Phaser.QuadTree = function(x, y, width, height, maxObjects, maxLevels, level) {
3495735045
*/
3495835046
this.nodes = [];
3495935047

35048+
/**
35049+
* @property {array} _empty - Internal empty array.
35050+
* @private
35051+
*/
35052+
this._empty = [];
35053+
3496035054
this.reset(x, y, width, height, maxObjects, maxLevels, level);
3496135055

3496235056
};
@@ -35152,9 +35246,13 @@ Phaser.QuadTree.prototype = {
3515235246
*/
3515335247
retrieve: function (sprite) {
3515435248

35249+
if (!sprite.body)
35250+
{
35251+
return this._empty;
35252+
}
35253+
3515535254
var returnObjects = this.objects;
3515635255

35157-
// sprite.body.quadTreeIndex = this.getIndex(sprite.body);
3515835256
var index = this.getIndex(sprite.body);
3515935257

3516035258
if (this.nodes[0])
@@ -37393,6 +37491,12 @@ Phaser.Timer = function (game, autoDestroy) {
3739337491
*/
3739437492
this._len = 0;
3739537493

37494+
/**
37495+
* @property {number} _marked - Temp. counter variable.
37496+
* @private
37497+
*/
37498+
this._marked = 0;
37499+
3739637500
/**
3739737501
* @property {number} _i - Temp. array counter variable.
3739837502
* @private
@@ -37667,6 +37771,7 @@ Phaser.Timer.prototype = {
3766737771
}
3766837772

3766937773
this._now = time;
37774+
this._marked = 0;
3767037775

3767137776
// Clears events marked for deletion and resets _len and _i to 0.
3767237777
this.clearPendingEvents();
@@ -37698,8 +37803,9 @@ Phaser.Timer.prototype = {
3769837803
}
3769937804
else
3770037805
{
37701-
this.events[this._i].callback.apply(this.events[this._i].callbackContext, this.events[this._i].args);
37806+
this._marked++;
3770237807
this.events[this._i].pendingDelete = true;
37808+
this.events[this._i].callback.apply(this.events[this._i].callbackContext, this.events[this._i].args);
3770337809
}
3770437810

3770537811
this._i++;
@@ -37711,7 +37817,7 @@ Phaser.Timer.prototype = {
3771137817
}
3771237818

3771337819
// Are there any events left?
37714-
if (this.events.length > 0)
37820+
if (this.events.length > this._marked)
3771537821
{
3771637822
this.order();
3771737823
}
@@ -38839,7 +38945,9 @@ Phaser.Animation.prototype = {
3883938945
* @method Phaser.Animation#destroy
3884038946
*/
3884138947
destroy: function () {
38842-
38948+
this.game.onPause.remove(this.onPause, this);
38949+
this.game.onResume.remove(this.onResume, this);
38950+
3884338951
this.game = null;
3884438952
this._parent = null;
3884538953
this._frames = null;
@@ -38851,9 +38959,6 @@ Phaser.Animation.prototype = {
3885138959
this.onLoop.dispose();
3885238960
this.onComplete.dispose();
3885338961

38854-
this.game.onPause.remove(this.onPause, this);
38855-
this.game.onResume.remove(this.onResume, this);
38856-
3885738962
},
3885838963

3885938964
/**
@@ -45891,7 +45996,7 @@ Phaser.Physics.Arcade.prototype = {
4589145996
*/
4589245997
collideSpriteVsGroup: function (sprite, group, collideCallback, processCallback, callbackContext, overlapOnly) {
4589345998

45894-
if (group.length === 0)
45999+
if (group.length === 0 || !sprite.body)
4589546000
{
4589646001
return;
4589746002
}
@@ -45998,6 +46103,11 @@ Phaser.Physics.Arcade.prototype = {
4599846103
*/
4599946104
collideSpriteVsTilemapLayer: function (sprite, tilemapLayer, collideCallback, processCallback, callbackContext) {
4600046105

46106+
if (!sprite.body)
46107+
{
46108+
return;
46109+
}
46110+
4600146111
this._mapData = tilemapLayer.getTiles(
4600246112
sprite.body.position.x - sprite.body.tilePadding.x,
4600346113
sprite.body.position.y - sprite.body.tilePadding.y,

build/custom/phaser-arcade-physics.min.js

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)