phaser-rails 2.1.1.0 → 2.1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b98fb796d2dcc04c75fe5e466562fe711f07ce35
4
- data.tar.gz: 8513510ce7ffd8cc1d68fff5235d320be57f3010
3
+ metadata.gz: 7b9a07c0bc1d5bc357f6e3402cdb6648720bf19f
4
+ data.tar.gz: 6ed92cbf6a128606cc66872d37daa90df222c5dd
5
5
  SHA512:
6
- metadata.gz: 3f9ef3da5fe890e73ffe486d18f0e87f5b2cd1301847b7ce718b10ee50fb1e95e0f9f048a1ea0d60c3fc6a4eeea5ed6560c9d7e81e4d4e45858724e1826231c0
7
- data.tar.gz: 7cd2fbf19913ff4c050d9ff49ca62f14c583809eea5656d9a717d281d462029d5cce3a575c4eedd35d5f1147720ed1981b0be548772fe0599f35a40f62df2904
6
+ metadata.gz: b89b5df1f26f91f54e8583ed7b6cb33cd7014b556f185d1363a4d00ef2d419ecb58644b2be8e8ba51b3f1bde338a9902a7615d1aad4db98f09334e12dcaf25c7
7
+ data.tar.gz: 5bd808455631910f3f55ebdbce3a8f720ea3728a5f40eb0d52260308039e84faf66a9c0b436761d66d6d98b05ed1242d0769c150672f43de109f51edd93a23d6
@@ -1,5 +1,5 @@
1
1
  module Phaser
2
2
  module Rails
3
- VERSION = "2.1.1.0"
3
+ VERSION = "2.1.2.0"
4
4
  end
5
5
  end
@@ -7,7 +7,7 @@
7
7
  *
8
8
  * Phaser - http://phaser.io
9
9
  *
10
- * v2.1.1 "Eianrod" - Built: Thu Sep 11 2014 10:37:16
10
+ * v2.1.2 "Whitebridge" - Built: Thu Oct 09 2014 16:16:06
11
11
  *
12
12
  * By Richard Davey http://www.photonstorm.com @photonstorm
13
13
  *
@@ -11382,7 +11382,7 @@ PIXI.RenderTexture.tempMatrix = new PIXI.Matrix();
11382
11382
  *
11383
11383
  * Phaser - http://phaser.io
11384
11384
  *
11385
- * v2.1.1 "Eianrod" - Built: Thu Sep 11 2014 10:37:16
11385
+ * v2.1.2 "Whitebridge" - Built: Thu Oct 09 2014 16:16:06
11386
11386
  *
11387
11387
  * By Richard Davey http://www.photonstorm.com @photonstorm
11388
11388
  *
@@ -11425,7 +11425,7 @@ PIXI.RenderTexture.tempMatrix = new PIXI.Matrix();
11425
11425
  */
11426
11426
  var Phaser = Phaser || {
11427
11427
 
11428
- VERSION: '2.1.1',
11428
+ VERSION: '2.1.2',
11429
11429
  GAMES: [],
11430
11430
 
11431
11431
  AUTO: 0,
@@ -12005,7 +12005,7 @@ if (!Array.prototype.forEach)
12005
12005
  * Source: http://www.html5gamedevs.com/topic/5988-phaser-12-ie9/
12006
12006
  * Cameron Foale (http://www.kibibu.com)
12007
12007
  */
12008
- if (typeof window.Uint32Array !== "function")
12008
+ if (typeof window.Uint32Array !== "function" && typeof window.Uint32Array !== "object")
12009
12009
  {
12010
12010
  var CheapArray = function(type)
12011
12011
  {
@@ -12061,14 +12061,14 @@ if (!window.console)
12061
12061
  */
12062
12062
 
12063
12063
  /**
12064
- * Creates a new Circle object with the center coordinate specified by the x and y parameters and the diameter specified by the diameter parameter. If you call this function without parameters, a circle with x, y, diameter and radius properties set to 0 is created.
12065
- * @class Circle
12066
- * @classdesc Phaser - Circle
12064
+ * Creates a new Circle object with the center coordinate specified by the x and y parameters and the diameter specified by the diameter parameter.
12065
+ * If you call this function without parameters, a circle with x, y, diameter and radius properties set to 0 is created.
12066
+ *
12067
+ * @class Phaser.Circle
12067
12068
  * @constructor
12068
12069
  * @param {number} [x=0] - The x coordinate of the center of the circle.
12069
12070
  * @param {number} [y=0] - The y coordinate of the center of the circle.
12070
12071
  * @param {number} [diameter=0] - The diameter of the circle.
12071
- * @return {Phaser.Circle} This circle object
12072
12072
  */
12073
12073
  Phaser.Circle = function (x, y, diameter) {
12074
12074
 
@@ -12123,7 +12123,7 @@ Phaser.Circle.prototype = {
12123
12123
  * @method Phaser.Circle#setTo
12124
12124
  * @param {number} x - The x coordinate of the center of the circle.
12125
12125
  * @param {number} y - The y coordinate of the center of the circle.
12126
- * @param {number} diameter - The diameter of the circle in pixels.
12126
+ * @param {number} diameter - The diameter of the circle.
12127
12127
  * @return {Circle} This circle object.
12128
12128
  */
12129
12129
  setTo: function (x, y, diameter) {
@@ -12598,18 +12598,12 @@ PIXI.Circle = Phaser.Circle;
12598
12598
  */
12599
12599
 
12600
12600
  /**
12601
- * @class Phaser.Point
12602
- * @classdesc
12603
- * The Point object represents a location in a two-dimensional coordinate system,
12604
- * where x represents the horizontal axis and y represents the vertical axis.
12601
+ * A Point object represents a location in a two-dimensional coordinate system, where x represents the horizontal axis and y represents the vertical axis.
12605
12602
  * The following code creates a point at (0,0):
12606
12603
  * `var myPoint = new Phaser.Point();`
12607
12604
  * You can also use them as 2D Vectors and you'll find different vector related methods in this class.
12608
- */
12609
-
12610
- /**
12611
- * Creates a new Point object. If you pass no parameters a Point is created set to (0, 0).
12612
- *
12605
+ *
12606
+ * @class Phaser.Point
12613
12607
  * @constructor
12614
12608
  * @param {number} [x=0] - The horizontal position of this Point.
12615
12609
  * @param {number} [y=0] - The vertical position of this Point.
@@ -13463,6 +13457,38 @@ Phaser.Point.centroid = function (points, out) {
13463
13457
 
13464
13458
  };
13465
13459
 
13460
+ /**
13461
+ * Parses an object for x and/or y properties and returns a new Phaser.Point with matching values.
13462
+ * If the object doesn't contain those properties a Point with x/y of zero will be returned.
13463
+ *
13464
+ * @method Phaser.Point.parse
13465
+ * @static
13466
+ * @param {Object} obj - The object to parse.
13467
+ * @param {string} [xProp='x'] - The property used to set the Point.x value.
13468
+ * @param {string} [yProp='y'] - The property used to set the Point.y value.
13469
+ * @return {Phaser.Point} The new Point object.
13470
+ */
13471
+ Phaser.Point.parse = function(obj, xProp, yProp) {
13472
+
13473
+ xProp = xProp || 'x';
13474
+ yProp = yProp || 'y';
13475
+
13476
+ var point = new Phaser.Point();
13477
+
13478
+ if (obj[xProp])
13479
+ {
13480
+ point.x = parseInt(obj[xProp], 10);
13481
+ }
13482
+
13483
+ if (obj[yProp])
13484
+ {
13485
+ point.y = parseInt(obj[yProp], 10);
13486
+ }
13487
+
13488
+ return point;
13489
+
13490
+ };
13491
+
13466
13492
  // Because PIXI uses its own Point, we'll replace it with ours to avoid duplicating code or confusion.
13467
13493
  PIXI.Point = Phaser.Point;
13468
13494
 
@@ -13473,7 +13499,8 @@ PIXI.Point = Phaser.Point;
13473
13499
  */
13474
13500
 
13475
13501
  /**
13476
- * Creates a new Rectangle object with the top-left corner specified by the x and y parameters and with the specified width and height parameters. If you call this function without parameters, a Rectangle with x, y, width, and height properties set to 0 is created.
13502
+ * Creates a new Rectangle object with the top-left corner specified by the x and y parameters and with the specified width and height parameters.
13503
+ * If you call this function without parameters, a Rectangle with x, y, width, and height properties set to 0 is created.
13477
13504
  *
13478
13505
  * @class Phaser.Rectangle
13479
13506
  * @constructor
@@ -13481,7 +13508,6 @@ PIXI.Point = Phaser.Point;
13481
13508
  * @param {number} y - The y coordinate of the top-left corner of the Rectangle.
13482
13509
  * @param {number} width - The width of the Rectangle. Should always be either zero or a positive value.
13483
13510
  * @param {number} height - The height of the Rectangle. Should always be either zero or a positive value.
13484
- * @return {Phaser.Rectangle} This Rectangle object.
13485
13511
  */
13486
13512
  Phaser.Rectangle = function (x, y, width, height) {
13487
13513
 
@@ -13564,7 +13590,7 @@ Phaser.Rectangle.prototype = {
13564
13590
 
13565
13591
  /**
13566
13592
  * Centers this Rectangle so that the center coordinates match the given x and y values.
13567
- *
13593
+ *
13568
13594
  * @method Phaser.Rectangle#centerOn
13569
13595
  * @param {number} x - The x coordinate to place the center of the Rectangle at.
13570
13596
  * @param {number} y - The y coordinate to place the center of the Rectangle at.
@@ -13737,7 +13763,7 @@ Phaser.Rectangle.prototype = {
13737
13763
 
13738
13764
  /**
13739
13765
  * Determines whether the coordinates given intersects (overlaps) with this Rectangle.
13740
- *
13766
+ *
13741
13767
  * @method Phaser.Rectangle#intersectsRaw
13742
13768
  * @param {number} left - The x coordinate of the left of the area.
13743
13769
  * @param {number} right - The right coordinate of the area.
@@ -13950,7 +13976,7 @@ Object.defineProperty(Phaser.Rectangle.prototype, "centerY", {
13950
13976
 
13951
13977
  /**
13952
13978
  * A random value between the left and right values (inclusive) of the Rectangle.
13953
- *
13979
+ *
13954
13980
  * @name Phaser.Rectangle#randomX
13955
13981
  * @property {number} randomX - A random value between the left and right values (inclusive) of the Rectangle.
13956
13982
  */
@@ -13966,7 +13992,7 @@ Object.defineProperty(Phaser.Rectangle.prototype, "randomX", {
13966
13992
 
13967
13993
  /**
13968
13994
  * A random value between the top and bottom values (inclusive) of the Rectangle.
13969
- *
13995
+ *
13970
13996
  * @name Phaser.Rectangle#randomY
13971
13997
  * @property {number} randomY - A random value between the top and bottom values (inclusive) of the Rectangle.
13972
13998
  */
@@ -14306,6 +14332,47 @@ Phaser.Rectangle.union = function (a, b, output) {
14306
14332
 
14307
14333
  };
14308
14334
 
14335
+ /**
14336
+ * Calculates the Axis Aligned Bounding Box (or aabb) from an array of points.
14337
+ *
14338
+ * @method Phaser.Rectangle#aabb
14339
+ * @param {Phaser.Point[]} points - The array of one or more points.
14340
+ * @param {Phaser.Rectangle} [out] - Optional Rectangle to store the value in, if not supplied a new Rectangle object will be created.
14341
+ * @return {Phaser.Rectangle} The new Rectangle object.
14342
+ * @static
14343
+ */
14344
+ Phaser.Rectangle.aabb = function(points, out) {
14345
+
14346
+ if (typeof out === "undefined") {
14347
+ out = new Phaser.Rectangle();
14348
+ }
14349
+
14350
+ var xMax = Number.MIN_VALUE,
14351
+ xMin = Number.MAX_VALUE,
14352
+ yMax = Number.MIN_VALUE,
14353
+ yMin = Number.MAX_VALUE;
14354
+
14355
+ points.forEach(function(point) {
14356
+ if (point.x > xMax) {
14357
+ xMax = point.x;
14358
+ }
14359
+ if (point.x < xMin) {
14360
+ xMin = point.x;
14361
+ }
14362
+
14363
+ if (point.y > yMax) {
14364
+ yMax = point.y;
14365
+ }
14366
+ if (point.y < yMin) {
14367
+ yMin = point.y;
14368
+ }
14369
+ });
14370
+
14371
+ out.setTo(xMin, yMin, xMax - xMin, yMax - yMin);
14372
+
14373
+ return out;
14374
+ };
14375
+
14309
14376
  // Because PIXI uses its own Rectangle, we'll replace it with ours to avoid duplicating code or confusion.
14310
14377
  PIXI.Rectangle = Phaser.Rectangle;
14311
14378
  PIXI.EmptyRectangle = new Phaser.Rectangle(0, 0, 0, 0);
@@ -14318,14 +14385,13 @@ PIXI.EmptyRectangle = new Phaser.Rectangle(0, 0, 0, 0);
14318
14385
 
14319
14386
  /**
14320
14387
  * Creates a new Line object with a start and an end point.
14321
- * @class Line
14322
- * @classdesc Phaser - Line
14388
+ *
14389
+ * @class Phaser.Line
14323
14390
  * @constructor
14324
14391
  * @param {number} [x1=0] - The x coordinate of the start of the line.
14325
14392
  * @param {number} [y1=0] - The y coordinate of the start of the line.
14326
14393
  * @param {number} [x2=0] - The x coordinate of the end of the line.
14327
14394
  * @param {number} [y2=0] - The y coordinate of the end of the line.
14328
- * @return {Phaser.Line} This line object
14329
14395
  */
14330
14396
  Phaser.Line = function (x1, y1, x2, y2) {
14331
14397
 
@@ -14383,10 +14449,8 @@ Phaser.Line.prototype = {
14383
14449
  {
14384
14450
  return this.setTo(startSprite.center.x, startSprite.center.y, endSprite.center.x, endSprite.center.y);
14385
14451
  }
14386
- else
14387
- {
14388
- return this.setTo(startSprite.x, startSprite.y, endSprite.x, endSprite.y);
14389
- }
14452
+
14453
+ return this.setTo(startSprite.x, startSprite.y, endSprite.x, endSprite.y);
14390
14454
 
14391
14455
  },
14392
14456
 
@@ -14756,14 +14820,13 @@ Phaser.Line.intersects = function (a, b, asSegment, result) {
14756
14820
 
14757
14821
  /**
14758
14822
  * Creates a Ellipse object. A curve on a plane surrounding two focal points.
14759
- * @class Ellipse
14760
- * @classdesc Phaser - Ellipse
14823
+ *
14824
+ * @class Phaser.Ellipse
14761
14825
  * @constructor
14762
14826
  * @param {number} [x=0] - The X coordinate of the upper-left corner of the framing rectangle of this ellipse.
14763
14827
  * @param {number} [y=0] - The Y coordinate of the upper-left corner of the framing rectangle of this ellipse.
14764
14828
  * @param {number} [width=0] - The overall width of this ellipse.
14765
14829
  * @param {number} [height=0] - The overall height of this ellipse.
14766
- * @return {Phaser.Ellipse} This Ellipse object
14767
14830
  */
14768
14831
  Phaser.Ellipse = function (x, y, width, height) {
14769
14832
 
@@ -14831,7 +14894,7 @@ Phaser.Ellipse.prototype = {
14831
14894
  },
14832
14895
 
14833
14896
  /**
14834
- * Copies the x, y and diameter properties from this Circle to any given object.
14897
+ * Copies the x, y, width and height properties from this Ellipse to any given object.
14835
14898
  * @method Phaser.Ellipse#copyTo
14836
14899
  * @param {any} dest - The object to copy to.
14837
14900
  * @return {Object} This dest object.
@@ -15058,9 +15121,8 @@ PIXI.Ellipse = Phaser.Ellipse;
15058
15121
  * arguments passed can be flat x,y values e.g. `new Phaser.Polygon(x,y, x,y, x,y, ...)` where `x` and `y` are numbers.
15059
15122
  *
15060
15123
  * @class Phaser.Polygon
15061
- * @classdesc The polygon represents a list of orderded points in space
15062
15124
  * @constructor
15063
- * @param {Array<Phaser.Point>|Array<number>} points - The array of Points.
15125
+ * @param {Phaser.Point[]|number[]} points - The array of Points.
15064
15126
  */
15065
15127
  Phaser.Polygon = function (points) {
15066
15128
 
@@ -15351,6 +15413,11 @@ Phaser.Camera = function (game, id, x, y, width, height) {
15351
15413
  */
15352
15414
  this.scale = null;
15353
15415
 
15416
+ /**
15417
+ * @property {Phaser.Point} _targetPosition - Internal point used to calculate target position
15418
+ */
15419
+ this._targetPosition = new Phaser.Point();
15420
+
15354
15421
  };
15355
15422
 
15356
15423
  /**
@@ -15489,34 +15556,41 @@ Phaser.Camera.prototype = {
15489
15556
  */
15490
15557
  updateTarget: function () {
15491
15558
 
15559
+ this._targetPosition
15560
+ .copyFrom(this.target)
15561
+ .multiply(
15562
+ this.target.parent ? this.target.parent.worldTransform.a : 1,
15563
+ this.target.parent ? this.target.parent.worldTransform.d : 1
15564
+ );
15565
+
15492
15566
  if (this.deadzone)
15493
15567
  {
15494
- this._edge = this.target.x - this.view.x;
15568
+ this._edge = this._targetPosition.x - this.view.x;
15495
15569
 
15496
15570
  if (this._edge < this.deadzone.left)
15497
15571
  {
15498
- this.view.x = this.target.x - this.deadzone.left;
15572
+ this.view.x = this._targetPosition.x - this.deadzone.left;
15499
15573
  }
15500
15574
  else if (this._edge > this.deadzone.right)
15501
15575
  {
15502
- this.view.x = this.target.x - this.deadzone.right;
15576
+ this.view.x = this._targetPosition.x - this.deadzone.right;
15503
15577
  }
15504
15578
 
15505
- this._edge = this.target.y - this.view.y;
15579
+ this._edge = this._targetPosition.y - this.view.y;
15506
15580
 
15507
15581
  if (this._edge < this.deadzone.top)
15508
15582
  {
15509
- this.view.y = this.target.y - this.deadzone.top;
15583
+ this.view.y = this._targetPosition.y - this.deadzone.top;
15510
15584
  }
15511
15585
  else if (this._edge > this.deadzone.bottom)
15512
15586
  {
15513
- this.view.y = this.target.y - this.deadzone.bottom;
15587
+ this.view.y = this._targetPosition.y - this.deadzone.bottom;
15514
15588
  }
15515
15589
  }
15516
15590
  else
15517
15591
  {
15518
- this.view.x = this.target.x - this.view.halfWidth;
15519
- this.view.y = this.target.y - this.view.halfHeight;
15592
+ this.view.x = this._targetPosition.x - this.view.halfWidth;
15593
+ this.view.y = this._targetPosition.y - this.view.halfHeight;
15520
15594
  }
15521
15595
 
15522
15596
  },
@@ -16067,18 +16141,15 @@ Phaser.StateManager.prototype = {
16067
16141
  */
16068
16142
  boot: function () {
16069
16143
 
16144
+ // console.log('StateManager boot');
16145
+
16070
16146
  this.game.onPause.add(this.pause, this);
16071
16147
  this.game.onResume.add(this.resume, this);
16072
16148
  this.game.load.onLoadComplete.add(this.loadComplete, this);
16073
16149
 
16074
16150
  if (this._pendingState !== null)
16075
16151
  {
16076
- if (typeof this._pendingState === 'string')
16077
- {
16078
- // State was already added, so just start it
16079
- this.start(this._pendingState, false, false);
16080
- }
16081
- else
16152
+ if (typeof this._pendingState !== 'string')
16082
16153
  {
16083
16154
  this.add('default', this._pendingState, true);
16084
16155
  }
@@ -16175,12 +16246,17 @@ Phaser.StateManager.prototype = {
16175
16246
  */
16176
16247
  start: function (key, clearWorld, clearCache) {
16177
16248
 
16249
+ // console.log('-----------------------------------------------------------------------------------------');
16250
+ // console.log('START:', key);
16251
+
16178
16252
  if (typeof clearWorld === "undefined") { clearWorld = true; }
16179
16253
  if (typeof clearCache === "undefined") { clearCache = false; }
16180
16254
 
16181
16255
  if (this.checkState(key))
16182
16256
  {
16183
16257
  // Place the state in the queue. It will be started the next time the game loop starts.
16258
+ // console.log('set to pending', key);
16259
+
16184
16260
  this._pendingState = key;
16185
16261
  this._clearWorld = clearWorld;
16186
16262
  this._clearCache = clearCache;
@@ -16235,32 +16311,50 @@ Phaser.StateManager.prototype = {
16235
16311
 
16236
16312
  if (this._pendingState && this.game.isBooted)
16237
16313
  {
16314
+ // console.log('preUpdate - has pending:', this._pendingState, 'current:', this.current);
16315
+
16238
16316
  // Already got a state running?
16239
16317
  this.clearCurrentState();
16240
16318
 
16241
16319
  this.setCurrentState(this._pendingState);
16242
16320
 
16243
- this._pendingState = null;
16321
+ if (this.current !== this._pendingState)
16322
+ {
16323
+ // console.log('-> init called StateManager.start(', this._pendingState, ') so bail out');
16324
+ return;
16325
+ }
16326
+ else
16327
+ {
16328
+ this._pendingState = null;
16329
+ // console.log('pending nulled');
16330
+ }
16244
16331
 
16332
+ // If StateManager.start has been called from the init of a State that ALSO has a preload, then
16333
+ // onPreloadCallback will be set, but must be ignored
16245
16334
  if (this.onPreloadCallback)
16246
16335
  {
16336
+ // console.log('-> preload (', this.current, ')');
16337
+
16247
16338
  this.game.load.reset();
16248
16339
  this.onPreloadCallback.call(this.callbackContext, this.game);
16249
16340
 
16250
16341
  // Is the loader empty?
16251
16342
  if (this.game.load.totalQueuedFiles() === 0 && this.game.load.totalQueuedPacks() === 0)
16252
16343
  {
16344
+ // console.log('loadComplete from empty preloader', this.current);
16253
16345
  this.loadComplete();
16254
16346
  }
16255
16347
  else
16256
16348
  {
16257
16349
  // Start the loader going as we have something in the queue
16350
+ // console.log('load start', this.current);
16258
16351
  this.game.load.start();
16259
16352
  }
16260
16353
  }
16261
16354
  else
16262
16355
  {
16263
16356
  // No init? Then there was nothing to load either
16357
+ // console.log('loadComplete from no preloader', this.current);
16264
16358
  this.loadComplete();
16265
16359
  }
16266
16360
  }
@@ -16275,10 +16369,15 @@ Phaser.StateManager.prototype = {
16275
16369
  */
16276
16370
  clearCurrentState: function () {
16277
16371
 
16372
+ // console.log('clearCurrentState', this.current);
16373
+
16278
16374
  if (this.current)
16279
16375
  {
16376
+ // console.log('removing all', this.current);
16377
+
16280
16378
  if (this.onShutDownCallback)
16281
16379
  {
16380
+ // console.log('-> shutdown (', this.current, ')');
16282
16381
  this.onShutDownCallback.call(this.callbackContext, this.game);
16283
16382
  }
16284
16383
 
@@ -16321,6 +16420,8 @@ Phaser.StateManager.prototype = {
16321
16420
  */
16322
16421
  checkState: function (key) {
16323
16422
 
16423
+ // console.log('checking', key);
16424
+
16324
16425
  if (this.states[key])
16325
16426
  {
16326
16427
  var valid = false;
@@ -16376,6 +16477,39 @@ Phaser.StateManager.prototype = {
16376
16477
 
16377
16478
  },
16378
16479
 
16480
+ /**
16481
+ * Nulls all State level Phaser properties, including a reference to Game.
16482
+ *
16483
+ * @method Phaser.StateManager#unlink
16484
+ * @param {string} key - State key.
16485
+ * @protected
16486
+ */
16487
+ unlink: function (key) {
16488
+
16489
+ if (this.states[key])
16490
+ {
16491
+ this.states[key].game = null;
16492
+ this.states[key].add = null;
16493
+ this.states[key].make = null;
16494
+ this.states[key].camera = null;
16495
+ this.states[key].cache = null;
16496
+ this.states[key].input = null;
16497
+ this.states[key].load = null;
16498
+ this.states[key].math = null;
16499
+ this.states[key].sound = null;
16500
+ this.states[key].scale = null;
16501
+ this.states[key].state = null;
16502
+ this.states[key].stage = null;
16503
+ this.states[key].time = null;
16504
+ this.states[key].tweens = null;
16505
+ this.states[key].world = null;
16506
+ this.states[key].particles = null;
16507
+ this.states[key].rnd = null;
16508
+ this.states[key].physics = null;
16509
+ }
16510
+
16511
+ },
16512
+
16379
16513
  /**
16380
16514
  * Sets the current State. Should not be called directly (use StateManager.start)
16381
16515
  *
@@ -16385,6 +16519,8 @@ Phaser.StateManager.prototype = {
16385
16519
  */
16386
16520
  setCurrentState: function (key) {
16387
16521
 
16522
+ // console.log('setCurrentState', key);
16523
+
16388
16524
  this.callbackContext = this.states[key];
16389
16525
 
16390
16526
  this.link(key);
@@ -16410,9 +16546,16 @@ Phaser.StateManager.prototype = {
16410
16546
  this.current = key;
16411
16547
  this._created = false;
16412
16548
 
16549
+ // At this point key and pendingState should equal each other
16550
+ // console.log('-> init (', key, ')', this._pendingState);
16551
+
16413
16552
  this.onInitCallback.apply(this.callbackContext, this._args);
16414
16553
 
16415
- this._args = [];
16554
+ // If they no longer do then the init callback hit StateManager.start
16555
+ if (key === this._pendingState)
16556
+ {
16557
+ this._args = [];
16558
+ }
16416
16559
 
16417
16560
  },
16418
16561
 
@@ -16433,8 +16576,11 @@ Phaser.StateManager.prototype = {
16433
16576
  */
16434
16577
  loadComplete: function () {
16435
16578
 
16579
+ // console.log('loadComplete');
16580
+
16436
16581
  if (this._created === false && this.onCreateCallback)
16437
16582
  {
16583
+ // console.log('-> create (', this.current, ')');
16438
16584
  this._created = true;
16439
16585
  this.onCreateCallback.call(this.callbackContext, this.game);
16440
16586
  }
@@ -16993,15 +17139,16 @@ Object.defineProperty(Phaser.ArrayList.prototype, "next", {
16993
17139
  Phaser.ArrayList.prototype.constructor = Phaser.ArrayList;
16994
17140
 
16995
17141
  /**
17142
+ * @author Miller Medeiros http://millermedeiros.github.com/js-signals/
16996
17143
  * @author Richard Davey <rich@photonstorm.com>
16997
17144
  * @copyright 2014 Photon Storm Ltd.
16998
17145
  * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
16999
17146
  */
17000
17147
 
17001
17148
  /**
17149
+ * A Signal is used for object communication via a custom broadcaster instead of Events.
17150
+ *
17002
17151
  * @class Phaser.Signal
17003
- * @classdesc A Signal is used for object communication via a custom broadcaster instead of Events.
17004
- * @author Miller Medeiros http://millermedeiros.github.com/js-signals/
17005
17152
  * @constructor
17006
17153
  */
17007
17154
  Phaser.Signal = function () {
@@ -17366,18 +17513,18 @@ Phaser.Signal.prototype = {
17366
17513
  Phaser.Signal.prototype.constructor = Phaser.Signal;
17367
17514
 
17368
17515
  /**
17516
+ * @author Miller Medeiros http://millermedeiros.github.com/js-signals/
17369
17517
  * @author Richard Davey <rich@photonstorm.com>
17370
17518
  * @copyright 2014 Photon Storm Ltd.
17371
17519
  * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
17372
17520
  */
17373
17521
 
17374
17522
  /**
17375
- * @class Phaser.SignalBinding
17376
- * @classdesc Object that represents a binding between a Signal and a listener function.
17523
+ * Object that represents a binding between a Signal and a listener function.
17377
17524
  * This is an internal constructor and shouldn't be created directly.
17378
17525
  * Inspired by Joa Ebert AS3 SignalBinding and Robert Penner's Slot classes.
17379
- *
17380
- * @author Miller Medeiros http://millermedeiros.github.com/js-signals/
17526
+ *
17527
+ * @class Phaser.SignalBinding
17381
17528
  * @constructor
17382
17529
  * @param {Phaser.Signal} signal - Reference to Signal object that listener is currently bound to.
17383
17530
  * @param {function} listener - Handler function bound to the signal.
@@ -17535,7 +17682,6 @@ Phaser.SignalBinding.prototype.constructor = Phaser.SignalBinding;
17535
17682
  * This is a base Filter template to use for any Phaser filter development.
17536
17683
  *
17537
17684
  * @class Phaser.Filter
17538
- * @classdesc Phaser - Filter
17539
17685
  * @constructor
17540
17686
  * @param {Phaser.Game} game - A reference to the currently running game.
17541
17687
  * @param {Object} uniforms - Uniform mappings object
@@ -17701,7 +17847,6 @@ Object.defineProperty(Phaser.Filter.prototype, 'height', {
17701
17847
  * This is a base Plugin template to use for any Phaser plugin development.
17702
17848
  *
17703
17849
  * @class Phaser.Plugin
17704
- * @classdesc Phaser - Plugin
17705
17850
  * @constructor
17706
17851
  * @param {Phaser.Game} game - A reference to the currently running game.
17707
17852
  * @param {Any} parent - The object that owns this plugin, usually Phaser.PluginManager.
@@ -17827,7 +17972,6 @@ Phaser.Plugin.prototype.constructor = Phaser.Plugin;
17827
17972
  * The Plugin Manager is responsible for the loading, running and unloading of Phaser Plugins.
17828
17973
  *
17829
17974
  * @class Phaser.PluginManager
17830
- * @classdesc Phaser - PluginManager
17831
17975
  * @constructor
17832
17976
  * @param {Phaser.Game} game - A reference to the currently running game.
17833
17977
  */
@@ -18112,7 +18256,7 @@ Phaser.PluginManager.prototype.constructor = Phaser.PluginManager;
18112
18256
 
18113
18257
  /**
18114
18258
  * The Stage controls root level display objects upon which everything is displayed.
18115
- * It also handles browser visibility handling and the pausing due to loss of focus.
18259
+ * It also handles browser visibility handling and the pausing due to loss of focus.
18116
18260
  *
18117
18261
  * @class Phaser.Stage
18118
18262
  * @extends PIXI.Stage
@@ -18493,9 +18637,10 @@ Object.defineProperty(Phaser.Stage.prototype, "smoothed", {
18493
18637
  */
18494
18638
 
18495
18639
  /**
18496
- * Phaser Group constructor.
18640
+ * A Group is a container for display objects that allows for fast pooling and object recycling.
18641
+ * Groups can be nested within other Groups and have their own local transforms.
18642
+ *
18497
18643
  * @class Phaser.Group
18498
- * @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.
18499
18644
  * @constructor
18500
18645
  * @param {Phaser.Game} game - A reference to the currently running game.
18501
18646
  * @param {Phaser.Group|Phaser.Sprite|null} parent - The parent Group, DisplayObject or DisplayObjectContainer that this Group will be added to. If `undefined` it will use game.world. If null it won't be added to anything.
@@ -18562,6 +18707,12 @@ Phaser.Group = function (game, parent, name, addToStage, enableBody, physicsBody
18562
18707
  */
18563
18708
  this.exists = true;
18564
18709
 
18710
+ /**
18711
+ * @property {boolean} ignoreDestroy - A Group with `ignoreDestroy` set to `true` ignores all calls to its `destroy` method.
18712
+ * @default
18713
+ */
18714
+ this.ignoreDestroy = false;
18715
+
18565
18716
  /**
18566
18717
  * The type of objects that will be created when you use Group.create or Group.createMultiple. Defaults to Phaser.Sprite.
18567
18718
  * When a new object is created it is passed the following parameters to its constructor: game, x, y, key, frame.
@@ -19276,7 +19427,7 @@ Phaser.Group.prototype.checkProperty = function (child, key, value, force) {
19276
19427
  {
19277
19428
  return false;
19278
19429
  }
19279
-
19430
+
19280
19431
  if (Phaser.Utils.getProperty(child, key) !== value)
19281
19432
  {
19282
19433
  return false;
@@ -19686,6 +19837,36 @@ Phaser.Group.prototype.postUpdate = function () {
19686
19837
 
19687
19838
  };
19688
19839
 
19840
+
19841
+ /**
19842
+ * Allows you to obtain a Phaser.ArrayList of children that return true for the given predicate
19843
+ * For example:
19844
+ * var healthyList = Group.filter(function(child, index, children) {
19845
+ * return child.health > 10 ? true : false;
19846
+ * }, true);
19847
+ * healthyList.callAll('attack');
19848
+ * Note: Currently this will skip any children which are Groups themselves.
19849
+ * @method Phaser.Group#filter
19850
+ * @param {function} predicate - The function that each child will be evaluated against. Each child of the Group will be passed to it as its first parameter, the index as the second, and the entire child array as the third
19851
+ * @param {boolean} [checkExists=false] - If set only children with exists=true will be passed to the callback, otherwise all children will be passed.
19852
+ * @return {Phaser.ArrayList} Returns an array list containing all the children that the predicate returned true for
19853
+ */
19854
+ Phaser.Group.prototype.filter = function(predicate, checkExists) {
19855
+ var index = -1,
19856
+ length = this.children.length,
19857
+ result = new Phaser.ArrayList();
19858
+
19859
+ while(++index < length) {
19860
+ var child = this.children[index];
19861
+ if(!checkExists || (checkExists && child.exists)) {
19862
+ if(predicate(child, index, this.children)) {
19863
+ result.add(child);
19864
+ }
19865
+ }
19866
+ }
19867
+ return result;
19868
+ };
19869
+
19689
19870
  /**
19690
19871
  * Allows you to call your own function on each member of this Group. You must pass the callback and context in which it will run.
19691
19872
  * After the checkExists parameter you can add as many parameters as you like, which will all be passed to the callback along with the child.
@@ -20200,7 +20381,7 @@ Phaser.Group.prototype.removeBetween = function (startIndex, endIndex, destroy,
20200
20381
  */
20201
20382
  Phaser.Group.prototype.destroy = function (destroyChildren, soft) {
20202
20383
 
20203
- if (this.game === null) { return; }
20384
+ if (this.game === null || this.ignoreDestroy) { return; }
20204
20385
 
20205
20386
  if (typeof destroyChildren === 'undefined') { destroyChildren = true; }
20206
20387
  if (typeof soft === 'undefined') { soft = false; }
@@ -20706,6 +20887,7 @@ Phaser.FlexGrid = function (manager, width, height) {
20706
20887
  this.width = width;
20707
20888
  this.height = height;
20708
20889
 
20890
+ this.boundsCustom = new Phaser.Rectangle(0, 0, width, height);
20709
20891
  this.boundsFluid = new Phaser.Rectangle(0, 0, width, height);
20710
20892
  this.boundsFull = new Phaser.Rectangle(0, 0, width, height);
20711
20893
  this.boundsNone = new Phaser.Rectangle(0, 0, width, height);
@@ -20714,6 +20896,7 @@ Phaser.FlexGrid = function (manager, width, height) {
20714
20896
  * @property {Phaser.Point} position -
20715
20897
  * @readonly
20716
20898
  */
20899
+ this.positionCustom = new Phaser.Point(0, 0);
20717
20900
  this.positionFluid = new Phaser.Point(0, 0);
20718
20901
  this.positionFull = new Phaser.Point(0, 0);
20719
20902
  this.positionNone = new Phaser.Point(0, 0);
@@ -20722,11 +20905,17 @@ Phaser.FlexGrid = function (manager, width, height) {
20722
20905
  * @property {Phaser.Point} scaleFactor - The scale factor based on the game dimensions vs. the scaled dimensions.
20723
20906
  * @readonly
20724
20907
  */
20908
+ this.scaleCustom = new Phaser.Point(1, 1);
20725
20909
  this.scaleFluid = new Phaser.Point(1, 1);
20726
20910
  this.scaleFluidInversed = new Phaser.Point(1, 1);
20727
20911
  this.scaleFull = new Phaser.Point(1, 1);
20728
20912
  this.scaleNone = new Phaser.Point(1, 1);
20729
20913
 
20914
+ this.customWidth = 0;
20915
+ this.customHeight = 0;
20916
+ this.customOffsetX = 0;
20917
+ this.customOffsetY = 0;
20918
+
20730
20919
  this.ratioH = width / height;
20731
20920
  this.ratioV = height / width;
20732
20921
 
@@ -20765,6 +20954,43 @@ Phaser.FlexGrid.prototype = {
20765
20954
 
20766
20955
  // Need ability to create your own layers with custom scaling, etc.
20767
20956
 
20957
+ /**
20958
+ * A custom layer is centered on the game and maintains its aspect ratio as it scales up and down.
20959
+ *
20960
+ * @method createCustomLayer
20961
+ * @param {number} width - Width of this layer in pixels.
20962
+ * @param {number} height - Height of this layer in pixels.
20963
+ * @param {array} [children] - An array of children that are used to populate the FlexLayer.
20964
+ * @return {Phaser.FlexLayer} The Layer object.
20965
+ */
20966
+ createCustomLayer: function (width, height, children, addToWorld) {
20967
+
20968
+ if (typeof addToWorld === 'undefined') { addToWorld = true; }
20969
+
20970
+ this.customWidth = width;
20971
+ this.customHeight = height;
20972
+
20973
+ this.boundsCustom.width = width;
20974
+ this.boundsCustom.height = height;
20975
+
20976
+ var layer = new Phaser.FlexLayer(this, this.positionCustom, this.boundsCustom, this.scaleCustom);
20977
+
20978
+ if (addToWorld)
20979
+ {
20980
+ this.game.world.add(layer);
20981
+ }
20982
+
20983
+ this.layers.push(layer);
20984
+
20985
+ if (typeof children !== 'undefined' && typeof children !== null)
20986
+ {
20987
+ layer.addMultiple(children);
20988
+ }
20989
+
20990
+ return layer;
20991
+
20992
+ },
20993
+
20768
20994
  /**
20769
20995
  * A fluid layer is centered on the game and maintains its aspect ratio as it scales up and down.
20770
20996
  *
@@ -20903,6 +21129,24 @@ Phaser.FlexGrid.prototype = {
20903
21129
  this.positionFluid.set(this.boundsFluid.x, this.boundsFluid.y);
20904
21130
  this.positionNone.set(this.boundsNone.x, this.boundsNone.y);
20905
21131
 
21132
+ // Custom Layer
21133
+
21134
+ /*
21135
+ if (this.customWidth > 0)
21136
+ {
21137
+ var customMultiplier = Math.min((this.manager.height / this.customHeight), (this.manager.width / this.customWidth));
21138
+
21139
+ this.boundsCustom.width = Math.round(this.customWidth * customMultiplier);
21140
+ this.boundsCustom.height = Math.round(this.customHeight * customMultiplier);
21141
+
21142
+ this.boundsCustom.centerOn(this.manager.bounds.centerX, this.manager.bounds.centerY);
21143
+
21144
+ this.scaleCustom.set(this.boundsCustom.width / this.width, this.boundsCustom.height / this.height);
21145
+
21146
+ this.positionCustom.set(this.boundsCustom.x, this.boundsCustom.y);
21147
+ }
21148
+ */
21149
+
20906
21150
  },
20907
21151
 
20908
21152
  /**
@@ -20917,14 +21161,17 @@ Phaser.FlexGrid.prototype = {
20917
21161
  // this.layers[i].debug();
20918
21162
  // }
20919
21163
 
20920
- this.game.debug.text(this.boundsFull.width + ' x ' + this.boundsFull.height, this.boundsFull.x + 4, this.boundsFull.y + 16);
20921
- this.game.debug.geom(this.boundsFull, 'rgba(0,0,255,0.9', false);
21164
+ // this.game.debug.text(this.boundsFull.width + ' x ' + this.boundsFull.height, this.boundsFull.x + 4, this.boundsFull.y + 16);
21165
+ // this.game.debug.geom(this.boundsFull, 'rgba(0,0,255,0.9', false);
20922
21166
 
20923
21167
  this.game.debug.text(this.boundsFluid.width + ' x ' + this.boundsFluid.height, this.boundsFluid.x + 4, this.boundsFluid.y + 16);
20924
21168
  this.game.debug.geom(this.boundsFluid, 'rgba(255,0,0,0.9', false);
20925
21169
 
20926
- this.game.debug.text(this.boundsNone.width + ' x ' + this.boundsNone.height, this.boundsNone.x + 4, this.boundsNone.y + 16);
20927
- this.game.debug.geom(this.boundsNone, 'rgba(0,255,0,0.9', false);
21170
+ // this.game.debug.text(this.boundsNone.width + ' x ' + this.boundsNone.height, this.boundsNone.x + 4, this.boundsNone.y + 16);
21171
+ // this.game.debug.geom(this.boundsNone, 'rgba(0,255,0,0.9', false);
21172
+
21173
+ // this.game.debug.text(this.boundsCustom.width + ' x ' + this.boundsCustom.height, this.boundsCustom.x + 4, this.boundsCustom.y + 16);
21174
+ // this.game.debug.geom(this.boundsCustom, 'rgba(255,255,0,0.9', false);
20928
21175
 
20929
21176
  }
20930
21177
 
@@ -22176,14 +22423,12 @@ Object.defineProperty(Phaser.ScaleManager.prototype, "isLandscape", {
22176
22423
  */
22177
22424
 
22178
22425
  /**
22179
- * Game constructor
22180
- *
22181
- * Instantiate a new <code>Phaser.Game</code> object.
22182
- * @class Phaser.Game
22183
- * @classdesc This is where the magic happens. The Game object is the heart of your game,
22426
+ * This is where the magic happens. The Game object is the heart of your game,
22184
22427
  * providing quick access to common functions and handling the boot process.
22185
22428
  * "Hell, there are no rules here - we're trying to accomplish something."
22186
22429
  * Thomas A. Edison
22430
+ *
22431
+ * @class Phaser.Game
22187
22432
  * @constructor
22188
22433
  * @param {number|string} [width=800] - The width of your game in game pixels. If given as a string the value must be between 0 and 100 and will be used as the percentage width of the parent container, or the browser window if no parent is given.
22189
22434
  * @param {number|string} [height=600] - The height of your game in game pixels. If given as a string the value must be between 0 and 100 and will be used as the percentage height of the parent container, or the browser window if no parent is given.
@@ -22191,7 +22436,7 @@ Object.defineProperty(Phaser.ScaleManager.prototype, "isLandscape", {
22191
22436
  * @param {string|HTMLElement} [parent=''] - The DOM element into which this games canvas will be injected. Either a DOM ID (string) or the element itself.
22192
22437
  * @param {object} [state=null] - The default state object. A object consisting of Phaser.State functions (preload, create, update, render) or null.
22193
22438
  * @param {boolean} [transparent=false] - Use a transparent canvas background or not.
22194
- * @param {boolean} [antialias=true] - Draw all image textures anti-aliased or not. The default is for smooth textures, but disable if your game features pixel art.
22439
+ * @param {boolean} [antialias=true] - Draw all image textures anti-aliased or not. The default is for smooth textures, but disable if your game features pixel art.
22195
22440
  * @param {object} [physicsConfig=null] - A physics configuration object to pass to the Physics world on creation.
22196
22441
  */
22197
22442
  Phaser.Game = function (width, height, renderer, parent, state, transparent, antialias, physicsConfig) {
@@ -24061,8 +24306,9 @@ Object.defineProperty(Phaser.Input.prototype, "worldY", {
24061
24306
  */
24062
24307
 
24063
24308
  /**
24309
+ * If you need more fine-grained control over the handling of specific keys you can create and use Phaser.Key objects.
24310
+ *
24064
24311
  * @class Phaser.Key
24065
- * @classdesc If you need more fine-grained control over the handling of specific keys you can create and use Phaser.Key objects.
24066
24312
  * @constructor
24067
24313
  * @param {Phaser.Game} game - Current game instance.
24068
24314
  * @param {number} keycode - The key code this Key is responsible for.
@@ -24961,6 +25207,8 @@ Phaser.Keyboard.INSERT = 45;
24961
25207
  Phaser.Keyboard.DELETE = 46;
24962
25208
  Phaser.Keyboard.HELP = 47;
24963
25209
  Phaser.Keyboard.NUM_LOCK = 144;
25210
+ Phaser.Keyboard.PLUS = 43;
25211
+ Phaser.Keyboard.MINUS = 45;
24964
25212
 
24965
25213
  /**
24966
25214
  * @author Richard Davey <rich@photonstorm.com>
@@ -25514,12 +25762,11 @@ Phaser.Mouse.prototype.constructor = Phaser.Mouse;
25514
25762
  */
25515
25763
 
25516
25764
  /**
25517
- * Phaser - MSPointer constructor.
25518
- *
25519
- * @class Phaser.MSPointer
25520
- * @classdesc The MSPointer class handles touch interactions with the game and the resulting Pointer objects.
25765
+ * The MSPointer class handles touch interactions with the game and the resulting Pointer objects.
25521
25766
  * It will work only in Internet Explorer 10 and Windows Store or Windows Phone 8 apps using JavaScript.
25522
25767
  * http://msdn.microsoft.com/en-us/library/ie/hh673557(v=vs.85).aspx
25768
+ *
25769
+ * @class Phaser.MSPointer
25523
25770
  * @constructor
25524
25771
  * @param {Phaser.Game} game - A reference to the currently running game.
25525
25772
  */
@@ -25608,8 +25855,9 @@ Phaser.MSPointer.prototype = {
25608
25855
 
25609
25856
  /**
25610
25857
  * The function that handles the PointerDown event.
25858
+ *
25611
25859
  * @method Phaser.MSPointer#onPointerDown
25612
- * @param {PointerEvent} event
25860
+ * @param {PointerEvent} event - The native DOM event.
25613
25861
  */
25614
25862
  onPointerDown: function (event) {
25615
25863
 
@@ -25628,7 +25876,7 @@ Phaser.MSPointer.prototype = {
25628
25876
  /**
25629
25877
  * The function that handles the PointerMove event.
25630
25878
  * @method Phaser.MSPointer#onPointerMove
25631
- * @param {PointerEvent } event
25879
+ * @param {PointerEvent} event - The native DOM event.
25632
25880
  */
25633
25881
  onPointerMove: function (event) {
25634
25882
 
@@ -25647,7 +25895,7 @@ Phaser.MSPointer.prototype = {
25647
25895
  /**
25648
25896
  * The function that handles the PointerUp event.
25649
25897
  * @method Phaser.MSPointer#onPointerUp
25650
- * @param {PointerEvent} event
25898
+ * @param {PointerEvent} event - The native DOM event.
25651
25899
  */
25652
25900
  onPointerUp: function (event) {
25653
25901
 
@@ -25690,10 +25938,9 @@ Phaser.MSPointer.prototype.constructor = Phaser.MSPointer;
25690
25938
  */
25691
25939
 
25692
25940
  /**
25693
- * Phaser - Pointer constructor.
25941
+ * A Pointer object is used by the Mouse, Touch and MSPoint managers and represents a single finger on the touch screen.
25694
25942
  *
25695
25943
  * @class Phaser.Pointer
25696
- * @classdesc A Pointer object is used by the Mouse, Touch and MSPoint managers and represents a single finger on the touch screen.
25697
25944
  * @constructor
25698
25945
  * @param {Phaser.Game} game - A reference to the currently running game.
25699
25946
  * @param {number} id - The ID of the Pointer object within the game. Each game can have up to 10 active pointers.
@@ -26463,7 +26710,6 @@ Object.defineProperty(Phaser.Pointer.prototype, "worldY", {
26463
26710
  * Phaser.Touch handles touch events with your game. Note: Android 2.x only supports 1 touch event at once, no multi-touch.
26464
26711
  *
26465
26712
  * @class Phaser.Touch
26466
- * @classdesc The Touch class handles touch interactions with the game and the resulting Pointer objects.
26467
26713
  * @constructor
26468
26714
  * @param {Phaser.Game} game - A reference to the currently running game.
26469
26715
  */
@@ -27502,8 +27748,9 @@ Phaser.Gamepad.PS3XC_STICK_RIGHT_Y = 3; // analog stick, range -1..1
27502
27748
  */
27503
27749
 
27504
27750
  /**
27751
+ * A single Phaser Gamepad
27752
+ *
27505
27753
  * @class Phaser.SinglePad
27506
- * @classdesc A single Phaser Gamepad
27507
27754
  * @constructor
27508
27755
  * @param {Phaser.Game} game - Current game instance.
27509
27756
  * @param {Object} padParent - The parent Phaser.Gamepad object (all gamepads reside under this)
@@ -28056,8 +28303,9 @@ Phaser.SinglePad.prototype.constructor = Phaser.SinglePad;
28056
28303
  */
28057
28304
 
28058
28305
  /**
28306
+ * If you need more fine-grained control over the handling of specific buttons you can create and use Phaser.GamepadButton objects.
28307
+ *
28059
28308
  * @class Phaser.GamepadButton
28060
- * @classdesc If you need more fine-grained control over the handling of specific buttons you can create and use Phaser.GamepadButton objects.
28061
28309
  * @constructor
28062
28310
  * @param {Phaser.SinglePad} pad - A reference to the gamepad that owns this button.
28063
28311
  * @param {number} buttonCode - The button code this GamepadButton is responsible for.
@@ -28268,6 +28516,7 @@ Phaser.GamepadButton.prototype.constructor = Phaser.GamepadButton;
28268
28516
 
28269
28517
  /**
28270
28518
  * The Input Handler is bound to a specific Sprite and is responsible for managing all Input events on that Sprite.
28519
+ *
28271
28520
  * @class Phaser.InputHandler
28272
28521
  * @constructor
28273
28522
  * @param {Phaser.Sprite} sprite - The Sprite object to which this Input Handler belongs.
@@ -28433,6 +28682,11 @@ Phaser.InputHandler = function (sprite) {
28433
28682
  */
28434
28683
  this.consumePointerEvent = false;
28435
28684
 
28685
+ /**
28686
+ * @property {boolean} scaleLayer - EXPERIMENTAL: Please do not use this property unless you know what it does. Likely to change in the future.
28687
+ */
28688
+ this.scaleLayer = false;
28689
+
28436
28690
  /**
28437
28691
  * @property {boolean} _dragPhase - Internal cache var.
28438
28692
  * @private
@@ -29270,16 +29524,19 @@ Phaser.InputHandler.prototype = {
29270
29524
  return false;
29271
29525
  }
29272
29526
 
29527
+ var px = this.globalToLocalX(pointer.x) + this._dragPoint.x + this.dragOffset.x;
29528
+ var py = this.globalToLocalY(pointer.y) + this._dragPoint.y + this.dragOffset.y;
29529
+
29273
29530
  if (this.sprite.fixedToCamera)
29274
29531
  {
29275
29532
  if (this.allowHorizontalDrag)
29276
29533
  {
29277
- this.sprite.cameraOffset.x = pointer.x + this._dragPoint.x + this.dragOffset.x;
29534
+ this.sprite.cameraOffset.x = px;
29278
29535
  }
29279
29536
 
29280
29537
  if (this.allowVerticalDrag)
29281
29538
  {
29282
- this.sprite.cameraOffset.y = pointer.y + this._dragPoint.y + this.dragOffset.y;
29539
+ this.sprite.cameraOffset.y = py;
29283
29540
  }
29284
29541
 
29285
29542
  if (this.boundsRect)
@@ -29302,12 +29559,12 @@ Phaser.InputHandler.prototype = {
29302
29559
  {
29303
29560
  if (this.allowHorizontalDrag)
29304
29561
  {
29305
- this.sprite.x = pointer.x + this._dragPoint.x + this.dragOffset.x;
29562
+ this.sprite.x = px;
29306
29563
  }
29307
29564
 
29308
29565
  if (this.allowVerticalDrag)
29309
29566
  {
29310
- this.sprite.y = pointer.y + this._dragPoint.y + this.dragOffset.y;
29567
+ this.sprite.y = py;
29311
29568
  }
29312
29569
 
29313
29570
  if (this.boundsRect)
@@ -29521,14 +29778,12 @@ Phaser.InputHandler.prototype = {
29521
29778
  if (this.dragFromCenter)
29522
29779
  {
29523
29780
  var bounds = this.sprite.getBounds();
29524
- this.sprite.x = pointer.x + (this.sprite.x - bounds.centerX);
29525
- this.sprite.y = pointer.y + (this.sprite.y - bounds.centerY);
29526
- this._dragPoint.setTo(this.sprite.x - pointer.x, this.sprite.y - pointer.y);
29527
- }
29528
- else
29529
- {
29530
- this._dragPoint.setTo(this.sprite.x - pointer.x, this.sprite.y - pointer.y);
29781
+
29782
+ this.sprite.x = this.globalToLocalX(pointer.x) + (this.sprite.x - bounds.centerX);
29783
+ this.sprite.y = this.globalToLocalY(pointer.y) + (this.sprite.y - bounds.centerY);
29531
29784
  }
29785
+
29786
+ this._dragPoint.setTo(this.sprite.x - this.globalToLocalX(pointer.x), this.sprite.y - this.globalToLocalY(pointer.y));
29532
29787
  }
29533
29788
 
29534
29789
  this.updateDrag(pointer);
@@ -29543,6 +29798,40 @@ Phaser.InputHandler.prototype = {
29543
29798
 
29544
29799
  },
29545
29800
 
29801
+ /**
29802
+ * Warning: EXPERIMENTAL
29803
+ * @method Phaser.InputHandler#globalToLocalX
29804
+ * @param {number} x
29805
+ */
29806
+ globalToLocalX: function (x) {
29807
+
29808
+ if (this.scaleLayer)
29809
+ {
29810
+ x -= this.game.scale.grid.boundsFluid.x;
29811
+ x *= this.game.scale.grid.scaleFluidInversed.x;
29812
+ }
29813
+
29814
+ return x;
29815
+
29816
+ },
29817
+
29818
+ /**
29819
+ * Warning: EXPERIMENTAL
29820
+ * @method Phaser.InputHandler#globalToLocalY
29821
+ * @param {number} y
29822
+ */
29823
+ globalToLocalY: function (y) {
29824
+
29825
+ if (this.scaleLayer)
29826
+ {
29827
+ y -= this.game.scale.grid.boundsFluid.y;
29828
+ y *= this.game.scale.grid.scaleFluidInversed.y;
29829
+ }
29830
+
29831
+ return y;
29832
+
29833
+ },
29834
+
29546
29835
  /**
29547
29836
  * Called by Pointer when drag is stopped on this Sprite. Should not usually be called directly.
29548
29837
  * @method Phaser.InputHandler#stopDrag
@@ -29741,9 +30030,7 @@ Phaser.InputHandler.prototype.constructor = Phaser.InputHandler;
29741
30030
  */
29742
30031
 
29743
30032
  /**
29744
- * @class Phaser.Events
29745
- *
29746
- * @classdesc The Events component is a collection of events fired by the parent game object.
30033
+ * The Events component is a collection of events fired by the parent game object.
29747
30034
  *
29748
30035
  * For example to tell when a Sprite has been added to a new group:
29749
30036
  *
@@ -29753,8 +30040,8 @@ Phaser.InputHandler.prototype.constructor = Phaser.InputHandler;
29753
30040
  *
29754
30041
  * Note that the Input related events only exist if the Sprite has had `inputEnabled` set to `true`.
29755
30042
  *
30043
+ * @class Phaser.Events
29756
30044
  * @constructor
29757
- *
29758
30045
  * @param {Phaser.Sprite} sprite - A reference to Description.
29759
30046
  */
29760
30047
  Phaser.Events = function (sprite) {
@@ -30074,6 +30361,19 @@ Phaser.GameObjectFactory.prototype = {
30074
30361
  sound: function (key, volume, loop, connect) {
30075
30362
 
30076
30363
  return this.game.sound.add(key, volume, loop, connect);
30364
+
30365
+ },
30366
+
30367
+ /**
30368
+ * Creates a new AudioSprite object.
30369
+ *
30370
+ * @method Phaser.GameObjectFactory#audioSprite
30371
+ * @param {string} key - The Game.cache key of the sound that this object will use.
30372
+ * @return {Phaser.AudioSprite} The newly created AudioSprite object.
30373
+ */
30374
+ audioSprite: function (key) {
30375
+
30376
+ return this.game.sound.addSprite(key);
30077
30377
 
30078
30378
  },
30079
30379
 
@@ -30483,6 +30783,19 @@ Phaser.GameObjectCreator.prototype = {
30483
30783
 
30484
30784
  },
30485
30785
 
30786
+ /**
30787
+ * Creates a new AudioSprite object.
30788
+ *
30789
+ * @method Phaser.GameObjectCreator#audioSprite
30790
+ * @param {string} key - The Game.cache key of the sound that this object will use.
30791
+ * @return {Phaser.AudioSprite} The newly created AudioSprite object.
30792
+ */
30793
+ audioSprite: function (key) {
30794
+
30795
+ return this.game.sound.addSprite(key);
30796
+
30797
+ },
30798
+
30486
30799
  /**
30487
30800
  * Creates a new Sound object.
30488
30801
  *
@@ -30749,13 +31062,11 @@ Phaser.GameObjectCreator.prototype.constructor = Phaser.GameObjectCreator;
30749
31062
  */
30750
31063
 
30751
31064
  /**
30752
- * Creates a new BitmapData object.
31065
+ * A BitmapData object contains a Canvas element to which you can draw anything you like via normal Canvas context operations.
31066
+ * A single BitmapData can be used as the texture for one or many Images/Sprites.
31067
+ * So if you need to dynamically create a Sprite texture then they are a good choice.
30753
31068
  *
30754
31069
  * @class Phaser.BitmapData
30755
- *
30756
- * @classdesc A BitmapData object contains a Canvas element to which you can draw anything you like via normal Canvas context operations.
30757
- * A single BitmapData can be used as the texture for one or many Images/Sprites. So if you need to dynamically create a Sprite texture then they are a good choice.
30758
- *
30759
31070
  * @constructor
30760
31071
  * @param {Phaser.Game} game - A reference to the currently running game.
30761
31072
  * @param {string} key - Internal Phaser reference key for the render texture.
@@ -30939,6 +31250,12 @@ Phaser.BitmapData = function (game, key, width, height) {
30939
31250
  */
30940
31251
  this._tempB = 0;
30941
31252
 
31253
+ /**
31254
+ * @property {Phaser.Circle} _circle - Internal cache var.
31255
+ * @private
31256
+ */
31257
+ this._circle = new Phaser.Circle();
31258
+
30942
31259
  };
30943
31260
 
30944
31261
  Phaser.BitmapData.prototype = {
@@ -31635,6 +31952,17 @@ Phaser.BitmapData.prototype = {
31635
31952
  tx += source.texture.trim.x - source.anchor.x * source.texture.trim.width;
31636
31953
  ty += source.texture.trim.y - source.anchor.y * source.texture.trim.height;
31637
31954
  }
31955
+
31956
+ if (source.tint !== 0xFFFFFF)
31957
+ {
31958
+ if (source.cachedTint !== source.tint)
31959
+ {
31960
+ source.cachedTint = source.tint;
31961
+ source.tintedTexture = PIXI.CanvasTinter.getTintedTexture(source, source.tint);
31962
+ }
31963
+
31964
+ this._image = source.tintedTexture;
31965
+ }
31638
31966
  }
31639
31967
  else
31640
31968
  {
@@ -31806,17 +32134,65 @@ Phaser.BitmapData.prototype = {
31806
32134
 
31807
32135
  },
31808
32136
 
32137
+ /**
32138
+ * Sets the shadow properties of this BitmapDatas context which will affect all draw operations made to it.
32139
+ * You can cancel an existing shadow by calling this method and passing no parameters.
32140
+ * Note: At the time of writing (October 2014) Chrome still doesn't support shadowBlur used with drawImage.
32141
+ *
32142
+ * @method Phaser.BitmapData#shadow
32143
+ * @param {string} color - The color of the shadow, given in a CSS format, i.e. `#000000` or `rgba(0,0,0,1)`. If `null` or `undefined` the shadow will be reset.
32144
+ * @param {number} [blur=5] - The amount the shadow will be blurred by. Low values = a crisp shadow, high values = a softer shadow.
32145
+ * @param {number} [x=10] - The horizontal offset of the shadow in pixels.
32146
+ * @param {number} [y=10] - The vertical offset of the shadow in pixels.
32147
+ * @return {Phaser.BitmapData} This BitmapData object for method chaining.
32148
+ */
32149
+ shadow: function (color, blur, x, y) {
32150
+
32151
+ if (typeof color === 'undefined' || color === null)
32152
+ {
32153
+ this.context.shadowColor = 'rgba(0,0,0,0)';
32154
+ }
32155
+ else
32156
+ {
32157
+ this.context.shadowColor = color;
32158
+ this.context.shadowBlur = blur || 5;
32159
+ this.context.shadowOffsetX = x || 10;
32160
+ this.context.shadowOffsetY = y || 10;
32161
+ }
32162
+
32163
+ },
32164
+
31809
32165
  /**
31810
32166
  * Draws the image onto this BitmapData using an image as an alpha mask.
31811
32167
  *
31812
32168
  * @method Phaser.BitmapData#alphaMask
31813
32169
  * @param {Phaser.Sprite|Phaser.Image|Phaser.Text|Phaser.BitmapData|HTMLImage|HTMLCanvasElement|string} source - The source to copy from. If you give a string it will try and find the Image in the Game.Cache first. This is quite expensive so try to provide the image itself.
31814
32170
  * @param {Phaser.Sprite|Phaser.Image|Phaser.Text|Phaser.BitmapData|HTMLImage|HTMLCanvasElement|string} [mask] - The object to be used as the mask. If you give a string it will try and find the Image in the Game.Cache first. This is quite expensive so try to provide the image itself. If you don't provide a mask it will use this BitmapData as the mask.
32171
+ * @param {Phaser.Rectangle} [sourceRect] - A Rectangle where x/y define the coordinates to draw the Source image to and width/height define the size.
32172
+ * @param {Phaser.Rectangle} [maskRect] - A Rectangle where x/y define the coordinates to draw the Mask image to and width/height define the size.
31815
32173
  * @return {Phaser.BitmapData} This BitmapData object for method chaining.
31816
32174
  */
31817
- alphaMask: function (source, mask) {
32175
+ alphaMask: function (source, mask, sourceRect, maskRect) {
32176
+
32177
+ if (typeof maskRect === 'undefined' || maskRect === null)
32178
+ {
32179
+ this.draw(mask).blendSourceAtop();
32180
+ }
32181
+ else
32182
+ {
32183
+ this.draw(mask, maskRect.x, maskRect.y, maskRect.width, maskRect.height).blendSourceAtop();
32184
+ }
32185
+
32186
+ if (typeof sourceRect === 'undefined' || sourceRect === null)
32187
+ {
32188
+ this.draw(source).blendReset();
32189
+ }
32190
+ else
32191
+ {
32192
+ this.draw(source, sourceRect.x, sourceRect.y, sourceRect.width, sourceRect.height).blendReset();
32193
+ }
31818
32194
 
31819
- return this.draw(mask).blendSourceAtop().draw(source).blendReset();
32195
+ return this;
31820
32196
 
31821
32197
  },
31822
32198
 
@@ -31924,6 +32300,54 @@ Phaser.BitmapData.prototype = {
31924
32300
 
31925
32301
  },
31926
32302
 
32303
+ /**
32304
+ * Takes the given Line object and image and renders it to this BitmapData as a repeating texture line.
32305
+ *
32306
+ * @method Phaser.BitmapData#textureLine
32307
+ * @param {Phaser.Line} line - A Phaser.Line object that will be used to plot the start and end of the line.
32308
+ * @param {string|HTMLImage} image - The key of an image in the Phaser.Cache to use as the texture for this line, or an actual Image.
32309
+ * @param {string} [repeat='repeat-x'] - The pattern repeat mode to use when drawing the line. Either `repeat`, `repeat-x` or `no-repeat`.
32310
+ * @return {Phaser.BitmapData} This BitmapData object for method chaining.
32311
+ */
32312
+ textureLine: function (line, image, repeat) {
32313
+
32314
+ if (typeof repeat === 'undefined') { repeat = 'repeat-x'; }
32315
+
32316
+ if (typeof image === 'string')
32317
+ {
32318
+ image = this.game.cache.getImage(image);
32319
+
32320
+ if (!image)
32321
+ {
32322
+ return;
32323
+ }
32324
+ }
32325
+
32326
+ var width = line.length;
32327
+
32328
+ if (repeat === 'no-repeat' && width > image.width)
32329
+ {
32330
+ width = image.width;
32331
+ }
32332
+
32333
+ this.context.fillStyle = this.context.createPattern(image, repeat);
32334
+
32335
+ this._circle = new Phaser.Circle(line.start.x, line.start.y, image.height);
32336
+
32337
+ this._circle.circumferencePoint(line.angle - 1.5707963267948966, false, this._pos);
32338
+
32339
+ this.context.save();
32340
+ this.context.translate(this._pos.x, this._pos.y);
32341
+ this.context.rotate(line.angle);
32342
+ this.context.fillRect(0, 0, width, image.height);
32343
+ this.context.restore();
32344
+
32345
+ this.dirty = true;
32346
+
32347
+ return this;
32348
+
32349
+ },
32350
+
31927
32351
  /**
31928
32352
  * If the game is running in WebGL this will push the texture up to the GPU if it's dirty.
31929
32353
  * This is called automatically if the BitmapData is being used by a Sprite, otherwise you need to remember to call it in your render function.
@@ -32341,14 +32765,13 @@ Phaser.BitmapData.prototype.constructor = Phaser.BitmapData;
32341
32765
  */
32342
32766
 
32343
32767
  /**
32344
- * @class Phaser.Sprite
32345
- *
32346
- * @classdesc Create a new `Sprite` object. Sprites are the lifeblood of your game, used for nearly everything visual.
32768
+ * Sprites are the lifeblood of your game, used for nearly everything visual.
32347
32769
  *
32348
32770
  * At its most basic a Sprite consists of a set of coordinates and a texture that is rendered to the canvas.
32349
32771
  * They also contain additional properties allowing for physics motion (via Sprite.body), input handling (via Sprite.input),
32350
32772
  * events (via Sprite.events), animation (via Sprite.animations), camera culling and more. Please see the Examples for use cases.
32351
32773
  *
32774
+ * @class Phaser.Sprite
32352
32775
  * @constructor
32353
32776
  * @extends PIXI.Sprite
32354
32777
  * @param {Phaser.Game} game - A reference to the currently running game.
@@ -32716,6 +33139,11 @@ Phaser.Sprite.prototype.loadTexture = function (key, frame, stopAnimation) {
32716
33139
  {
32717
33140
  // This works from a reference, which probably isn't what we need here
32718
33141
  this.setTexture(key.texture);
33142
+
33143
+ if (this.game.cache.getFrameData(key.key, Phaser.Cache.BITMAPDATA))
33144
+ {
33145
+ setFrame = !this.animations.loadFrameData(this.game.cache.getFrameData(key.key, Phaser.Cache.BITMAPDATA), frame);
33146
+ }
32719
33147
  }
32720
33148
  else if (key instanceof PIXI.Texture)
32721
33149
  {
@@ -32795,6 +33223,10 @@ Phaser.Sprite.prototype.setFrame = function(frame) {
32795
33223
  this.texture.frame.width = frame.sourceSizeW;
32796
33224
  this.texture.frame.height = frame.sourceSizeH;
32797
33225
  }
33226
+ else if (!frame.trimmed && this.texture.trim)
33227
+ {
33228
+ this.texture.trim = null;
33229
+ }
32798
33230
 
32799
33231
  if (this.cropRect)
32800
33232
  {
@@ -33560,11 +33992,11 @@ Object.defineProperty(Phaser.Sprite.prototype, "destroyPhase", {
33560
33992
  */
33561
33993
 
33562
33994
  /**
33563
- * @class Phaser.Image
33564
- *
33565
- * @classdesc Create a new `Image` object. An Image is a light-weight object you can use to display anything that doesn't need physics or animation.
33995
+ * An Image is a light-weight object you can use to display anything that doesn't need physics or animation.
33566
33996
  * It can still rotate, scale, crop and receive input events. This makes it perfect for logos, backgrounds, simple buttons and other non-Sprite graphics.
33567
33997
  *
33998
+ * @class Phaser.Image
33999
+ * @extends PIXI.Sprite
33568
34000
  * @constructor
33569
34001
  * @param {Phaser.Game} game - A reference to the currently running game.
33570
34002
  * @param {number} x - The x coordinate of the Image. The coordinate is relative to any parent container this Image may be in.
@@ -33816,7 +34248,13 @@ Phaser.Image.prototype.loadTexture = function (key, frame) {
33816
34248
  }
33817
34249
  else if (key instanceof Phaser.BitmapData)
33818
34250
  {
34251
+ // This works from a reference, which probably isn't what we need here
33819
34252
  this.setTexture(key.texture);
34253
+
34254
+ if (this.game.cache.getFrameData(key.key, Phaser.Cache.BITMAPDATA))
34255
+ {
34256
+ setFrame = !this.animations.loadFrameData(this.game.cache.getFrameData(key.key, Phaser.Cache.BITMAPDATA), frame);
34257
+ }
33820
34258
  }
33821
34259
  else if (key instanceof PIXI.Texture)
33822
34260
  {
@@ -33896,6 +34334,10 @@ Phaser.Image.prototype.setFrame = function(frame) {
33896
34334
  this.texture.frame.width = frame.sourceSizeW;
33897
34335
  this.texture.frame.height = frame.sourceSizeH;
33898
34336
  }
34337
+ else if (!frame.trimmed && this.texture.trim)
34338
+ {
34339
+ this.texture.trim = null;
34340
+ }
33899
34341
 
33900
34342
  if (this.cropRect)
33901
34343
  {
@@ -34491,6 +34933,7 @@ Object.defineProperty(Phaser.Image.prototype, "destroyPhase", {
34491
34933
  *
34492
34934
  * @class Phaser.TileSprite
34493
34935
  * @constructor
34936
+ * @extends Pixi.TilingSprite
34494
34937
  * @param {Phaser.Game} game - A reference to the currently running game.
34495
34938
  * @param {number} x - The x coordinate (in world space) to position the TileSprite at.
34496
34939
  * @param {number} y - The y coordinate (in world space) to position the TileSprite at.
@@ -34899,6 +35342,10 @@ Phaser.TileSprite.prototype.setFrame = function(frame) {
34899
35342
  this.texture.frame.width = frame.sourceSizeW;
34900
35343
  this.texture.frame.height = frame.sourceSizeH;
34901
35344
  }
35345
+ else if (!frame.trimmed && this.texture.trim)
35346
+ {
35347
+ this.texture.trim = null;
35348
+ }
34902
35349
 
34903
35350
  if (this.game.renderType === Phaser.WEBGL)
34904
35351
  {
@@ -35297,6 +35744,7 @@ Object.defineProperty(Phaser.TileSprite.prototype, "destroyPhase", {
35297
35744
  *
35298
35745
  * @class Phaser.Rope
35299
35746
  * @constructor
35747
+ * @extends Pixi.Rope
35300
35748
  * @param {Phaser.Game} game - A reference to the currently running game.
35301
35749
  * @param {number} x - The x coordinate (in world space) to position the Rope at.
35302
35750
  * @param {number} y - The y coordinate (in world space) to position the Rope at.
@@ -35674,6 +36122,10 @@ Phaser.Rope.prototype.setFrame = function(frame) {
35674
36122
  this.texture.frame.width = frame.sourceSizeW;
35675
36123
  this.texture.frame.height = frame.sourceSizeH;
35676
36124
  }
36125
+ else if (!frame.trimmed && this.texture.trim)
36126
+ {
36127
+ this.texture.trim = null;
36128
+ }
35677
36129
 
35678
36130
  if (this.game.renderType === Phaser.WEBGL)
35679
36131
  {
@@ -36212,6 +36664,12 @@ Phaser.Text = function (game, x, y, text, style) {
36212
36664
  */
36213
36665
  this._lineSpacing = 0;
36214
36666
 
36667
+ /**
36668
+ * @property {number} _charCount - Internal character counter used by the text coloring.
36669
+ * @private
36670
+ */
36671
+ this._charCount = 0;
36672
+
36215
36673
  /**
36216
36674
  * @property {Phaser.Events} events - The Events you can subscribe to that are dispatched when certain things happen on this Sprite or its components.
36217
36675
  */
@@ -36227,6 +36685,11 @@ Phaser.Text = function (game, x, y, text, style) {
36227
36685
  */
36228
36686
  this.cameraOffset = new Phaser.Point();
36229
36687
 
36688
+ /**
36689
+ * @property {array} colors - An array of the color values as specified by `Text.addColor`.
36690
+ */
36691
+ this.colors = [];
36692
+
36230
36693
  this.setStyle(style);
36231
36694
 
36232
36695
  PIXI.Text.call(this, text, this.style);
@@ -36418,14 +36881,14 @@ Phaser.Text.prototype.setShadow = function (x, y, color, blur) {
36418
36881
  * Set the style of the text by passing a single style object to it.
36419
36882
  *
36420
36883
  * @method Phaser.Text.prototype.setStyle
36421
- * @param [style] {Object} The style parameters
36422
- * @param [style.font='bold 20pt Arial'] {String} The style and size of the font
36423
- * @param [style.fill='black'] {Object} A canvas fillstyle that will be used on the text eg 'red', '#00FF00'
36424
- * @param [style.align='left'] {String} Alignment for multiline text ('left', 'center' or 'right'), does not affect single line text
36425
- * @param [style.stroke='black'] {String} A canvas fillstyle that will be used on the text stroke eg 'blue', '#FCFF00'
36426
- * @param [style.strokeThickness=0] {Number} A number that represents the thickness of the stroke. Default is 0 (no stroke)
36427
- * @param [style.wordWrap=false] {Boolean} Indicates if word wrap should be used
36428
- * @param [style.wordWrapWidth=100] {Number} The width at which text will wrap
36884
+ * @param {Object} [style] - The style properties to be set on the Text.
36885
+ * @param {string} [style.font='bold 20pt Arial'] - The style and size of the font.
36886
+ * @param {string} [style.fill='black'] - A canvas fillstyle that will be used on the text eg 'red', '#00FF00'.
36887
+ * @param {string} [style.align='left'] - Alignment for multiline text ('left', 'center' or 'right'), does not affect single line text.
36888
+ * @param {string} [style.stroke='black'] - A canvas stroke style that will be used on the text stroke eg 'blue', '#FCFF00'.
36889
+ * @param {number} [style.strokeThickness=0] - A number that represents the thickness of the stroke. Default is 0 (no stroke).
36890
+ * @param {boolean} [style.wordWrap=false] - Indicates if word wrap should be used.
36891
+ * @param {number} [style.wordWrapWidth=100] - The width in pixels at which text will wrap.
36429
36892
  */
36430
36893
  Phaser.Text.prototype.setStyle = function (style) {
36431
36894
 
@@ -36508,6 +36971,8 @@ Phaser.Text.prototype.updateText = function () {
36508
36971
  this.context.lineCap = 'round';
36509
36972
  this.context.lineJoin = 'round';
36510
36973
 
36974
+ this._charCount = 0;
36975
+
36511
36976
  //draw lines line by line
36512
36977
  for (i = 0; i < lines.length; i++)
36513
36978
  {
@@ -36524,24 +36989,91 @@ Phaser.Text.prototype.updateText = function () {
36524
36989
 
36525
36990
  linePosition.y += this._lineSpacing;
36526
36991
 
36992
+ if (this.colors.length > 0)
36993
+ {
36994
+ this.updateLine(lines[i], linePosition.x, linePosition.y);
36995
+ }
36996
+ else
36997
+ {
36998
+ if (this.style.stroke && this.style.strokeThickness)
36999
+ {
37000
+ this.context.strokeText(lines[i], linePosition.x, linePosition.y);
37001
+ }
37002
+
37003
+ if (this.style.fill)
37004
+ {
37005
+ this.context.fillText(lines[i], linePosition.x, linePosition.y);
37006
+ }
37007
+ }
37008
+ }
37009
+
37010
+ this.updateTexture();
37011
+ };
37012
+
37013
+ Phaser.Text.prototype.updateLine = function (line, x, y) {
37014
+
37015
+ for (var i = 0; i < line.length; i++)
37016
+ {
37017
+ var letter = line[i];
37018
+
37019
+ if (this.colors[this._charCount])
37020
+ {
37021
+ this.context.fillStyle = this.colors[this._charCount];
37022
+ this.context.strokeStyle = this.colors[this._charCount];
37023
+ }
37024
+
36527
37025
  if (this.style.stroke && this.style.strokeThickness)
36528
37026
  {
36529
- this.context.strokeText(lines[i], linePosition.x, linePosition.y);
37027
+ this.context.strokeText(letter, x, y);
36530
37028
  }
36531
37029
 
36532
37030
  if (this.style.fill)
36533
37031
  {
36534
- this.context.fillText(lines[i], linePosition.x, linePosition.y);
37032
+ this.context.fillText(letter, x, y);
36535
37033
  }
37034
+
37035
+ x += this.context.measureText(letter).width;
37036
+
37037
+ this._charCount++;
36536
37038
  }
36537
37039
 
36538
- this.updateTexture();
37040
+ };
37041
+
37042
+ /**
37043
+ * Clears any previously set color stops.
37044
+ *
37045
+ * @method Phaser.Text.prototype.clearColors
37046
+ */
37047
+ Phaser.Text.prototype.clearColors = function () {
37048
+
37049
+ this.colors = [];
37050
+ this.dirty = true;
37051
+
37052
+ };
37053
+
37054
+ /**
37055
+ * This method allows you to set specific colors within the Text.
37056
+ * It works by taking a color value, which is a typical HTML string such as `#ff0000` or `rgb(255,0,0)` and a position.
37057
+ * The position value is the index of the character in the Text string to start applying this color to.
37058
+ * Once set the color remains in use until either another color or the end of the string is encountered.
37059
+ * For example if the Text was `Photon Storm` and you did `Text.addColor('#ffff00', 6)` it would color in the word `Storm` in yellow.
37060
+ *
37061
+ * @method Phaser.Text.prototype.addColor
37062
+ * @param {string} color - A canvas fillstyle that will be used on the text eg `red`, `#00FF00`, `rgba()`.
37063
+ * @param {number} position - The index of the character in the string to start applying this color value from.
37064
+ */
37065
+ Phaser.Text.prototype.addColor = function (color, position) {
37066
+
37067
+ this.colors[position] = color;
37068
+ this.dirty = true;
37069
+
36539
37070
  };
36540
37071
 
36541
37072
  /**
36542
37073
  * Greedy wrapping algorithm that will wrap words as the line grows longer than its horizontal bounds.
36543
37074
  *
36544
37075
  * @method Phaser.Text.prototype.runWordWrap
37076
+ * @param {string} text - The text to perform word wrap detection against.
36545
37077
  * @private
36546
37078
  */
36547
37079
  Phaser.Text.prototype.runWordWrap = function (text) {
@@ -36622,7 +37154,11 @@ Object.defineProperty(Phaser.Text.prototype, 'text', {
36622
37154
  {
36623
37155
  this._text = value.toString() || ' ';
36624
37156
  this.dirty = true;
36625
- this.updateTransform();
37157
+
37158
+ if (this.parent)
37159
+ {
37160
+ this.updateTransform();
37161
+ }
36626
37162
  }
36627
37163
 
36628
37164
  }
@@ -36646,7 +37182,11 @@ Object.defineProperty(Phaser.Text.prototype, 'font', {
36646
37182
  this._font = value.trim();
36647
37183
  this.style.font = this._fontWeight + ' ' + this._fontSize + "px '" + this._font + "'";
36648
37184
  this.dirty = true;
36649
- this.updateTransform();
37185
+
37186
+ if (this.parent)
37187
+ {
37188
+ this.updateTransform();
37189
+ }
36650
37190
  }
36651
37191
 
36652
37192
  }
@@ -36672,7 +37212,11 @@ Object.defineProperty(Phaser.Text.prototype, 'fontSize', {
36672
37212
  this._fontSize = value;
36673
37213
  this.style.font = this._fontWeight + ' ' + this._fontSize + "px '" + this._font + "'";
36674
37214
  this.dirty = true;
36675
- this.updateTransform();
37215
+
37216
+ if (this.parent)
37217
+ {
37218
+ this.updateTransform();
37219
+ }
36676
37220
  }
36677
37221
 
36678
37222
  }
@@ -36696,7 +37240,11 @@ Object.defineProperty(Phaser.Text.prototype, 'fontWeight', {
36696
37240
  this._fontWeight = value;
36697
37241
  this.style.font = this._fontWeight + ' ' + this._fontSize + "px '" + this._font + "'";
36698
37242
  this.dirty = true;
36699
- this.updateTransform();
37243
+
37244
+ if (this.parent)
37245
+ {
37246
+ this.updateTransform();
37247
+ }
36700
37248
  }
36701
37249
 
36702
37250
  }
@@ -36851,7 +37399,11 @@ Object.defineProperty(Phaser.Text.prototype, 'lineSpacing', {
36851
37399
  {
36852
37400
  this._lineSpacing = parseFloat(value);
36853
37401
  this.dirty = true;
36854
- this.updateTransform();
37402
+
37403
+ if (this.parent)
37404
+ {
37405
+ this.updateTransform();
37406
+ }
36855
37407
  }
36856
37408
 
36857
37409
  }
@@ -37039,17 +37591,15 @@ Object.defineProperty(Phaser.Text.prototype, "destroyPhase", {
37039
37591
  */
37040
37592
 
37041
37593
  /**
37042
- * Creates a new BitmapText object.
37043
- *
37044
- * @class Phaser.BitmapText
37045
- *
37046
- * @classdesc BitmapText objects work by taking a texture file and an XML file that describes the font layout.
37594
+ * BitmapText objects work by taking a texture file and an XML file that describes the font layout.
37047
37595
  *
37048
37596
  * On Windows you can use the free app BMFont: http://www.angelcode.com/products/bmfont/
37049
37597
  * On OS X we recommend Glyph Designer: http://www.71squared.com/en/glyphdesigner
37050
37598
  * For Web there is the great Littera: http://kvazars.com/littera/
37051
37599
  *
37600
+ * @class Phaser.BitmapText
37052
37601
  * @constructor
37602
+ * @extends PIXI.BitmapText
37053
37603
  * @param {Phaser.Game} game - A reference to the currently running game.
37054
37604
  * @param {number} x - X position of the new bitmapText object.
37055
37605
  * @param {number} y - Y position of the new bitmapText object.
@@ -37525,9 +38075,7 @@ Object.defineProperty(Phaser.BitmapText.prototype, "destroyPhase", {
37525
38075
  */
37526
38076
 
37527
38077
  /**
37528
- * @class Phaser.Button
37529
- *
37530
- * @classdesc Create a new `Button` object. A Button is a special type of Sprite that is set-up to handle Pointer events automatically. The four states a Button responds to are:
38078
+ * Create a new `Button` object. A Button is a special type of Sprite that is set-up to handle Pointer events automatically. The four states a Button responds to are:
37531
38079
  *
37532
38080
  * * 'Over' - when the Pointer moves over the Button. This is also commonly known as 'hover'.
37533
38081
  * * 'Out' - when the Pointer that was previously over the Button moves out of it.
@@ -37536,9 +38084,9 @@ Object.defineProperty(Phaser.BitmapText.prototype, "destroyPhase", {
37536
38084
  *
37537
38085
  * You can set a unique texture frame and Sound for any of these states.
37538
38086
  *
38087
+ * @class Phaser.Button
37539
38088
  * @constructor
37540
38089
  * @extends Phaser.Image
37541
- *
37542
38090
  * @param {Phaser.Game} game Current game instance.
37543
38091
  * @param {number} [x=0] - X position of the Button.
37544
38092
  * @param {number} [y=0] - Y position of the Button.
@@ -38179,7 +38727,7 @@ Phaser.Button.prototype.setState = function (newState) {
38179
38727
  *
38180
38728
  * @class Phaser.Graphics
38181
38729
  * @constructor
38182
- *
38730
+ * @extends PIXI.Graphics
38183
38731
  * @param {Phaser.Game} game Current game instance.
38184
38732
  * @param {number} x - X position of the new graphics object.
38185
38733
  * @param {number} y - Y position of the new graphics object.
@@ -38567,6 +39115,7 @@ Object.defineProperty(Phaser.Graphics.prototype, "destroyPhase", {
38567
39115
  *
38568
39116
  * @class Phaser.RenderTexture
38569
39117
  * @constructor
39118
+ * @extends PIXI.RenderTexture
38570
39119
  * @param {Phaser.Game} game - Current game instance.
38571
39120
  * @param {string} key - Internal Phaser reference key for the render texture.
38572
39121
  * @param {number} [width=100] - The width of the render texture.
@@ -38650,13 +39199,11 @@ Phaser.RenderTexture.prototype.renderXY = function (displayObject, x, y, clear)
38650
39199
  */
38651
39200
 
38652
39201
  /**
38653
- * Phaser SpriteBatch constructor.
38654
39202
  * The SpriteBatch class is a really fast version of the DisplayObjectContainer built purely for speed, so use when you need a lot of sprites or particles.
38655
39203
  * It's worth mentioning that by default sprite batches are used through-out the renderer, so you only really need to use a SpriteBatch if you have over
38656
39204
  * 1000 sprites that all share the same texture (or texture atlas). It's also useful if running in Canvas mode and you have a lot of un-rotated or un-scaled
38657
39205
  * Sprites as it skips all of the Canvas setTransform calls, which helps performance, especially on mobile devices.
38658
39206
  *
38659
- * @classdesc The SpriteBatch class is a really fast version of the DisplayObjectContainer built solely for speed, so use when you need a lot of sprites or particles.
38660
39207
  * @class Phaser.SpriteBatch
38661
39208
  * @extends Phaser.Group
38662
39209
  * @constructor
@@ -38692,6 +39239,9 @@ Phaser.SpriteBatch.prototype.constructor = Phaser.SpriteBatch;
38692
39239
  */
38693
39240
 
38694
39241
  /**
39242
+ * A Retro Font is similar to a BitmapFont, in that it uses a texture to render the text. However unlike a BitmapFont every character in a RetroFont
39243
+ * is the same size. This makes it similar to a sprite sheet. You typically find font sheets like this from old 8/16-bit games and demos.
39244
+ *
38695
39245
  * @class Phaser.RetroFont
38696
39246
  * @extends Phaser.RenderTexture
38697
39247
  * @constructor
@@ -39307,10 +39857,9 @@ Object.defineProperty(Phaser.RetroFont.prototype, "smoothed", {
39307
39857
  */
39308
39858
 
39309
39859
  /**
39860
+ * Create a new `Particle` object. Particles are extended Sprites that are emitted by a particle emitter such as Phaser.Particles.Arcade.Emitter.
39861
+ *
39310
39862
  * @class Phaser.Particle
39311
- *
39312
- * @classdesc Create a new `Particle` object. Particles are extended Sprites that are emitted by a particle emitter such as Phaser.Particles.Arcade.Emitter.
39313
- *
39314
39863
  * @constructor
39315
39864
  * @extends Phaser.Sprite
39316
39865
  * @param {Phaser.Game} game - A reference to the currently running game.
@@ -39813,7 +40362,6 @@ Phaser.Canvas = {
39813
40362
  * @class Phaser.Device
39814
40363
  * @constructor
39815
40364
  */
39816
-
39817
40365
  Phaser.Device = function (game) {
39818
40366
 
39819
40367
  /**
@@ -41820,7 +42368,7 @@ Phaser.Math = {
41820
42368
  *
41821
42369
  * @method Phaser.Math#wrapAngle
41822
42370
  * @param {number} angle - The angle value to check
41823
- * @param {boolean} radians - True if angle is given in radians.
42371
+ * @param {boolean} radians - Set to `true` if the angle is given in radians, otherwise degrees is expected.
41824
42372
  * @return {number} The new angle value, returns the same as the input angle if it was within bounds.
41825
42373
  */
41826
42374
  wrapAngle: function (angle, radians) {
@@ -42427,15 +42975,13 @@ Phaser.Math = {
42427
42975
  */
42428
42976
 
42429
42977
  /**
42430
- * Phaser.RandomDataGenerator constructor.
42431
- *
42432
- * @class Phaser.RandomDataGenerator
42433
- * @classdesc An extremely useful repeatable random data generator. Access it via Phaser.Game.rnd
42978
+ * An extremely useful repeatable random data generator.
42434
42979
  * Based on Nonsense by Josh Faul https://github.com/jocafa/Nonsense.
42435
42980
  * Random number generator from http://baagoe.org/en/wiki/Better_random_numbers_for_javascript
42436
42981
  *
42982
+ * @class Phaser.RandomDataGenerator
42437
42983
  * @constructor
42438
- * @param {array} seeds
42984
+ * @param {array} [seeds] - An array of values to use as the seed.
42439
42985
  */
42440
42986
  Phaser.RandomDataGenerator = function (seeds) {
42441
42987
 
@@ -42715,55 +43261,18 @@ Phaser.RandomDataGenerator.prototype = {
42715
43261
  Phaser.RandomDataGenerator.prototype.constructor = Phaser.RandomDataGenerator;
42716
43262
 
42717
43263
  /**
43264
+ * @author Timo Hausmann
42718
43265
  * @author Richard Davey <rich@photonstorm.com>
42719
43266
  * @copyright 2014 Photon Storm Ltd.
42720
43267
  * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
42721
43268
  */
42722
43269
 
42723
43270
  /**
42724
- * Javascript QuadTree
42725
- * @version 1.0
42726
- * @author Timo Hausmann
42727
- *
42728
- * @version 1.3, March 11th 2014
42729
- * @author Richard Davey
42730
- * The original code was a conversion of the Java code posted to GameDevTuts. However I've tweaked
42731
- * it massively to add node indexing, removed lots of temp. var creation and significantly
42732
- * increased performance as a result.
42733
- *
43271
+ * A QuadTree implementation. The original code was a conversion of the Java code posted to GameDevTuts.
43272
+ * However I've tweaked it massively to add node indexing, removed lots of temp. var creation and significantly increased performance as a result.
42734
43273
  * Original version at https://github.com/timohausmann/quadtree-js/
42735
- */
42736
-
42737
- /**
42738
- * @copyright © 2012 Timo Hausmann
42739
- *
42740
- * Permission is hereby granted, free of charge, to any person obtaining
42741
- * a copy of this software and associated documentation files (the
42742
- * "Software"), to deal in the Software without restriction, including
42743
- * without limitation the rights to use, copy, modify, merge, publish,
42744
- * distribute, sublicense, and/or sell copies of the Software, and to
42745
- * permit persons to whom the Software is furnished to do so, subject to
42746
- * the following conditions:
42747
- *
42748
- * The above copyright notice and this permission notice shall be
42749
- * included in all copies or substantial portions of the Software.
42750
- *
42751
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
42752
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
42753
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
42754
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
42755
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
42756
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
42757
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
42758
- */
42759
-
42760
- /**
42761
- * QuadTree Constructor
42762
43274
  *
42763
43275
  * @class Phaser.QuadTree
42764
- * @classdesc A QuadTree implementation. The original code was a conversion of the Java code posted to GameDevTuts.
42765
- * However I've tweaked it massively to add node indexing, removed lots of temp. var creation and significantly increased performance as a result.
42766
- * Original version at https://github.com/timohausmann/quadtree-js/
42767
43276
  * @constructor
42768
43277
  * @param {number} x - The top left coordinate of the quadtree.
42769
43278
  * @param {number} y - The top left coordinate of the quadtree.
@@ -43068,6 +43577,42 @@ Phaser.QuadTree.prototype = {
43068
43577
 
43069
43578
  Phaser.QuadTree.prototype.constructor = Phaser.QuadTree;
43070
43579
 
43580
+ /**
43581
+ * Javascript QuadTree
43582
+ * @version 1.0
43583
+ *
43584
+ * @version 1.3, March 11th 2014
43585
+ * @author Richard Davey
43586
+ * The original code was a conversion of the Java code posted to GameDevTuts. However I've tweaked
43587
+ * it massively to add node indexing, removed lots of temp. var creation and significantly
43588
+ * increased performance as a result.
43589
+ *
43590
+ * Original version at https://github.com/timohausmann/quadtree-js/
43591
+ */
43592
+
43593
+ /**
43594
+ * @copyright © 2012 Timo Hausmann
43595
+ *
43596
+ * Permission is hereby granted, free of charge, to any person obtaining
43597
+ * a copy of this software and associated documentation files (the
43598
+ * "Software"), to deal in the Software without restriction, including
43599
+ * without limitation the rights to use, copy, modify, merge, publish,
43600
+ * distribute, sublicense, and/or sell copies of the Software, and to
43601
+ * permit persons to whom the Software is furnished to do so, subject to
43602
+ * the following conditions:
43603
+ *
43604
+ * The above copyright notice and this permission notice shall be
43605
+ * included in all copies or substantial portions of the Software.
43606
+ *
43607
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
43608
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
43609
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
43610
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
43611
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
43612
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
43613
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
43614
+ */
43615
+
43071
43616
  /**
43072
43617
  * @author Richard Davey <rich@photonstorm.com>
43073
43618
  * @copyright 2014 Photon Storm Ltd.
@@ -43242,10 +43787,6 @@ Phaser.Net.prototype.constructor = Phaser.Net;
43242
43787
  */
43243
43788
 
43244
43789
  /**
43245
- * Phaser - TweenManager
43246
- *
43247
- * @class Phaser.TweenManager
43248
- * @classdesc
43249
43790
  * Phaser.Game has a single instance of the TweenManager through which all Tween objects are created and updated.
43250
43791
  * Tweens are hooked into the game clock and pause system, adjusting based on the game state.
43251
43792
  *
@@ -43253,8 +43794,9 @@ Phaser.Net.prototype.constructor = Phaser.Net;
43253
43794
  * The difference being that tweens belong to a games instance of TweenManager, rather than to a global TWEEN object.
43254
43795
  * It also has callbacks swapped for Signals and a few issues patched with regard to properties and completion errors.
43255
43796
  * Please see https://github.com/sole/tween.js for a full list of contributors.
43797
+ *
43798
+ * @class Phaser.TweenManager
43256
43799
  * @constructor
43257
- *
43258
43800
  * @param {Phaser.Game} game - A reference to the currently running game.
43259
43801
  */
43260
43802
  Phaser.TweenManager = function (game) {
@@ -44851,10 +45393,10 @@ Phaser.Easing.Default = Phaser.Easing.Linear.None;
44851
45393
  */
44852
45394
 
44853
45395
  /**
44854
- * Time constructor.
45396
+ * This is the core internal game clock.
45397
+ * It manages the elapsed time and calculation of elapsed values, used for game object motion and tweens.
44855
45398
  *
44856
45399
  * @class Phaser.Time
44857
- * @classdesc This is the core internal game clock. It manages the elapsed time and calculation of elapsed values, used for game object motion and tweens.
44858
45400
  * @constructor
44859
45401
  * @param {Phaser.Game} game A reference to the currently running game.
44860
45402
  */
@@ -45257,7 +45799,6 @@ Phaser.Time.prototype.constructor = Phaser.Time;
45257
45799
  * So if you want to fire an event every quarter of a second you'd need to set the delay to 250.
45258
45800
  *
45259
45801
  * @class Phaser.Timer
45260
- * @classdesc A Timer is a way to create small re-usable or disposable objects that do nothing but wait for a specific moment in time, and then dispatch an event.
45261
45802
  * @constructor
45262
45803
  * @param {Phaser.Game} game A reference to the currently running game.
45263
45804
  * @param {boolean} [autoDestroy=true] - A Timer that is set to automatically destroy itself will do so after all of its events have been dispatched (assuming no looping events).
@@ -45417,7 +45958,7 @@ Phaser.Timer.prototype = {
45417
45958
  * Creates a new TimerEvent on this Timer. Use the methods add, repeat or loop instead of this.
45418
45959
  * @method Phaser.Timer#create
45419
45960
  * @private
45420
- * @param {number} delay - The number of milliseconds that should elapse before the Timer will call the given callback.
45961
+ * @param {number} delay - The number of milliseconds that should elapse before the Timer will call the given callback. This value should be an integer, not a float. Math.round() is applied to it by this method.
45421
45962
  * @param {boolean} loop - Should the event loop or not?
45422
45963
  * @param {number} repeatCount - The number of times the event will repeat.
45423
45964
  * @param {function} callback - The callback that will be called when the Timer event occurs.
@@ -45427,6 +45968,8 @@ Phaser.Timer.prototype = {
45427
45968
  */
45428
45969
  create: function (delay, loop, repeatCount, callback, callbackContext, args) {
45429
45970
 
45971
+ delay = Math.round(delay);
45972
+
45430
45973
  var tick = delay;
45431
45974
 
45432
45975
  if (this._now === 0)
@@ -45975,11 +46518,11 @@ Phaser.Timer.prototype.constructor = Phaser.Timer;
45975
46518
  */
45976
46519
 
45977
46520
  /**
45978
- * A TimerEvent is a single event that is processed by a Phaser.Timer. It consists of a delay, which is a value in milliseconds after which the event will fire.
46521
+ * A TimerEvent is a single event that is processed by a Phaser.Timer.
46522
+ * It consists of a delay, which is a value in milliseconds after which the event will fire.
45979
46523
  * It can call a specific callback, passing in optional parameters.
45980
46524
  *
45981
46525
  * @class Phaser.TimerEvent
45982
- * @classdesc A TimerEvent is a single event that is processed by a Phaser.Timer. It consists of a delay, which is a value in milliseconds after which the event will fire.
45983
46526
  * @constructor
45984
46527
  * @param {Phaser.Timer} timer - The Timer object that this TimerEvent belongs to.
45985
46528
  * @param {number} delay - The delay in ms at which this TimerEvent fires.
@@ -46127,6 +46670,11 @@ Phaser.AnimationManager.prototype = {
46127
46670
  */
46128
46671
  loadFrameData: function (frameData, frame) {
46129
46672
 
46673
+ if (typeof frameData === 'undefined')
46674
+ {
46675
+ return false;
46676
+ }
46677
+
46130
46678
  if (this.isLoaded)
46131
46679
  {
46132
46680
  // We need to update the frameData that the animations are using
@@ -46541,6 +47089,23 @@ Object.defineProperty(Phaser.AnimationManager.prototype, 'paused', {
46541
47089
 
46542
47090
  });
46543
47091
 
47092
+ /**
47093
+ * @name Phaser.AnimationManager#name
47094
+ * @property {string} name - Gets the current animation name, if set.
47095
+ */
47096
+ Object.defineProperty(Phaser.AnimationManager.prototype, 'name', {
47097
+
47098
+ get: function () {
47099
+
47100
+ if (this.currentAnim)
47101
+ {
47102
+ return this.currentAnim.name;
47103
+ }
47104
+
47105
+ }
47106
+
47107
+ });
47108
+
46544
47109
  /**
46545
47110
  * @name Phaser.AnimationManager#frame
46546
47111
  * @property {number} frame - Gets or sets the current frame index and updates the Texture Cache for display.
@@ -46638,7 +47203,7 @@ Object.defineProperty(Phaser.AnimationManager.prototype, 'frameName', {
46638
47203
  * @param {Phaser.Sprite} parent - A reference to the owner of this Animation.
46639
47204
  * @param {string} name - The unique name for this animation, used in playback commands.
46640
47205
  * @param {Phaser.FrameData} frameData - The FrameData object that contains all frames used by this Animation.
46641
- * @param {(Array.<number>|Array.<string>)} frames - An array of numbers or strings indicating which frames to play in which order.
47206
+ * @param {number[]|string[]} frames - An array of numbers or strings indicating which frames to play in which order.
46642
47207
  * @param {number} delay - The time between each frame of the animation, given in ms.
46643
47208
  * @param {boolean} loop - Should this animation loop when it reaches the end or play through once.
46644
47209
  */
@@ -47356,6 +47921,7 @@ Object.defineProperty(Phaser.Animation.prototype, 'enableUpdate', {
47356
47921
  * You could use this function to generate those by doing: Phaser.Animation.generateFrameNames('explosion_', 1, 30, '-large', 4);
47357
47922
  *
47358
47923
  * @method Phaser.Animation.generateFrameNames
47924
+ * @static
47359
47925
  * @param {string} prefix - The start of the filename. If the filename was 'explosion_0001-large' the prefix would be 'explosion_'.
47360
47926
  * @param {number} start - The number to start sequentially counting from. If your frames are named 'explosion_0001' to 'explosion_0034' the start is 1.
47361
47927
  * @param {number} stop - The number to count to. If your frames are named 'explosion_0001' to 'explosion_0034' the stop value is 34.
@@ -48164,22 +48730,22 @@ Phaser.AnimationParser = {
48164
48730
  uuid = game.rnd.uuid();
48165
48731
 
48166
48732
  frame = frames[i].attributes;
48167
-
48168
- name = frame.name.nodeValue;
48169
- x = parseInt(frame.x.nodeValue, 10);
48170
- y = parseInt(frame.y.nodeValue, 10);
48171
- width = parseInt(frame.width.nodeValue, 10);
48172
- height = parseInt(frame.height.nodeValue, 10);
48733
+
48734
+ name = frame.name.value;
48735
+ x = parseInt(frame.x.value, 10);
48736
+ y = parseInt(frame.y.value, 10);
48737
+ width = parseInt(frame.width.value, 10);
48738
+ height = parseInt(frame.height.value, 10);
48173
48739
 
48174
48740
  frameX = null;
48175
48741
  frameY = null;
48176
48742
 
48177
48743
  if (frame.frameX)
48178
48744
  {
48179
- frameX = Math.abs(parseInt(frame.frameX.nodeValue, 10));
48180
- frameY = Math.abs(parseInt(frame.frameY.nodeValue, 10));
48181
- frameWidth = parseInt(frame.frameWidth.nodeValue, 10);
48182
- frameHeight = parseInt(frame.frameHeight.nodeValue, 10);
48745
+ frameX = Math.abs(parseInt(frame.frameX.value, 10));
48746
+ frameY = Math.abs(parseInt(frame.frameY.value, 10));
48747
+ frameWidth = parseInt(frame.frameWidth.value, 10);
48748
+ frameHeight = parseInt(frame.frameHeight.value, 10);
48183
48749
  }
48184
48750
 
48185
48751
  newFrame = data.addFrame(new Phaser.Frame(i, x, y, width, height, name, uuid));
@@ -48210,10 +48776,10 @@ Phaser.AnimationParser = {
48210
48776
  */
48211
48777
 
48212
48778
  /**
48213
- * Phaser.Cache constructor.
48779
+ * A game only has one instance of a Cache and it is used to store all externally loaded assets such as images, sounds
48780
+ * and data files as a result of Loader calls. Cached items use string based keys for look-up.
48214
48781
  *
48215
48782
  * @class Phaser.Cache
48216
- * @classdesc A game only has one instance of a Cache and it is used to store all externally loaded assets such as images, sounds and data files as a result of Loader calls. Cached items use string based keys for look-up.
48217
48783
  * @constructor
48218
48784
  * @param {Phaser.Game} game - A reference to the currently running game.
48219
48785
  */
@@ -48225,7 +48791,7 @@ Phaser.Cache = function (game) {
48225
48791
  this.game = game;
48226
48792
 
48227
48793
  /**
48228
- * @property {object} game - Canvas key-value container.
48794
+ * @property {object} _canvases - Canvas key-value container.
48229
48795
  * @private
48230
48796
  */
48231
48797
  this._canvases = {};
@@ -48255,11 +48821,17 @@ Phaser.Cache = function (game) {
48255
48821
  this._text = {};
48256
48822
 
48257
48823
  /**
48258
- * @property {object} _text - Text key-value container.
48824
+ * @property {object} _json - JSOIN key-value container.
48259
48825
  * @private
48260
48826
  */
48261
48827
  this._json = {};
48262
48828
 
48829
+ /**
48830
+ * @property {object} _xml - XML key-value container.
48831
+ * @private
48832
+ */
48833
+ this._xml = {};
48834
+
48263
48835
  /**
48264
48836
  * @property {object} _physics - Physics data key-value container.
48265
48837
  * @private
@@ -48290,6 +48862,24 @@ Phaser.Cache = function (game) {
48290
48862
  */
48291
48863
  this._bitmapFont = {};
48292
48864
 
48865
+ /**
48866
+ * @property {object} _urlMap - Maps URLs to resources.
48867
+ * @private
48868
+ */
48869
+ this._urlMap = {};
48870
+
48871
+ /**
48872
+ * @property {Image} _urlResolver - Used to resolve URLs to the absolute path.
48873
+ * @private
48874
+ */
48875
+ this._urlResolver = new Image();
48876
+
48877
+ /**
48878
+ * @property {string} _urlTemp - Temporary variable to hold a resolved url.
48879
+ * @private
48880
+ */
48881
+ this._urlTemp = null;
48882
+
48293
48883
  this.addDefaultImage();
48294
48884
  this.addMissingImage();
48295
48885
 
@@ -48314,6 +48904,7 @@ Phaser.Cache = function (game) {
48314
48904
  this._cacheMap[Phaser.Cache.BITMAPDATA] = this._bitmapDatas;
48315
48905
  this._cacheMap[Phaser.Cache.BITMAPFONT] = this._bitmapFont;
48316
48906
  this._cacheMap[Phaser.Cache.JSON] = this._json;
48907
+ this._cacheMap[Phaser.Cache.XML] = this._xml;
48317
48908
 
48318
48909
  };
48319
48910
 
@@ -48383,6 +48974,12 @@ Phaser.Cache.BITMAPFONT = 10;
48383
48974
  */
48384
48975
  Phaser.Cache.JSON = 11;
48385
48976
 
48977
+ /**
48978
+ * @constant
48979
+ * @type {number}
48980
+ */
48981
+ Phaser.Cache.XML = 12;
48982
+
48386
48983
  Phaser.Cache.prototype = {
48387
48984
 
48388
48985
  /**
@@ -48418,11 +49015,14 @@ Phaser.Cache.prototype = {
48418
49015
  * @method Phaser.Cache#addBitmapData
48419
49016
  * @param {string} key - Asset key for this BitmapData.
48420
49017
  * @param {Phaser.BitmapData} bitmapData - The BitmapData object to be addded to the cache.
49018
+ * @param {Phaser.FrameData} [frameData] - Optional FrameData set associated with the given BitmapData.
48421
49019
  * @return {Phaser.BitmapData} The BitmapData object to be addded to the cache.
48422
49020
  */
48423
- addBitmapData: function (key, bitmapData) {
49021
+ addBitmapData: function (key, bitmapData, frameData) {
48424
49022
 
48425
- this._bitmapDatas[key] = bitmapData;
49023
+ bitmapData.key = key;
49024
+
49025
+ this._bitmapDatas[key] = { data: bitmapData, frameData: frameData };
48426
49026
 
48427
49027
  return bitmapData;
48428
49028
 
@@ -48465,6 +49065,8 @@ Phaser.Cache.prototype = {
48465
49065
 
48466
49066
  this._images[key].frameData = Phaser.AnimationParser.spriteSheet(this.game, key, frameWidth, frameHeight, frameMax, margin, spacing);
48467
49067
 
49068
+ this._urlMap[this._resolveUrl(url)] = this._images[key];
49069
+
48468
49070
  },
48469
49071
 
48470
49072
  /**
@@ -48480,6 +49082,8 @@ Phaser.Cache.prototype = {
48480
49082
 
48481
49083
  this._tilemaps[key] = { url: url, data: mapData, format: format };
48482
49084
 
49085
+ this._urlMap[this._resolveUrl(url)] = this._tilemaps[key];
49086
+
48483
49087
  },
48484
49088
 
48485
49089
  /**
@@ -48512,6 +49116,8 @@ Phaser.Cache.prototype = {
48512
49116
  this._images[key].frameData = Phaser.AnimationParser.XMLData(this.game, atlasData, key);
48513
49117
  }
48514
49118
 
49119
+ this._urlMap[this._resolveUrl(url)] = this._images[key];
49120
+
48515
49121
  },
48516
49122
 
48517
49123
  /**
@@ -48536,6 +49142,8 @@ Phaser.Cache.prototype = {
48536
49142
 
48537
49143
  this._bitmapFont[key] = PIXI.BitmapText.fonts[key];
48538
49144
 
49145
+ this._urlMap[this._resolveUrl(url)] = this._bitmapFont[key];
49146
+
48539
49147
  },
48540
49148
 
48541
49149
  /**
@@ -48551,6 +49159,8 @@ Phaser.Cache.prototype = {
48551
49159
 
48552
49160
  this._physics[key] = { url: url, data: JSONData, format: format };
48553
49161
 
49162
+ this._urlMap[this._resolveUrl(url)] = this._physics[key];
49163
+
48554
49164
  },
48555
49165
 
48556
49166
  /**
@@ -48607,20 +49217,38 @@ Phaser.Cache.prototype = {
48607
49217
 
48608
49218
  this._text[key] = { url: url, data: data };
48609
49219
 
49220
+ this._urlMap[this._resolveUrl(url)] = this._text[key];
49221
+
48610
49222
  },
48611
49223
 
48612
49224
  /**
48613
49225
  * Add a new json object into the cache.
48614
49226
  *
48615
49227
  * @method Phaser.Cache#addJSON
48616
- * @param {string} key - Asset key for the text data.
48617
- * @param {string} url - URL of this text data file.
48618
- * @param {object} data - Extra text data.
49228
+ * @param {string} key - Asset key for the json data.
49229
+ * @param {string} url - URL of this json data file.
49230
+ * @param {object} data - Extra json data.
48619
49231
  */
48620
49232
  addJSON: function (key, url, data) {
48621
49233
 
48622
49234
  this._json[key] = { url: url, data: data };
48623
49235
 
49236
+ this._urlMap[this._resolveUrl(url)] = this._json[key];
49237
+
49238
+ },
49239
+
49240
+ /**
49241
+ * Add a new xml object into the cache.
49242
+ *
49243
+ * @method Phaser.Cache#addXML
49244
+ * @param {string} key - Asset key for the xml file.
49245
+ * @param {string} url - URL of this xml file.
49246
+ * @param {object} data - Extra text data.
49247
+ */
49248
+ addXML: function (key, url, data) {
49249
+
49250
+ this._xml[key] = { url: url, data: data };
49251
+
48624
49252
  },
48625
49253
 
48626
49254
  /**
@@ -48642,6 +49270,8 @@ Phaser.Cache.prototype = {
48642
49270
  PIXI.BaseTextureCache[key] = new PIXI.BaseTexture(data);
48643
49271
  PIXI.TextureCache[key] = new PIXI.Texture(PIXI.BaseTextureCache[key]);
48644
49272
 
49273
+ this._urlMap[this._resolveUrl(url)] = this._images[key];
49274
+
48645
49275
  },
48646
49276
 
48647
49277
  /**
@@ -48668,6 +49298,8 @@ Phaser.Cache.prototype = {
48668
49298
 
48669
49299
  this._sounds[key] = { url: url, data: data, isDecoding: false, decoded: decoded, webAudio: webAudio, audioTag: audioTag, locked: this.game.sound.touchLocked };
48670
49300
 
49301
+ this._urlMap[this._resolveUrl(url)] = this._sounds[key];
49302
+
48671
49303
  },
48672
49304
 
48673
49305
  /**
@@ -48769,7 +49401,7 @@ Phaser.Cache.prototype = {
48769
49401
 
48770
49402
  if (this._bitmapDatas[key])
48771
49403
  {
48772
- return this._bitmapDatas[key];
49404
+ return this._bitmapDatas[key].data;
48773
49405
  }
48774
49406
  else
48775
49407
  {
@@ -48842,7 +49474,7 @@ Phaser.Cache.prototype = {
48842
49474
  }
48843
49475
 
48844
49476
  }
48845
-
49477
+
48846
49478
  // We did not find the requested fixture
48847
49479
  console.warn('Phaser.Cache.getPhysicsData: Could not find given fixtureKey: "' + fixtureKey + ' in ' + key + '"');
48848
49480
  }
@@ -48884,7 +49516,7 @@ Phaser.Cache.prototype = {
48884
49516
  * Checks if the given key exists in the Canvas Cache.
48885
49517
  *
48886
49518
  * @method Phaser.Cache#checkCanvasKey
48887
- * @param {string} key - Asset key of the image to check is in the Cache.
49519
+ * @param {string} key - Asset key of the canvas to check is in the Cache.
48888
49520
  * @return {boolean} True if the key exists, otherwise false.
48889
49521
  */
48890
49522
  checkCanvasKey: function (key) {
@@ -48923,7 +49555,7 @@ Phaser.Cache.prototype = {
48923
49555
  * Checks if the given key exists in the Sound Cache.
48924
49556
  *
48925
49557
  * @method Phaser.Cache#checkSoundKey
48926
- * @param {string} key - Asset key of the image to check is in the Cache.
49558
+ * @param {string} key - Asset key of the sound file to check is in the Cache.
48927
49559
  * @return {boolean} True if the key exists, otherwise false.
48928
49560
  */
48929
49561
  checkSoundKey: function (key) {
@@ -48936,7 +49568,7 @@ Phaser.Cache.prototype = {
48936
49568
  * Checks if the given key exists in the Text Cache.
48937
49569
  *
48938
49570
  * @method Phaser.Cache#checkTextKey
48939
- * @param {string} key - Asset key of the image to check is in the Cache.
49571
+ * @param {string} key - Asset key of the text file to check is in the Cache.
48940
49572
  * @return {boolean} True if the key exists, otherwise false.
48941
49573
  */
48942
49574
  checkTextKey: function (key) {
@@ -48949,7 +49581,7 @@ Phaser.Cache.prototype = {
48949
49581
  * Checks if the given key exists in the Physics Cache.
48950
49582
  *
48951
49583
  * @method Phaser.Cache#checkPhysicsKey
48952
- * @param {string} key - Asset key of the image to check is in the Cache.
49584
+ * @param {string} key - Asset key of the physics data file to check is in the Cache.
48953
49585
  * @return {boolean} True if the key exists, otherwise false.
48954
49586
  */
48955
49587
  checkPhysicsKey: function (key) {
@@ -48962,7 +49594,7 @@ Phaser.Cache.prototype = {
48962
49594
  * Checks if the given key exists in the Tilemap Cache.
48963
49595
  *
48964
49596
  * @method Phaser.Cache#checkTilemapKey
48965
- * @param {string} key - Asset key of the image to check is in the Cache.
49597
+ * @param {string} key - Asset key of the Tilemap to check is in the Cache.
48966
49598
  * @return {boolean} True if the key exists, otherwise false.
48967
49599
  */
48968
49600
  checkTilemapKey: function (key) {
@@ -48975,7 +49607,7 @@ Phaser.Cache.prototype = {
48975
49607
  * Checks if the given key exists in the Binary Cache.
48976
49608
  *
48977
49609
  * @method Phaser.Cache#checkBinaryKey
48978
- * @param {string} key - Asset key of the image to check is in the Cache.
49610
+ * @param {string} key - Asset key of the binary file to check is in the Cache.
48979
49611
  * @return {boolean} True if the key exists, otherwise false.
48980
49612
  */
48981
49613
  checkBinaryKey: function (key) {
@@ -48988,7 +49620,7 @@ Phaser.Cache.prototype = {
48988
49620
  * Checks if the given key exists in the BitmapData Cache.
48989
49621
  *
48990
49622
  * @method Phaser.Cache#checkBitmapDataKey
48991
- * @param {string} key - Asset key of the image to check is in the Cache.
49623
+ * @param {string} key - Asset key of the BitmapData to check is in the Cache.
48992
49624
  * @return {boolean} True if the key exists, otherwise false.
48993
49625
  */
48994
49626
  checkBitmapDataKey: function (key) {
@@ -49001,7 +49633,7 @@ Phaser.Cache.prototype = {
49001
49633
  * Checks if the given key exists in the BitmapFont Cache.
49002
49634
  *
49003
49635
  * @method Phaser.Cache#checkBitmapFontKey
49004
- * @param {string} key - Asset key of the image to check is in the Cache.
49636
+ * @param {string} key - Asset key of the BitmapFont to check is in the Cache.
49005
49637
  * @return {boolean} True if the key exists, otherwise false.
49006
49638
  */
49007
49639
  checkBitmapFontKey: function (key) {
@@ -49014,7 +49646,7 @@ Phaser.Cache.prototype = {
49014
49646
  * Checks if the given key exists in the JSON Cache.
49015
49647
  *
49016
49648
  * @method Phaser.Cache#checkJSONKey
49017
- * @param {string} key - Asset key of the image to check is in the Cache.
49649
+ * @param {string} key - Asset key of the JSON file to check is in the Cache.
49018
49650
  * @return {boolean} True if the key exists, otherwise false.
49019
49651
  */
49020
49652
  checkJSONKey: function (key) {
@@ -49023,6 +49655,37 @@ Phaser.Cache.prototype = {
49023
49655
 
49024
49656
  },
49025
49657
 
49658
+ /**
49659
+ * Checks if the given key exists in the XML Cache.
49660
+ *
49661
+ * @method Phaser.Cache#checkXMLKey
49662
+ * @param {string} key - Asset key of the XML file to check is in the Cache.
49663
+ * @return {boolean} True if the key exists, otherwise false.
49664
+ */
49665
+ checkXMLKey: function (key) {
49666
+
49667
+ return this.checkKey(Phaser.Cache.XML, key);
49668
+
49669
+ },
49670
+
49671
+ /**
49672
+ * Checks if the given URL has been loaded into the Cache.
49673
+ *
49674
+ * @method Phaser.Cache#checkUrl
49675
+ * @param {string} url - The url to check for in the cache.
49676
+ * @return {boolean} True if the url exists, otherwise false.
49677
+ */
49678
+ checkUrl: function (url) {
49679
+
49680
+ if (this._urlMap[this._resolveUrl(url)])
49681
+ {
49682
+ return true;
49683
+ }
49684
+
49685
+ return false;
49686
+
49687
+ },
49688
+
49026
49689
  /**
49027
49690
  * Get image data by key.
49028
49691
  *
@@ -49069,13 +49732,16 @@ Phaser.Cache.prototype = {
49069
49732
  *
49070
49733
  * @method Phaser.Cache#getFrameData
49071
49734
  * @param {string} key - Asset key of the frame data to retrieve from the Cache.
49735
+ * @param {string} [map=Phaser.Cache.IMAGE] - The asset map to get the frameData from, for example `Phaser.Cache.IMAGE`.
49072
49736
  * @return {Phaser.FrameData} The frame data.
49073
49737
  */
49074
- getFrameData: function (key) {
49738
+ getFrameData: function (key, map) {
49075
49739
 
49076
- if (this._images[key])
49740
+ if (typeof map === 'undefined') { map = Phaser.Cache.IMAGE; }
49741
+
49742
+ if (this._cacheMap[map][key])
49077
49743
  {
49078
- return this._images[key].frameData;
49744
+ return this._cacheMap[map][key].frameData;
49079
49745
  }
49080
49746
 
49081
49747
  return null;
@@ -49312,6 +49978,26 @@ Phaser.Cache.prototype = {
49312
49978
 
49313
49979
  },
49314
49980
 
49981
+ /**
49982
+ * Get a XML object by key from the cache.
49983
+ *
49984
+ * @method Phaser.Cache#getXML
49985
+ * @param {string} key - Asset key of the XML object to retrieve from the Cache.
49986
+ * @return {object} The XML object.
49987
+ */
49988
+ getXML: function (key) {
49989
+
49990
+ if (this._xml[key])
49991
+ {
49992
+ return this._xml[key].data;
49993
+ }
49994
+ else
49995
+ {
49996
+ console.warn('Phaser.Cache.getXML: Invalid key: "' + key + '"');
49997
+ }
49998
+
49999
+ },
50000
+
49315
50001
  /**
49316
50002
  * Get binary data by key.
49317
50003
  *
@@ -49332,6 +50018,26 @@ Phaser.Cache.prototype = {
49332
50018
 
49333
50019
  },
49334
50020
 
50021
+ /**
50022
+ * Get a cached object by the URL.
50023
+ *
50024
+ * @method Phaser.Cache#getUrl
50025
+ * @param {string} url - The url for the object loaded to get from the cache.
50026
+ * @return {object} The cached object.
50027
+ */
50028
+ getUrl: function (url) {
50029
+
50030
+ if (this._urlMap[this._resolveUrl(url)])
50031
+ {
50032
+ return this._urlMap[this._resolveUrl(url)];
50033
+ }
50034
+ else
50035
+ {
50036
+ console.warn('Phaser.Cache.getUrl: Invalid url: "' + url + '"');
50037
+ }
50038
+
50039
+ },
50040
+
49335
50041
  /**
49336
50042
  * Gets all keys used by the Cache for the given data type.
49337
50043
  *
@@ -49388,6 +50094,10 @@ Phaser.Cache.prototype = {
49388
50094
  case Phaser.Cache.JSON:
49389
50095
  array = this._json;
49390
50096
  break;
50097
+
50098
+ case Phaser.Cache.XML:
50099
+ array = this._xml;
50100
+ break;
49391
50101
  }
49392
50102
 
49393
50103
  if (!array)
@@ -49420,13 +50130,23 @@ Phaser.Cache.prototype = {
49420
50130
  },
49421
50131
 
49422
50132
  /**
49423
- * Removes an image from the cache.
50133
+ * Removes an image from the cache and optionally from the Pixi.BaseTextureCache as well.
49424
50134
  *
49425
50135
  * @method Phaser.Cache#removeImage
49426
50136
  * @param {string} key - Key of the asset you want to remove.
50137
+ * @param {boolean} [removeFromPixi=true] - Should this image also be removed from the Pixi BaseTextureCache?
49427
50138
  */
49428
- removeImage: function (key) {
50139
+ removeImage: function (key, removeFromPixi) {
50140
+
50141
+ if (typeof removeFromPixi === 'undefined') { removeFromPixi = true; }
50142
+
49429
50143
  delete this._images[key];
50144
+
50145
+ if (removeFromPixi)
50146
+ {
50147
+ PIXI.BaseTextureCache[key].destroy();
50148
+ }
50149
+
49430
50150
  },
49431
50151
 
49432
50152
  /**
@@ -49459,6 +50179,16 @@ Phaser.Cache.prototype = {
49459
50179
  delete this._json[key];
49460
50180
  },
49461
50181
 
50182
+ /**
50183
+ * Removes a xml object from the cache.
50184
+ *
50185
+ * @method Phaser.Cache#removeXML
50186
+ * @param {string} key - Key of the asset you want to remove.
50187
+ */
50188
+ removeXML: function (key) {
50189
+ delete this._xml[key];
50190
+ },
50191
+
49462
50192
  /**
49463
50193
  * Removes a physics data file from the cache.
49464
50194
  *
@@ -49509,6 +50239,24 @@ Phaser.Cache.prototype = {
49509
50239
  delete this._bitmapFont[key];
49510
50240
  },
49511
50241
 
50242
+ /**
50243
+ * Resolves a url its absolute form.
50244
+ *
50245
+ * @method Phaser.Cache#_resolveUrl
50246
+ * @param {string} url - The url to resolve.
50247
+ * @private
50248
+ */
50249
+ _resolveUrl: function (url) {
50250
+ this._urlResolver.src = this.game.load.baseUrl + url;
50251
+
50252
+ this._urlTemp = this._urlResolver.src;
50253
+
50254
+ // ensure no request is actually made
50255
+ this._urlResolver.src = '';
50256
+
50257
+ return this._urlTemp;
50258
+ },
50259
+
49512
50260
  /**
49513
50261
  * Clears the cache. Removes every local cache object reference.
49514
50262
  *
@@ -49544,6 +50292,11 @@ Phaser.Cache.prototype = {
49544
50292
  delete this._json[item];
49545
50293
  }
49546
50294
 
50295
+ for (var item in this._xml)
50296
+ {
50297
+ delete this._xml[item];
50298
+ }
50299
+
49547
50300
  for (var item in this._textures)
49548
50301
  {
49549
50302
  delete this._textures[item];
@@ -49574,6 +50327,10 @@ Phaser.Cache.prototype = {
49574
50327
  delete this._bitmapFont[item];
49575
50328
  }
49576
50329
 
50330
+ this._urlMap = null;
50331
+ this._urlResolver = null;
50332
+ this._urlTemp = null;
50333
+
49577
50334
  }
49578
50335
 
49579
50336
  };
@@ -49588,12 +50345,10 @@ Phaser.Cache.prototype.constructor = Phaser.Cache;
49588
50345
  */
49589
50346
 
49590
50347
  /**
49591
- * Phaser loader constructor.
49592
50348
  * The Loader handles loading all external content such as Images, Sounds, Texture Atlases and data files.
49593
50349
  * It uses a combination of Image() loading and xhr and provides progress and completion callbacks.
50350
+ *
49594
50351
  * @class Phaser.Loader
49595
- * @classdesc The Loader handles loading all external content such as Images, Sounds, Texture Atlases and data files.
49596
- * It uses a combination of Image() loading and xhr and provides progress and completion callbacks.
49597
50352
  * @constructor
49598
50353
  * @param {Phaser.Game} game - A reference to the currently running game.
49599
50354
  */
@@ -49632,7 +50387,7 @@ Phaser.Loader = function (game) {
49632
50387
  * You can optionally link a sprite to the preloader.
49633
50388
  * If you do so the Sprites width or height will be cropped based on the percentage loaded.
49634
50389
  * This property is an object containing: sprite, rect, direction, width and height
49635
- *
50390
+ *
49636
50391
  * @property {object} preloadSprite
49637
50392
  */
49638
50393
  this.preloadSprite = null;
@@ -49678,10 +50433,10 @@ Phaser.Loader = function (game) {
49678
50433
  this.onLoadComplete = new Phaser.Signal();
49679
50434
 
49680
50435
  /**
49681
- * @property {Phaser.Signal} onPackComplete - This event is dispatched when an asset pack has either loaded or failed.
50436
+ * @property {Phaser.Signal} onPackComplete - This event is dispatched when an asset pack has either loaded or failed.
49682
50437
  */
49683
50438
  this.onPackComplete = new Phaser.Signal();
49684
-
50439
+
49685
50440
  /**
49686
50441
  * @property {boolean} useXDomainRequest - If true and if the browser supports XDomainRequest, it will be used in preference for xhr when loading json files. It is enabled automatically if the browser is IE9, but you can disable it as required.
49687
50442
  */
@@ -49799,7 +50554,7 @@ Phaser.Loader.prototype = {
49799
50554
  /**
49800
50555
  * Check whether asset exists with a specific key.
49801
50556
  * Use Phaser.Cache to access loaded assets, e.g. Phaser.Cache#checkImageKey
49802
- *
50557
+ *
49803
50558
  * @method Phaser.Loader#checkKeyExists
49804
50559
  * @param {string} type - The type asset you want to check.
49805
50560
  * @param {string} key - Key of the asset you want to check.
@@ -50083,6 +50838,32 @@ Phaser.Loader.prototype = {
50083
50838
 
50084
50839
  },
50085
50840
 
50841
+ /**
50842
+ * Add an XML file to the Loader.
50843
+ *
50844
+ * @method Phaser.Loader#xml
50845
+ * @param {string} key - Unique asset key of the xml file.
50846
+ * @param {string} url - URL of the xml file.
50847
+ * @param {boolean} [overwrite=false] - If an unloaded file with a matching key already exists in the queue, this entry will overwrite it.
50848
+ * @return {Phaser.Loader} This Loader instance.
50849
+ */
50850
+ xml: function (key, url, overwrite) {
50851
+
50852
+ if (typeof overwrite === "undefined") { overwrite = false; }
50853
+
50854
+ if (overwrite)
50855
+ {
50856
+ this.replaceInFileList('xml', key, url);
50857
+ }
50858
+ else
50859
+ {
50860
+ this.addToFileList('xml', key, url);
50861
+ }
50862
+
50863
+ return this;
50864
+
50865
+ },
50866
+
50086
50867
  /**
50087
50868
  * Add a JavaScript file to the Loader. Once loaded the JavaScript file will be automatically turned into a script tag (and executed), so be careful what you load!
50088
50869
  * You can also specify a callback. This will be executed as soon as the script tag has been created.
@@ -50172,6 +50953,26 @@ Phaser.Loader.prototype = {
50172
50953
 
50173
50954
  },
50174
50955
 
50956
+ /**
50957
+ * Add a new audiosprite file to the loader. Audio Sprites are a combination of audio files and a JSON configuration.
50958
+ * The JSON follows the format of that created by https://github.com/tonistiigi/audiosprite
50959
+ *
50960
+ * @method Phaser.Loader#audiosprite
50961
+ * @param {string} key - Unique asset key of the audio file.
50962
+ * @param {Array|string} urls - An array containing the URLs of the audio files, i.e.: [ 'audiosprite.mp3', 'audiosprite.ogg', 'audiosprite.m4a' ] or a single string containing just one URL.
50963
+ * @param {string} atlasURL - The URL of the audiosprite configuration json.
50964
+ * @return {Phaser.Loader} This Loader instance.
50965
+ */
50966
+ audiosprite: function(key, urls, atlasURL) {
50967
+
50968
+ this.audio(key, urls);
50969
+
50970
+ this.json(key + '-audioatlas', atlasURL);
50971
+
50972
+ return this;
50973
+
50974
+ },
50975
+
50175
50976
  /**
50176
50977
  * Add a new tilemap loading request.
50177
50978
  *
@@ -50558,7 +51359,7 @@ Phaser.Loader.prototype = {
50558
51359
  console.warn('Phaser.Loader loadPackList invalid index ' + this._packIndex);
50559
51360
  return;
50560
51361
  }
50561
-
51362
+
50562
51363
  var pack = this._packList[this._packIndex];
50563
51364
 
50564
51365
  if (pack.data !== null)
@@ -50626,6 +51427,10 @@ Phaser.Loader.prototype = {
50626
51427
  this.json(file.key, file.url, file.overwrite);
50627
51428
  break;
50628
51429
 
51430
+ case "xml":
51431
+ this.xml(file.key, file.url, file.overwrite);
51432
+ break;
51433
+
50629
51434
  case "script":
50630
51435
  this.script(file.key, file.url, file.callback, pack.callbackContext);
50631
51436
  break;
@@ -50733,11 +51538,11 @@ Phaser.Loader.prototype = {
50733
51538
  console.warn('Phaser.Loader loadFile invalid index ' + this._fileIndex);
50734
51539
  return;
50735
51540
  }
50736
-
51541
+
50737
51542
  var file = this._fileList[this._fileIndex];
50738
51543
  var _this = this;
50739
51544
 
50740
- this.onFileStart.dispatch(this.progress, file.key);
51545
+ this.onFileStart.dispatch(this.progress, file.key, file.url);
50741
51546
 
50742
51547
  // Image or Data?
50743
51548
  switch (file.type)
@@ -50791,7 +51596,7 @@ Phaser.Loader.prototype = {
50791
51596
  };
50792
51597
  file.data.preload = 'auto';
50793
51598
  file.data.src = this.baseURL + file.url;
50794
- file.data.addEventListener('canplaythrough', Phaser.GAMES[this.game.id].load.fileComplete(this._fileIndex), false);
51599
+ file.data.addEventListener('canplaythrough', function () { Phaser.GAMES[_this.game.id].load.fileComplete(_this._fileIndex); }, false);
50795
51600
  file.data.load();
50796
51601
  }
50797
51602
  }
@@ -50817,7 +51622,7 @@ Phaser.Loader.prototype = {
50817
51622
  this._ajax.onerror = function () {
50818
51623
  return _this.dataLoadError(_this._fileIndex);
50819
51624
  };
50820
-
51625
+
50821
51626
  this._ajax.ontimeout = function () {
50822
51627
  return _this.dataLoadError(_this._fileIndex);
50823
51628
  };
@@ -50830,7 +51635,7 @@ Phaser.Loader.prototype = {
50830
51635
 
50831
51636
  this._ajax.open('GET', this.baseURL + file.url, true);
50832
51637
 
50833
- // Note: The xdr.send() call is wrapped in a timeout to prevent an issue with the interface where some requests are lost
51638
+ // Note: The xdr.send() call is wrapped in a timeout to prevent an issue with the interface where some requests are lost
50834
51639
  // if multiple XDomainRequests are being sent at the same time.
50835
51640
  setTimeout(function () {
50836
51641
  this._ajax.send();
@@ -50843,6 +51648,11 @@ Phaser.Loader.prototype = {
50843
51648
 
50844
51649
  break;
50845
51650
 
51651
+ case 'xml':
51652
+
51653
+ this.xhrLoad(this._fileIndex, this.baseURL + file.url, 'text', 'xmlLoadComplete', 'dataLoadError');
51654
+ break;
51655
+
50846
51656
  case 'tilemap':
50847
51657
 
50848
51658
  if (file.format === Phaser.Tilemap.TILED_JSON)
@@ -50874,7 +51684,7 @@ Phaser.Loader.prototype = {
50874
51684
 
50875
51685
  /**
50876
51686
  * Starts the xhr loader.
50877
- *
51687
+ *
50878
51688
  * @method Phaser.Loader#xhrLoad
50879
51689
  * @private
50880
51690
  * @param {number} index - The index of the file to load from the file list.
@@ -50904,7 +51714,7 @@ Phaser.Loader.prototype = {
50904
51714
 
50905
51715
  /**
50906
51716
  * Private method ONLY used by loader.
50907
- *
51717
+ *
50908
51718
  * @method Phaser.Loader#getAudioURL
50909
51719
  * @private
50910
51720
  * @param {array|string} urls - Either an array of audio file URLs or a string containing a single URL path.
@@ -51193,6 +52003,12 @@ Phaser.Loader.prototype = {
51193
52003
  */
51194
52004
  xmlLoadComplete: function (index) {
51195
52005
 
52006
+ if (this._xhr.responseType !== '' && this._xhr.responseType !== 'text')
52007
+ {
52008
+ console.warn('Invalid XML Response Type', this._fileList[index]);
52009
+ console.warn(this._xhr);
52010
+ }
52011
+
51196
52012
  var data = this._xhr.responseText;
51197
52013
  var xml;
51198
52014
 
@@ -51223,14 +52039,18 @@ Phaser.Loader.prototype = {
51223
52039
  var file = this._fileList[index];
51224
52040
  file.loaded = true;
51225
52041
 
51226
- if (file.type == 'bitmapfont')
52042
+ if (file.type === 'bitmapfont')
51227
52043
  {
51228
52044
  this.game.cache.addBitmapFont(file.key, file.url, file.data, xml, file.xSpacing, file.ySpacing);
51229
52045
  }
51230
- else if (file.type == 'textureatlas')
52046
+ else if (file.type === 'textureatlas')
51231
52047
  {
51232
52048
  this.game.cache.addTextureAtlas(file.key, file.url, file.data, xml, file.format);
51233
52049
  }
52050
+ else if (file.type === 'xml')
52051
+ {
52052
+ this.game.cache.addXML(file.key, file.url, xml);
52053
+ }
51234
52054
 
51235
52055
  this.nextFile(index, true);
51236
52056
 
@@ -51452,6 +52272,144 @@ Phaser.LoaderParser = {
51452
52272
 
51453
52273
  };
51454
52274
 
52275
+ /**
52276
+ * @author Jeremy Dowell <jeremy@codevinsky.com>
52277
+ * @author Richard Davey <rich@photonstorm.com>
52278
+ * @copyright 2014 Photon Storm Ltd.
52279
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
52280
+ */
52281
+
52282
+ /**
52283
+ * Audio Sprites are a combination of audio files and a JSON configuration.
52284
+ * The JSON follows the format of that created by https://github.com/tonistiigi/audiosprite
52285
+ *
52286
+ * @class Phaser.AudioSprite
52287
+ * @constructor
52288
+ * @param {Phaser.Game} game - Reference to the current game instance.
52289
+ * @param {string} key - Asset key for the sound.
52290
+ */
52291
+ Phaser.AudioSprite = function (game, key) {
52292
+
52293
+ /**
52294
+ * A reference to the currently running Game.
52295
+ * @property {Phaser.Game} game
52296
+ */
52297
+ this.game = game;
52298
+
52299
+ /**
52300
+ * Asset key for the Audio Sprite.
52301
+ * @property {string} key
52302
+ */
52303
+ this.key = key;
52304
+
52305
+ /**
52306
+ * JSON audio atlas object.
52307
+ * @property {object} config
52308
+ */
52309
+ this.config = this.game.cache.getJSON(key + '-audioatlas');
52310
+
52311
+ /**
52312
+ * If a sound is set to auto play, this holds the marker key of it.
52313
+ * @property {string} autoplayKey
52314
+ */
52315
+ this.autoplayKey = null;
52316
+
52317
+ /**
52318
+ * Is a sound set to autoplay or not?
52319
+ * @property {boolean} autoplay
52320
+ * @default
52321
+ */
52322
+ this.autoplay = false;
52323
+
52324
+ /**
52325
+ * An object containing the Phaser.Sound objects for the Audio Sprite.
52326
+ * @property {object} sounds
52327
+ */
52328
+ this.sounds = {};
52329
+
52330
+ for (var k in this.config.spritemap)
52331
+ {
52332
+ var marker = this.config.spritemap[k];
52333
+ var sound = this.game.add.sound(this.key);
52334
+
52335
+ if (marker.loop)
52336
+ {
52337
+ sound.addMarker(k, marker.start, (marker.end - marker.start), null, true);
52338
+ }
52339
+ else
52340
+ {
52341
+ sound.addMarker(k, marker.start, (marker.end - marker.start), null, false);
52342
+ }
52343
+
52344
+ this.sounds[k] = sound;
52345
+ }
52346
+
52347
+ if (this.config.autoplay)
52348
+ {
52349
+ this.autoplayKey = this.config.autoplay;
52350
+ this.play(this.autoplayKey);
52351
+ this.autoplay = this.sounds[this.autoplayKey];
52352
+ }
52353
+
52354
+ };
52355
+
52356
+ Phaser.AudioSprite.prototype = {
52357
+
52358
+ /**
52359
+ * Play a sound with the given name.
52360
+ *
52361
+ * @method Phaser.AudioSprite#play
52362
+ * @param {string} [marker] - The name of sound to play
52363
+ * @param {number} [volume=1] - Volume of the sound you want to play. If none is given it will use the volume given to the Sound when it was created (which defaults to 1 if none was specified).
52364
+ * @return {Phaser.Sound} This sound instance.
52365
+ */
52366
+ play: function (marker, volume) {
52367
+
52368
+ if (typeof volume === 'undefined') { volume = 1; }
52369
+
52370
+ return this.sounds[marker].play(marker, null, volume);
52371
+
52372
+ },
52373
+
52374
+ /**
52375
+ * Stop a sound with the given name.
52376
+ *
52377
+ * @method Phaser.AudioSprite#stop
52378
+ * @param {string} [marker=''] - The name of sound to stop. If none is given it will stop all sounds in the audio sprite.
52379
+ */
52380
+ stop: function (marker) {
52381
+
52382
+ if (!marker)
52383
+ {
52384
+ for (var key in this.sounds)
52385
+ {
52386
+ this.sounds[key].stop();
52387
+ }
52388
+ }
52389
+ else
52390
+ {
52391
+ this.sounds[marker].stop();
52392
+ }
52393
+
52394
+ },
52395
+
52396
+ /**
52397
+ * Get a sound with the given name.
52398
+ *
52399
+ * @method Phaser.AudioSprite#get
52400
+ * @param {string} marker - The name of sound to get.
52401
+ * @return {Phaser.Sound} The sound instance.
52402
+ */
52403
+ get: function(marker) {
52404
+
52405
+ return this.sounds[marker];
52406
+
52407
+ }
52408
+
52409
+ };
52410
+
52411
+ Phaser.AudioSprite.prototype.constructor = Phaser.AudioSprite;
52412
+
51455
52413
  /**
51456
52414
  * @author Richard Davey <rich@photonstorm.com>
51457
52415
  * @copyright 2014 Photon Storm Ltd.
@@ -51462,7 +52420,6 @@ Phaser.LoaderParser = {
51462
52420
  * The Sound class constructor.
51463
52421
  *
51464
52422
  * @class Phaser.Sound
51465
- * @classdesc The Sound class
51466
52423
  * @constructor
51467
52424
  * @param {Phaser.Game} game - Reference to the current game instance.
51468
52425
  * @param {string} key - Asset key for the sound.
@@ -51592,6 +52549,12 @@ Phaser.Sound = function (game, key, volume, loop, connect) {
51592
52549
  */
51593
52550
  this.override = false;
51594
52551
 
52552
+ /**
52553
+ * @property {boolean} allowMultiple - This will allow you to have multiple instances of this Sound playing at once. This is only useful when running under Web Audio, and we recommend you implement a local pooling system to not flood the sound channels.
52554
+ * @default
52555
+ */
52556
+ this.allowMultiple = false;
52557
+
51595
52558
  /**
51596
52559
  * @property {boolean} usingWebAudio - true if this sound is being played with Web Audio.
51597
52560
  * @readonly
@@ -51697,6 +52660,11 @@ Phaser.Sound = function (game, key, volume, loop, connect) {
51697
52660
  */
51698
52661
  this.onMarkerComplete = new Phaser.Signal();
51699
52662
 
52663
+ /**
52664
+ * @property {Phaser.Signal} onFadeComplete - The onFadeComplete event is dispatched when this sound finishes fading either in or out.
52665
+ */
52666
+ this.onFadeComplete = new Phaser.Signal();
52667
+
51700
52668
  /**
51701
52669
  * @property {number} _volume - The global audio volume. A value between 0 (silence) and 1 (full volume).
51702
52670
  * @private
@@ -51894,13 +52862,13 @@ Phaser.Sound.prototype = {
51894
52862
  if (typeof marker === 'undefined') { marker = ''; }
51895
52863
  if (typeof forceRestart === 'undefined') { forceRestart = true; }
51896
52864
 
51897
- if (this.isPlaying && !forceRestart && !this.override)
52865
+ if (this.isPlaying && !this.allowMultiple && !forceRestart && !this.override)
51898
52866
  {
51899
52867
  // Use Restart instead
51900
52868
  return this;
51901
52869
  }
51902
52870
 
51903
- if (this.isPlaying && (this.override || forceRestart))
52871
+ if (this.isPlaying && !this.allowMultiple && (this.override || forceRestart))
51904
52872
  {
51905
52873
  if (this.usingWebAudio)
51906
52874
  {
@@ -52230,6 +53198,74 @@ Phaser.Sound.prototype = {
52230
53198
 
52231
53199
  },
52232
53200
 
53201
+ /**
53202
+ * Starts this sound playing (or restarts it if already doing so) and sets the volume to zero.
53203
+ * Then increases the volume from 0 to 1 over the duration specified.
53204
+ * At the end of the fade Sound.onFadeComplete is dispatched with this Sound object as the first parameter,
53205
+ * and the final volume (1) as the second parameter.
53206
+ *
53207
+ * @method Phaser.Sound#fadeIn
53208
+ * @param {number} [duration=1000] - The time in milliseconds during which the Sound should fade in.
53209
+ * @param {boolean} [loop=false] - Should the Sound be set to loop? Note that this doesn't cause the fade to repeat.
53210
+ */
53211
+ fadeIn: function (duration, loop) {
53212
+
53213
+ if (typeof duration === 'undefined') { duration = 1000; }
53214
+ if (typeof loop === 'undefined') { loop = false; }
53215
+
53216
+ if (this.paused)
53217
+ {
53218
+ return;
53219
+ }
53220
+
53221
+ this.play('', 0, 0, loop);
53222
+
53223
+ var tween = this.game.add.tween(this).to( { volume: 1 }, duration, Phaser.Easing.Linear.None, true);
53224
+
53225
+ tween.onComplete.add(this.fadeComplete, this);
53226
+
53227
+ },
53228
+
53229
+ /**
53230
+ * Decreases the volume of this Sound from its current value to 0 over the duration specified.
53231
+ * At the end of the fade Sound.onFadeComplete is dispatched with this Sound object as the first parameter,
53232
+ * and the final volume (0) as the second parameter.
53233
+ *
53234
+ * @method Phaser.Sound#fadeOut
53235
+ * @param {number} [duration=1000] - The time in milliseconds during which the Sound should fade out.
53236
+ */
53237
+ fadeOut: function (duration) {
53238
+
53239
+ if (typeof duration === 'undefined') { duration = 1000; }
53240
+
53241
+ if (!this.isPlaying || this.paused || this.volume <= 0)
53242
+ {
53243
+ return;
53244
+ }
53245
+
53246
+ var tween = this.game.add.tween(this).to( { volume: 0 }, duration, Phaser.Easing.Linear.None, true);
53247
+
53248
+ tween.onComplete.add(this.fadeComplete, this);
53249
+
53250
+ },
53251
+
53252
+ /**
53253
+ * Internal handler for Sound.fadeIn and Sound.fadeOut.
53254
+ *
53255
+ * @method Phaser.Sound#fadeComplete
53256
+ * @private
53257
+ */
53258
+ fadeComplete: function () {
53259
+
53260
+ this.onFadeComplete.dispatch(this, this.volume);
53261
+
53262
+ if (this.volume === 0)
53263
+ {
53264
+ this.stop();
53265
+ }
53266
+
53267
+ },
53268
+
52233
53269
  /**
52234
53270
  * Destroys this sound and all associated events and removes it from the SoundManager.
52235
53271
  *
@@ -52384,14 +53420,12 @@ Object.defineProperty(Phaser.Sound.prototype, "volume", {
52384
53420
  */
52385
53421
 
52386
53422
  /**
52387
- * Sound Manager constructor.
52388
53423
  * The Sound Manager is responsible for playing back audio via either the Legacy HTML Audio tag or via Web Audio if the browser supports it.
52389
53424
  * Note: On Firefox 25+ on Linux if you have media.gstreamer disabled in about:config then it cannot play back mp3 or m4a files.
52390
53425
  * The audio file type and the encoding of those files are extremely important. Not all browsers can play all audio formats.
52391
53426
  * There is a good guide to what's supported here: http://hpr.dogphilosophy.net/test/
52392
53427
  *
52393
53428
  * @class Phaser.SoundManager
52394
- * @classdesc Phaser Sound Manager.
52395
53429
  * @constructor
52396
53430
  * @param {Phaser.Game} game reference to the current game instance.
52397
53431
  */
@@ -52747,6 +53781,21 @@ Phaser.SoundManager.prototype = {
52747
53781
 
52748
53782
  },
52749
53783
 
53784
+ /**
53785
+ * Adds a new AudioSprite into the SoundManager.
53786
+ *
53787
+ * @method Phaser.SoundManager#addSprite
53788
+ * @param {string} key - Asset key for the sound.
53789
+ * @return {Phaser.AudioSprite} The new AudioSprite instance.
53790
+ */
53791
+ addSprite: function(key) {
53792
+
53793
+ var audioSprite = new Phaser.AudioSprite(this.game, key);
53794
+
53795
+ return audioSprite;
53796
+
53797
+ },
53798
+
52750
53799
  /**
52751
53800
  * Removes a Sound from the SoundManager. The removed Sound is destroyed before removal.
52752
53801
  *
@@ -53732,18 +54781,22 @@ Phaser.Utils.Debug.prototype = {
53732
54781
 
53733
54782
  if (sprite.body)
53734
54783
  {
54784
+ this.start();
54785
+
53735
54786
  if (sprite.body.type === Phaser.Physics.ARCADE)
53736
54787
  {
53737
- this.start();
53738
54788
  Phaser.Physics.Arcade.Body.render(this.context, sprite.body, color, filled);
53739
- this.stop();
53740
54789
  }
53741
54790
  else if (sprite.body.type === Phaser.Physics.NINJA)
53742
54791
  {
53743
- this.start();
53744
54792
  Phaser.Physics.Ninja.Body.render(this.context, sprite.body, color, filled);
53745
- this.stop();
53746
54793
  }
54794
+ else if (sprite.body.type === Phaser.Physics.BOX2D)
54795
+ {
54796
+ Phaser.Physics.Box2D.renderBody(this.context, sprite.body, color);
54797
+ }
54798
+
54799
+ this.stop();
53747
54800
  }
53748
54801
 
53749
54802
  },
@@ -53761,14 +54814,54 @@ Phaser.Utils.Debug.prototype = {
53761
54814
 
53762
54815
  if (sprite.body)
53763
54816
  {
54817
+ this.start(x, y, color, 210);
54818
+
53764
54819
  if (sprite.body.type === Phaser.Physics.ARCADE)
53765
54820
  {
53766
- this.start(x, y, color, 210);
53767
54821
  Phaser.Physics.Arcade.Body.renderBodyInfo(this, sprite.body);
53768
- this.stop();
53769
54822
  }
54823
+ else if (sprite.body.type === Phaser.Physics.BOX2D)
54824
+ {
54825
+ this.game.physics.box2d.renderBodyInfo(this, sprite.body);
54826
+ }
54827
+
54828
+ this.stop();
53770
54829
  }
53771
54830
 
54831
+ },
54832
+
54833
+ /**
54834
+ * Renders 'debug draw' data for the Box2D world if it exists.
54835
+ * This uses the standard debug drawing feature of Box2D, so colors will be decided by
54836
+ * the Box2D engine.
54837
+ *
54838
+ * @method Phaser.Utils.Debug#box2dWorld
54839
+ */
54840
+ box2dWorld: function () {
54841
+
54842
+ this.start();
54843
+
54844
+ this.context.translate(-this.game.camera.view.x, -this.game.camera.view.y, 0);
54845
+ this.game.physics.box2d.renderDebugDraw(this.context);
54846
+
54847
+ this.stop();
54848
+
54849
+ },
54850
+
54851
+ /**
54852
+ * Renders 'debug draw' data for the given Box2D body.
54853
+ * This uses the standard debug drawing feature of Box2D, so colors will be decided by the Box2D engine.
54854
+ *
54855
+ * @method Phaser.Utils.Debug#box2dBody
54856
+ * @param {Phaser.Sprite} sprite - The sprite whos body will be rendered.
54857
+ * @param {string} [color='rgb(0,255,0)'] - color of the debug info to be rendered. (format is css color string).
54858
+ */
54859
+ box2dBody: function (body, color) {
54860
+
54861
+ this.start();
54862
+ Phaser.Physics.Box2D.renderBody(this.context, body, color);
54863
+ this.stop();
54864
+
53772
54865
  }
53773
54866
 
53774
54867
  };
@@ -54216,11 +55309,12 @@ Phaser.Color = {
54216
55309
  */
54217
55310
  createColor: function (r, g, b, a, h, s, l, v) {
54218
55311
 
54219
- var out = { r: r || 0, g: g || 0, b: b || 0, a: a || 1, h: h || 0, s: s || 0, l: l || 0, v: v || 0, color: 0 };
55312
+ var out = { r: r || 0, g: g || 0, b: b || 0, a: a || 1, h: h || 0, s: s || 0, l: l || 0, v: v || 0, color: 0, color32: 0, rgba: '' };
54220
55313
 
54221
- out.rgba = 'rgba(' + out.r + ',' + out.g + ',' + out.b + ',' + out.a + ')';
55314
+ out.color = Phaser.Color.getColor(out.r, out.g, out.b);
55315
+ out.color32 = Phaser.Color.getColor32(out.a, out.r, out.g, out.b);
54222
55316
 
54223
- return out;
55317
+ return Phaser.Color.updateColor(out);
54224
55318
 
54225
55319
  },
54226
55320
 
@@ -54234,7 +55328,7 @@ Phaser.Color = {
54234
55328
  */
54235
55329
  updateColor: function (out) {
54236
55330
 
54237
- out.rgba = 'rgba(' + out.r + ',' + out.g + ',' + out.b + ',' + out.a + ')';
55331
+ out.rgba = 'rgba(' + out.r.toString() + ',' + out.g.toString() + ',' + out.b.toString() + ',' + out.a.toString() + ')';
54238
55332
 
54239
55333
  return out;
54240
55334
 
@@ -54327,20 +55421,13 @@ Phaser.Color = {
54327
55421
  * @method Phaser.Color.hexToColor
54328
55422
  * @static
54329
55423
  * @param {string} hex - The hex string to convert. Can be in the short-hand format `#03f` or `#0033ff`.
54330
- * @param {object} [out] - An object into which 3 properties will be created: r, g and b. If not provided a new object will be created.
55424
+ * @param {object} [out] - An object into which 3 properties will be created or set: r, g and b. If not provided a new object will be created.
54331
55425
  * @return {object} An object with the red, green and blue values set in the r, g and b properties.
54332
55426
  */
54333
55427
  hexToColor: function (hex, out) {
54334
55428
 
54335
- if (!out)
54336
- {
54337
- out = Phaser.Color.createColor();
54338
- }
54339
-
54340
55429
  // Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF")
54341
- var shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
54342
-
54343
- hex = hex.replace(shorthandRegex, function(m, r, g, b) {
55430
+ hex = hex.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i, function(m, r, g, b) {
54344
55431
  return r + r + g + g + b + b;
54345
55432
  });
54346
55433
 
@@ -54348,15 +55435,56 @@ Phaser.Color = {
54348
55435
 
54349
55436
  if (result)
54350
55437
  {
54351
- out.r = parseInt(result[1], 16);
54352
- out.g = parseInt(result[2], 16);
54353
- out.b = parseInt(result[3], 16);
55438
+ var r = parseInt(result[1], 16);
55439
+ var g = parseInt(result[2], 16);
55440
+ var b = parseInt(result[3], 16);
55441
+
55442
+ if (!out)
55443
+ {
55444
+ out = Phaser.Color.createColor(r, g, b);
55445
+ }
55446
+ else
55447
+ {
55448
+ out.r = r;
55449
+ out.g = g;
55450
+ out.b = b;
55451
+ }
55452
+ }
55453
+
55454
+ return out;
55455
+
55456
+ },
55457
+
55458
+ /**
55459
+ * Converts a CSS 'web' string into a Phaser Color object.
55460
+ *
55461
+ * @method Phaser.Color.webToColor
55462
+ * @static
55463
+ * @param {string} web - The web string in the format: 'rgba(r,g,b,a)'
55464
+ * @param {object} [out] - An object into which 3 properties will be created: r, g and b. If not provided a new object will be created.
55465
+ * @return {object} An object with the red, green and blue values set in the r, g and b properties.
55466
+ */
55467
+ webToColor: function (web, out) {
55468
+
55469
+ if (!out)
55470
+ {
55471
+ out = Phaser.Color.createColor();
55472
+ }
55473
+
55474
+ var result = /^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/.exec(web);
55475
+
55476
+ if (result)
55477
+ {
55478
+ out.r = parseInt(result[1], 10);
55479
+ out.g = parseInt(result[2], 10);
55480
+ out.b = parseInt(result[3], 10);
54354
55481
  }
54355
55482
 
54356
55483
  return out;
54357
55484
 
54358
55485
  },
54359
55486
 
55487
+
54360
55488
  /**
54361
55489
  * Return a string containing a hex representation of the given color component.
54362
55490
  *
@@ -54669,7 +55797,6 @@ Phaser.Color = {
54669
55797
  * faster (due to being much simpler) Arcade Physics system.
54670
55798
  *
54671
55799
  * @class Phaser.Physics
54672
- *
54673
55800
  * @constructor
54674
55801
  * @param {Phaser.Game} game - A reference to the currently running game.
54675
55802
  * @param {object} [physicsConfig=null] - A physics configuration object to pass to the Physics world on creation.
@@ -54745,7 +55872,7 @@ Phaser.Physics.BOX2D = 3;
54745
55872
  * @const
54746
55873
  * @type {number}
54747
55874
  */
54748
- Phaser.Physics.CHIPMUNK = 5;
55875
+ Phaser.Physics.CHIPMUNK = 4;
54749
55876
 
54750
55877
  Phaser.Physics.prototype = {
54751
55878
 
@@ -54773,6 +55900,11 @@ Phaser.Physics.prototype = {
54773
55900
  this.p2 = new Phaser.Physics.P2(this.game, this.config);
54774
55901
  }
54775
55902
 
55903
+ if (this.config.hasOwnProperty('box2d') && this.config['box2d'] === true && Phaser.Physics.hasOwnProperty('BOX2D'))
55904
+ {
55905
+ this.box2d = new Phaser.Physics.BOX2D(this.game, this.config);
55906
+ }
55907
+
54776
55908
  },
54777
55909
 
54778
55910
  /**
@@ -54802,7 +55934,7 @@ Phaser.Physics.prototype = {
54802
55934
  }
54803
55935
  else if (system === Phaser.Physics.BOX2D && this.box2d === null)
54804
55936
  {
54805
- throw new Error('The Box2D physics system has not been implemented yet.');
55937
+ this.box2d = new Phaser.Physics.Box2D(this.game, this.config);
54806
55938
  }
54807
55939
  else if (system === Phaser.Physics.CHIPMUNK && this.chipmunk === null)
54808
55940
  {
@@ -54819,7 +55951,8 @@ Phaser.Physics.prototype = {
54819
55951
  * Phaser.Physics.Arcade - A light weight AABB based collision system with basic separation.
54820
55952
  * Phaser.Physics.P2JS - A full-body advanced physics system supporting multiple object shapes, polygon loading, contact materials, springs and constraints.
54821
55953
  * Phaser.Physics.NINJA - A port of Metanet Softwares N+ physics system. Advanced AABB and Circle vs. Tile collision.
54822
- * Phaser.Physics.BOX2D and Phaser.Physics.CHIPMUNK are still in development.
55954
+ * Phaser.Physics.BOX2D - A port of https://code.google.com/p/box2d-html5
55955
+ * Phaser.Physics.CHIPMUNK is still in development.
54823
55956
  *
54824
55957
  * If you require more control over what type of body is created, for example to create a Ninja Physics Circle instead of the default AABB, then see the
54825
55958
  * individual physics systems `enable` methods instead of using this generic one.
@@ -54846,6 +55979,10 @@ Phaser.Physics.prototype = {
54846
55979
  {
54847
55980
  this.ninja.enableAABB(object);
54848
55981
  }
55982
+ else if (system === Phaser.Physics.BOX2D && this.box2d)
55983
+ {
55984
+ this.box2d.enable(object);
55985
+ }
54849
55986
 
54850
55987
  },
54851
55988
 
@@ -54864,6 +56001,11 @@ Phaser.Physics.prototype = {
54864
56001
  this.p2.preUpdate();
54865
56002
  }
54866
56003
 
56004
+ if (this.box2d)
56005
+ {
56006
+ this.box2d.preUpdate();
56007
+ }
56008
+
54867
56009
  },
54868
56010
 
54869
56011
  /**
@@ -54881,6 +56023,11 @@ Phaser.Physics.prototype = {
54881
56023
  this.p2.update();
54882
56024
  }
54883
56025
 
56026
+ if (this.box2d)
56027
+ {
56028
+ this.box2d.update();
56029
+ }
56030
+
54884
56031
  },
54885
56032
 
54886
56033
  /**
@@ -54906,6 +56053,11 @@ Phaser.Physics.prototype = {
54906
56053
  this.p2.setBoundsToWorld();
54907
56054
  }
54908
56055
 
56056
+ if (this.box2d)
56057
+ {
56058
+ this.box2d.setBoundsToWorld();
56059
+ }
56060
+
54909
56061
  },
54910
56062
 
54911
56063
  /**
@@ -54921,6 +56073,11 @@ Phaser.Physics.prototype = {
54921
56073
  this.p2.clear();
54922
56074
  }
54923
56075
 
56076
+ if (this.box2d)
56077
+ {
56078
+ this.box2d.clear();
56079
+ }
56080
+
54924
56081
  },
54925
56082
 
54926
56083
  /**
@@ -54935,9 +56092,15 @@ Phaser.Physics.prototype = {
54935
56092
  this.p2.destroy();
54936
56093
  }
54937
56094
 
56095
+ if (this.box2d)
56096
+ {
56097
+ this.box2d.destroy();
56098
+ }
56099
+
54938
56100
  this.arcade = null;
54939
56101
  this.ninja = null;
54940
56102
  this.p2 = null;
56103
+ this.box2d = null;
54941
56104
 
54942
56105
  }
54943
56106
 
@@ -54952,12 +56115,11 @@ Phaser.Physics.prototype.constructor = Phaser.Physics;
54952
56115
  */
54953
56116
 
54954
56117
  /**
54955
- * Arcade Physics constructor.
56118
+ * The Arcade Physics world. Contains Arcade Physics related collision, overlap and motion methods.
54956
56119
  *
54957
56120
  * @class Phaser.Physics.Arcade
54958
- * @classdesc Arcade Physics Constructor
54959
56121
  * @constructor
54960
- * @param {Phaser.Game} game reference to the current game instance.
56122
+ * @param {Phaser.Game} game - reference to the current game instance.
54961
56123
  */
54962
56124
  Phaser.Physics.Arcade = function (game) {
54963
56125
 
@@ -55352,8 +56514,8 @@ Phaser.Physics.Arcade.prototype = {
55352
56514
  * NOTE: This function is not recursive, and will not test against children of objects passed (i.e. Groups or Tilemaps within other Groups).
55353
56515
  *
55354
56516
  * @method Phaser.Physics.Arcade#collide
55355
- * @param {Phaser.Sprite|Phaser.Group|Phaser.Particles.Emitter|Phaser.Tilemap|array} object1 - The first object or array of objects to check. Can be Phaser.Sprite, Phaser.Group, Phaser.Particles.Emitter, or Phaser.Tilemap.
55356
- * @param {Phaser.Sprite|Phaser.Group|Phaser.Particles.Emitter|Phaser.Tilemap|array} object2 - The second object or array of objects to check. Can be Phaser.Sprite, Phaser.Group, Phaser.Particles.Emitter or Phaser.Tilemap.
56517
+ * @param {Phaser.Sprite|Phaser.Group|Phaser.Particles.Emitter|Phaser.TilemapLayer|array} object1 - The first object or array of objects to check. Can be Phaser.Sprite, Phaser.Group, Phaser.Particles.Emitter, or Phaser.TilemapLayer.
56518
+ * @param {Phaser.Sprite|Phaser.Group|Phaser.Particles.Emitter|Phaser.TilemapLayer|array} object2 - The second object or array of objects to check. Can be Phaser.Sprite, Phaser.Group, Phaser.Particles.Emitter or Phaser.TilemapLayer.
55357
56519
  * @param {function} [collideCallback=null] - An optional callback function that is called if the objects collide. The two objects will be passed to this function in the same order in which you specified them, unless you are colliding Group vs. Sprite, in which case Sprite will always be the first parameter.
55358
56520
  * @param {function} [processCallback=null] - A callback function that lets you perform additional checks against the two objects if they overlap. If this is set then collision will only happen if processCallback returns true. The two objects will be passed to this function in the same order in which you specified them.
55359
56521
  * @param {object} [callbackContext] - The context in which to run the callbacks.
@@ -55406,8 +56568,8 @@ Phaser.Physics.Arcade.prototype = {
55406
56568
  *
55407
56569
  * @method Phaser.Physics.Arcade#collideHandler
55408
56570
  * @private
55409
- * @param {Phaser.Sprite|Phaser.Group|Phaser.Particles.Emitter|Phaser.Tilemap} object1 - The first object to check. Can be an instance of Phaser.Sprite, Phaser.Group, Phaser.Particles.Emitter, or Phaser.Tilemap.
55410
- * @param {Phaser.Sprite|Phaser.Group|Phaser.Particles.Emitter|Phaser.Tilemap} object2 - The second object to check. Can be an instance of Phaser.Sprite, Phaser.Group, Phaser.Particles.Emitter or Phaser.Tilemap. Can also be an array of objects to check.
56571
+ * @param {Phaser.Sprite|Phaser.Group|Phaser.Particles.Emitter|Phaser.TilemapLayer} object1 - The first object to check. Can be an instance of Phaser.Sprite, Phaser.Group, Phaser.Particles.Emitter, or Phaser.TilemapLayer.
56572
+ * @param {Phaser.Sprite|Phaser.Group|Phaser.Particles.Emitter|Phaser.TilemapLayer} object2 - The second object to check. Can be an instance of Phaser.Sprite, Phaser.Group, Phaser.Particles.Emitter or Phaser.TilemapLayer. Can also be an array of objects to check.
55411
56573
  * @param {function} collideCallback - An optional callback function that is called if the objects collide. The two objects will be passed to this function in the same order in which you specified them.
55412
56574
  * @param {function} processCallback - A callback function that lets you perform additional checks against the two objects if they overlap. If this is set then collision will only happen if processCallback returns true. The two objects will be passed to this function in the same order in which you specified them.
55413
56575
  * @param {object} callbackContext - The context in which to run the callbacks.
@@ -56760,7 +57922,6 @@ Phaser.Physics.Arcade.prototype = {
56760
57922
  * the Sprite itself. For example you can set the velocity, acceleration, bounce values etc all on the Body.
56761
57923
  *
56762
57924
  * @class Phaser.Physics.Arcade.Body
56763
- * @classdesc Arcade Physics Body Constructor
56764
57925
  * @constructor
56765
57926
  * @param {Phaser.Sprite} sprite - The Sprite object this physics body belongs to.
56766
57927
  */
@@ -57591,7 +58752,6 @@ Phaser.Physics.Arcade.Body.prototype.constructor = Phaser.Physics.Arcade.Body;
57591
58752
  * Phaser.Particles is the Particle Manager for the game. It is called during the game update loop and in turn updates any Emitters attached to it.
57592
58753
  *
57593
58754
  * @class Phaser.Particles
57594
- * @classdesc Phaser Particles
57595
58755
  * @constructor
57596
58756
  * @param {Phaser.Game} game - A reference to the currently running game.
57597
58757
  */
@@ -57663,8 +58823,18 @@ Phaser.Particles.prototype = {
57663
58823
 
57664
58824
  Phaser.Particles.prototype.constructor = Phaser.Particles;
57665
58825
 
57666
- Phaser.Particles.Arcade = {};
58826
+ /**
58827
+ * @author Richard Davey <rich@photonstorm.com>
58828
+ * @copyright 2014 Photon Storm Ltd.
58829
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
58830
+ */
57667
58831
 
58832
+ /**
58833
+ * Arcade Particles is a Particle System integrated with Arcade Physics.
58834
+ *
58835
+ * @class Phaser.Particles.Arcade
58836
+ */
58837
+ Phaser.Particles.Arcade = {};
57668
58838
  /**
57669
58839
  * @author Richard Davey <rich@photonstorm.com>
57670
58840
  * @copyright 2014 Photon Storm Ltd.
@@ -57672,12 +58842,11 @@ Phaser.Particles.Arcade = {};
57672
58842
  */
57673
58843
 
57674
58844
  /**
57675
- * @class Phaser.Particles.Arcade.Emitter
57676
- *
57677
- * @classdesc Emitter is a lightweight particle emitter that uses Arcade Physics.
58845
+ * Emitter is a lightweight particle emitter that uses Arcade Physics.
57678
58846
  * It can be used for one-time explosions or for continuous effects like rain and fire.
57679
- * All it really does is launch Particle objects out at set intervals, and fixes their positions and velocities accorindgly.
58847
+ * All it really does is launch Particle objects out at set intervals, and fixes their positions and velocities accordingly.
57680
58848
  *
58849
+ * @class Phaser.Particles.Arcade.Emitter
57681
58850
  * @constructor
57682
58851
  * @extends Phaser.Group
57683
58852
  * @param {Phaser.Game} game - Current game instance.
@@ -57685,7 +58854,6 @@ Phaser.Particles.Arcade = {};
57685
58854
  * @param {number} [y=0] - The y coordinate within the Emitter that the particles are emitted from.
57686
58855
  * @param {number} [maxParticles=50] - The total number of particles in this emitter.
57687
58856
  */
57688
-
57689
58857
  Phaser.Particles.Arcade.Emitter = function (game, x, y, maxParticles) {
57690
58858
 
57691
58859
  /**
@@ -58509,10 +59677,9 @@ Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype, "bottom", {
58509
59677
  */
58510
59678
 
58511
59679
  /**
58512
- * Create a new `Tile` object.
59680
+ * A Tile is a representation of a single tile within the Tilemap.
58513
59681
  *
58514
59682
  * @class Phaser.Tile
58515
- * @classdesc A Tile is a representation of a single tile within the Tilemap.
58516
59683
  * @constructor
58517
59684
  * @param {object} layer - The layer in the Tilemap data that this tile belongs to.
58518
59685
  * @param {number} index - The index of this tile type in the core map data.
@@ -75878,8 +77045,10 @@ p2.Body.prototype.parent = null;
75878
77045
  p2.Spring.prototype.parent = null;
75879
77046
 
75880
77047
  /**
77048
+ * This is your main access to the P2 Physics World.
77049
+ * From here you can create materials, listen for events and add bodies into the physics simulation.
77050
+ *
75881
77051
  * @class Phaser.Physics.P2
75882
- * @classdesc Physics World Constructor
75883
77052
  * @constructor
75884
77053
  * @param {Phaser.Game} game - Reference to the current game instance.
75885
77054
  * @param {object} [config] - Physics configuration object passed in from the game constructor.
@@ -77772,7 +78941,6 @@ Object.defineProperty(Phaser.Physics.P2.prototype, "total", {
77772
78941
  * during runtime (to remove parts, set masks, categories & sensor properties)
77773
78942
  *
77774
78943
  * @class Phaser.Physics.P2.FixtureList
77775
- * @classdesc Collection for generated P2 fixtures
77776
78944
  * @constructor
77777
78945
  * @param {Array} list - A list of fixtures (from Phaser.Physics.P2.Body#addPhaserPolygon)
77778
78946
  */
@@ -77996,7 +79164,6 @@ Phaser.Physics.P2.FixtureList.prototype = {
77996
79164
  * A PointProxy is an internal class that allows for direct getter/setter style property access to Arrays and TypedArrays.
77997
79165
  *
77998
79166
  * @class Phaser.Physics.P2.PointProxy
77999
- * @classdesc PointProxy
78000
79167
  * @constructor
78001
79168
  * @param {Phaser.Physics.P2} world - A reference to the P2 World.
78002
79169
  * @param {any} destination - The object to bind to.
@@ -78100,7 +79267,6 @@ Object.defineProperty(Phaser.Physics.P2.PointProxy.prototype, "my", {
78100
79267
  * A InversePointProxy is an internal class that allows for direct getter/setter style property access to Arrays and TypedArrays but inverses the values on set.
78101
79268
  *
78102
79269
  * @class Phaser.Physics.P2.InversePointProxy
78103
- * @classdesc InversePointProxy
78104
79270
  * @constructor
78105
79271
  * @param {Phaser.Physics.P2} world - A reference to the P2 World.
78106
79272
  * @param {any} destination - The object to bind to.
@@ -78209,7 +79375,6 @@ Object.defineProperty(Phaser.Physics.P2.InversePointProxy.prototype, "my", {
78209
79375
  * Note: When a game object is given a P2 body it has its anchor x/y set to 0.5, so it becomes centered.
78210
79376
  *
78211
79377
  * @class Phaser.Physics.P2.Body
78212
- * @classdesc Physics Body Constructor
78213
79378
  * @constructor
78214
79379
  * @param {Phaser.Game} game - Game reference to the currently running game.
78215
79380
  * @param {Phaser.Sprite} [sprite] - The Sprite object this physics body belongs to.
@@ -79984,7 +81149,6 @@ Object.defineProperty(Phaser.Physics.P2.Body.prototype, "collideWorldBounds", {
79984
81149
  * So use sparingly and rarely (if ever) in production code.
79985
81150
  *
79986
81151
  * @class Phaser.Physics.P2.BodyDebug
79987
- * @classdesc Physics Body Debug Constructor
79988
81152
  * @constructor
79989
81153
  * @extends Phaser.Group
79990
81154
  * @param {Phaser.Game} game - Game reference to the currently running game.
@@ -80409,7 +81573,6 @@ Phaser.Utils.extend(Phaser.Physics.P2.BodyDebug.prototype, {
80409
81573
  * Creates a linear spring, connecting two bodies. A spring can have a resting length, a stiffness and damping.
80410
81574
  *
80411
81575
  * @class Phaser.Physics.P2.Spring
80412
- * @classdesc Physics Spring Constructor
80413
81576
  * @constructor
80414
81577
  * @param {Phaser.Physics.P2} world - A reference to the P2 World.
80415
81578
  * @param {p2.Body} bodyA - First connected body.
@@ -80487,7 +81650,6 @@ Phaser.Physics.P2.Spring.prototype.constructor = Phaser.Physics.P2.Spring;
80487
81650
  * Creates a rotational spring, connecting two bodies. A spring can have a resting length, a stiffness and damping.
80488
81651
  *
80489
81652
  * @class Phaser.Physics.P2.RotationalSpring
80490
- * @classdesc Physics Spring Constructor
80491
81653
  * @constructor
80492
81654
  * @param {Phaser.Physics.P2} world - A reference to the P2 World.
80493
81655
  * @param {p2.Body} bodyA - First connected body.
@@ -80541,11 +81703,13 @@ Phaser.Physics.P2.Spring.prototype.constructor = Phaser.Physics.P2.Spring;
80541
81703
  */
80542
81704
 
80543
81705
  /**
81706
+ * A P2 Material.
81707
+ *
80544
81708
  * \o/ ~ "Because I'm a Material girl"
80545
81709
  *
80546
81710
  * @class Phaser.Physics.P2.Material
80547
- * @classdesc Physics Material Constructor
80548
81711
  * @constructor
81712
+ * @param {string} name - The user defined name given to this Material.
80549
81713
  */
80550
81714
  Phaser.Physics.P2.Material = function (name) {
80551
81715
 
@@ -80572,11 +81736,10 @@ Phaser.Physics.P2.Material.prototype.constructor = Phaser.Physics.P2.Material;
80572
81736
  * Defines a physics material
80573
81737
  *
80574
81738
  * @class Phaser.Physics.P2.ContactMaterial
80575
- * @classdesc Physics ContactMaterial Constructor
80576
81739
  * @constructor
80577
- * @param {Phaser.Physics.P2.Material} materialA
80578
- * @param {Phaser.Physics.P2.Material} materialB
80579
- * @param {object} [options]
81740
+ * @param {Phaser.Physics.P2.Material} materialA - First material participating in the contact material.
81741
+ * @param {Phaser.Physics.P2.Material} materialB - Second material participating in the contact material.
81742
+ * @param {object} [options] - Additional configuration options.
80580
81743
  */
80581
81744
  Phaser.Physics.P2.ContactMaterial = function (materialA, materialB, options) {
80582
81745
 
@@ -80589,7 +81752,7 @@ Phaser.Physics.P2.ContactMaterial = function (materialA, materialB, options) {
80589
81752
  */
80590
81753
 
80591
81754
  /**
80592
- * @property {Phaser.Physics.P2.Material} materialB - First second participating in the contact material.
81755
+ * @property {Phaser.Physics.P2.Material} materialB - Second material participating in the contact material.
80593
81756
  */
80594
81757
 
80595
81758
  /**
@@ -80637,8 +81800,8 @@ Phaser.Physics.P2.ContactMaterial.prototype.constructor = Phaser.Physics.P2.Cont
80637
81800
  * Collision Group
80638
81801
  *
80639
81802
  * @class Phaser.Physics.P2.CollisionGroup
80640
- * @classdesc Physics Collision Group Constructor
80641
81803
  * @constructor
81804
+ * @param {number} bitmask - The CollisionGroup bitmask.
80642
81805
  */
80643
81806
  Phaser.Physics.P2.CollisionGroup = function (bitmask) {
80644
81807
 
@@ -80659,7 +81822,6 @@ Phaser.Physics.P2.CollisionGroup = function (bitmask) {
80659
81822
  * A constraint that tries to keep the distance between two bodies constant.
80660
81823
  *
80661
81824
  * @class Phaser.Physics.P2.DistanceConstraint
80662
- * @classdesc Physics DistanceConstraint Constructor
80663
81825
  * @constructor
80664
81826
  * @param {Phaser.Physics.P2} world - A reference to the P2 World.
80665
81827
  * @param {p2.Body} bodyA - First connected body.
@@ -80710,7 +81872,6 @@ Phaser.Physics.P2.DistanceConstraint.prototype.constructor = Phaser.Physics.P2.D
80710
81872
  * Connects two bodies at given offset points, letting them rotate relative to each other around this point.
80711
81873
  *
80712
81874
  * @class Phaser.Physics.P2.GearConstraint
80713
- * @classdesc Physics GearConstraint Constructor
80714
81875
  * @constructor
80715
81876
  * @param {Phaser.Physics.P2} world - A reference to the P2 World.
80716
81877
  * @param {p2.Body} bodyA - First connected body.
@@ -80752,7 +81913,6 @@ Phaser.Physics.P2.GearConstraint.prototype.constructor = Phaser.Physics.P2.GearC
80752
81913
  * Locks the relative position between two bodies.
80753
81914
  *
80754
81915
  * @class Phaser.Physics.P2.LockConstraint
80755
- * @classdesc Physics LockConstraint Constructor
80756
81916
  * @constructor
80757
81917
  * @param {Phaser.Physics.P2} world - A reference to the P2 World.
80758
81918
  * @param {p2.Body} bodyA - First connected body.
@@ -80798,7 +81958,6 @@ Phaser.Physics.P2.LockConstraint.prototype.constructor = Phaser.Physics.P2.LockC
80798
81958
  * Connects two bodies at given offset points, letting them rotate relative to each other around this point.
80799
81959
  *
80800
81960
  * @class Phaser.Physics.P2.PrismaticConstraint
80801
- * @classdesc Physics PrismaticConstraint Constructor
80802
81961
  * @constructor
80803
81962
  * @param {Phaser.Physics.P2} world - A reference to the P2 World.
80804
81963
  * @param {p2.Body} bodyA - First connected body.
@@ -80850,7 +82009,6 @@ Phaser.Physics.P2.PrismaticConstraint.prototype.constructor = Phaser.Physics.P2.
80850
82009
  * The pivot points are given in world (pixel) coordinates.
80851
82010
  *
80852
82011
  * @class Phaser.Physics.P2.RevoluteConstraint
80853
- * @classdesc Physics RevoluteConstraint Constructor
80854
82012
  * @constructor
80855
82013
  * @param {Phaser.Physics.P2} world - A reference to the P2 World.
80856
82014
  * @param {p2.Body} bodyA - First connected body.