phaser-rails 2.4.6.0 → 2.4.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/phaser/rails/version.rb +1 -1
- data/vendor/assets/javascripts/phaser.js +1520 -671
- data/vendor/assets/javascripts/phaser.map +1 -1
- data/vendor/assets/javascripts/phaser.min.js +21 -21
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e8170528a1d5a9b35d3a7d14019be79eef34044
|
4
|
+
data.tar.gz: 76374c9bbbc2ca0813e0a430870dd5ffef1bc254
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce221b4fea8f69b65951f34c1d9d9a61fb5a260dcc89adc7b225d9acdf34d8e85a870bacb8f308f1371dd499b718a5dd89b9880484fd99889fd536098ea9018a
|
7
|
+
data.tar.gz: 98cf927404edef3ba0b6a64d4795b22f08dd16f91e44c7d63d25f17b46542d9d116a5cd46fcee10b59e2f60c96d4fbb949736d35078264603429989e77730e28
|
data/lib/phaser/rails/version.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
/**
|
2
2
|
* @author Richard Davey <rich@photonstorm.com>
|
3
|
-
* @copyright
|
3
|
+
* @copyright 2016 Photon Storm Ltd.
|
4
4
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
5
5
|
*
|
6
6
|
* @overview
|
7
7
|
*
|
8
8
|
* Phaser - http://phaser.io
|
9
9
|
*
|
10
|
-
* v2.4.
|
10
|
+
* v2.4.7 "Hinderstap" - Built: Fri Apr 22 2016 15:08:21
|
11
11
|
*
|
12
12
|
* By Richard Davey http://www.photonstorm.com @photonstorm
|
13
13
|
*
|
@@ -14840,9 +14840,10 @@ PIXI.DisplayObjectContainer.prototype.displayObjectContainerUpdateTransform = PI
|
|
14840
14840
|
*/
|
14841
14841
|
PIXI.DisplayObjectContainer.prototype.getBounds = function()
|
14842
14842
|
{
|
14843
|
-
if(this.children.length === 0)
|
14844
|
-
|
14845
|
-
|
14843
|
+
if (this.children.length === 0)
|
14844
|
+
{
|
14845
|
+
return PIXI.EmptyRectangle;
|
14846
|
+
}
|
14846
14847
|
|
14847
14848
|
var minX = Infinity;
|
14848
14849
|
var minY = Infinity;
|
@@ -14856,11 +14857,14 @@ PIXI.DisplayObjectContainer.prototype.getBounds = function()
|
|
14856
14857
|
|
14857
14858
|
var childVisible = false;
|
14858
14859
|
|
14859
|
-
for(var i=0
|
14860
|
+
for (var i = 0; i < this.children.length; i++)
|
14860
14861
|
{
|
14861
14862
|
var child = this.children[i];
|
14862
14863
|
|
14863
|
-
if(!child.visible)
|
14864
|
+
if (!child.visible)
|
14865
|
+
{
|
14866
|
+
continue;
|
14867
|
+
}
|
14864
14868
|
|
14865
14869
|
childVisible = true;
|
14866
14870
|
|
@@ -14876,8 +14880,10 @@ PIXI.DisplayObjectContainer.prototype.getBounds = function()
|
|
14876
14880
|
maxY = maxY > childMaxY ? maxY : childMaxY;
|
14877
14881
|
}
|
14878
14882
|
|
14879
|
-
if(!childVisible)
|
14883
|
+
if (!childVisible)
|
14884
|
+
{
|
14880
14885
|
return PIXI.EmptyRectangle;
|
14886
|
+
}
|
14881
14887
|
|
14882
14888
|
var bounds = this._bounds;
|
14883
14889
|
|
@@ -14886,9 +14892,6 @@ PIXI.DisplayObjectContainer.prototype.getBounds = function()
|
|
14886
14892
|
bounds.width = maxX - minX;
|
14887
14893
|
bounds.height = maxY - minY;
|
14888
14894
|
|
14889
|
-
// TODO: store a reference so that if this function gets called again in the render cycle we do not have to recalculate
|
14890
|
-
//this._currentBounds = bounds;
|
14891
|
-
|
14892
14895
|
return bounds;
|
14893
14896
|
};
|
14894
14897
|
|
@@ -14904,7 +14907,7 @@ PIXI.DisplayObjectContainer.prototype.getLocalBounds = function()
|
|
14904
14907
|
|
14905
14908
|
this.worldTransform = PIXI.identityMatrix;
|
14906
14909
|
|
14907
|
-
for(var i=0
|
14910
|
+
for (var i = 0; i < this.children.length; i++)
|
14908
14911
|
{
|
14909
14912
|
this.children[i].updateTransform();
|
14910
14913
|
}
|
@@ -14912,6 +14915,11 @@ PIXI.DisplayObjectContainer.prototype.getLocalBounds = function()
|
|
14912
14915
|
var bounds = this.getBounds();
|
14913
14916
|
|
14914
14917
|
this.worldTransform = matrixCache;
|
14918
|
+
|
14919
|
+
for (i = 0; i < this.children.length; i++)
|
14920
|
+
{
|
14921
|
+
this.children[i].updateTransform();
|
14922
|
+
}
|
14915
14923
|
|
14916
14924
|
return bounds;
|
14917
14925
|
};
|
@@ -15215,6 +15223,7 @@ PIXI.Sprite.prototype.setTexture = function(texture, destroyBase)
|
|
15215
15223
|
this.texture.baseTexture.skipRender = false;
|
15216
15224
|
this.texture = texture;
|
15217
15225
|
this.texture.valid = true;
|
15226
|
+
this.cachedTint = -1;
|
15218
15227
|
};
|
15219
15228
|
|
15220
15229
|
/**
|
@@ -15232,7 +15241,15 @@ PIXI.Sprite.prototype.onTextureUpdate = function()
|
|
15232
15241
|
};
|
15233
15242
|
|
15234
15243
|
/**
|
15235
|
-
* Returns the bounds of the Sprite as a rectangle.
|
15244
|
+
* Returns the bounds of the Sprite as a rectangle.
|
15245
|
+
* The bounds calculation takes the worldTransform into account.
|
15246
|
+
*
|
15247
|
+
* It is important to note that the transform is not updated when you call this method.
|
15248
|
+
* So if this Sprite is the child of a Display Object which has had its transform
|
15249
|
+
* updated since the last render pass, those changes will not yet have been applied
|
15250
|
+
* to this Sprites worldTransform. If you need to ensure that all parent transforms
|
15251
|
+
* are factored into this getBounds operation then you should call `updateTransform`
|
15252
|
+
* on the root most object in this Sprites display list first.
|
15236
15253
|
*
|
15237
15254
|
* @method getBounds
|
15238
15255
|
* @param matrix {Matrix} the transformation matrix of the sprite
|
@@ -15462,16 +15479,19 @@ PIXI.Sprite.prototype._renderCanvas = function(renderSession, matrix)
|
|
15462
15479
|
var dx = (this.texture.trim) ? this.texture.trim.x - this.anchor.x * this.texture.trim.width : this.anchor.x * -this.texture.frame.width;
|
15463
15480
|
var dy = (this.texture.trim) ? this.texture.trim.y - this.anchor.y * this.texture.trim.height : this.anchor.y * -this.texture.frame.height;
|
15464
15481
|
|
15482
|
+
var tx = (wt.tx * renderSession.resolution) + renderSession.shakeX;
|
15483
|
+
var ty = (wt.ty * renderSession.resolution) + renderSession.shakeY;
|
15484
|
+
|
15465
15485
|
// Allow for pixel rounding
|
15466
15486
|
if (renderSession.roundPixels)
|
15467
15487
|
{
|
15468
|
-
renderSession.context.setTransform(wt.a, wt.b, wt.c, wt.d,
|
15488
|
+
renderSession.context.setTransform(wt.a, wt.b, wt.c, wt.d, tx | 0, ty | 0);
|
15469
15489
|
dx |= 0;
|
15470
15490
|
dy |= 0;
|
15471
15491
|
}
|
15472
15492
|
else
|
15473
15493
|
{
|
15474
|
-
renderSession.context.setTransform(wt.a, wt.b, wt.c, wt.d,
|
15494
|
+
renderSession.context.setTransform(wt.a, wt.b, wt.c, wt.d, tx, ty);
|
15475
15495
|
}
|
15476
15496
|
|
15477
15497
|
var cw = this.texture.crop.width;
|
@@ -15690,8 +15710,8 @@ PIXI.SpriteBatch.prototype._renderCanvas = function(renderSession)
|
|
15690
15710
|
frame.y,
|
15691
15711
|
frame.width,
|
15692
15712
|
frame.height,
|
15693
|
-
((child.anchor.x) * (-frame.width * child.scale.x) + child.position.x
|
15694
|
-
((child.anchor.y) * (-frame.height * child.scale.y) + child.position.y
|
15713
|
+
((child.anchor.x) * (-frame.width * child.scale.x) + child.position.x + 0.5 + renderSession.shakeX) | 0,
|
15714
|
+
((child.anchor.y) * (-frame.height * child.scale.y) + child.position.y + 0.5 + renderSession.shakeY) | 0,
|
15695
15715
|
frame.width * child.scale.x,
|
15696
15716
|
frame.height * child.scale.y);
|
15697
15717
|
}
|
@@ -15702,16 +15722,18 @@ PIXI.SpriteBatch.prototype._renderCanvas = function(renderSession)
|
|
15702
15722
|
child.displayObjectUpdateTransform();
|
15703
15723
|
|
15704
15724
|
var childTransform = child.worldTransform;
|
15725
|
+
var tx = (childTransform.tx * renderSession.resolution) + renderSession.shakeX;
|
15726
|
+
var ty = (childTransform.ty * renderSession.resolution) + renderSession.shakeY;
|
15705
15727
|
|
15706
15728
|
// allow for trimming
|
15707
15729
|
|
15708
15730
|
if (renderSession.roundPixels)
|
15709
15731
|
{
|
15710
|
-
context.setTransform(childTransform.a, childTransform.b, childTransform.c, childTransform.d,
|
15732
|
+
context.setTransform(childTransform.a, childTransform.b, childTransform.c, childTransform.d, tx | 0, ty | 0);
|
15711
15733
|
}
|
15712
15734
|
else
|
15713
15735
|
{
|
15714
|
-
context.setTransform(childTransform.a, childTransform.b, childTransform.c, childTransform.d,
|
15736
|
+
context.setTransform(childTransform.a, childTransform.b, childTransform.c, childTransform.d, tx, ty);
|
15715
15737
|
}
|
15716
15738
|
|
15717
15739
|
context.drawImage(texture.baseTexture.source,
|
@@ -15825,7 +15847,7 @@ PIXI.isPowerOfTwo = function(width, height)
|
|
15825
15847
|
|
15826
15848
|
/**
|
15827
15849
|
* @author Richard Davey <rich@photonstorm.com>
|
15828
|
-
* @copyright
|
15850
|
+
* @copyright 2016 Photon Storm Ltd.
|
15829
15851
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
15830
15852
|
*/
|
15831
15853
|
|
@@ -17283,6 +17305,9 @@ PIXI.WebGLRenderer.prototype.render = function(stage)
|
|
17283
17305
|
gl.clear(gl.COLOR_BUFFER_BIT);
|
17284
17306
|
}
|
17285
17307
|
|
17308
|
+
this.offset.x = this.game.camera._shake.x;
|
17309
|
+
this.offset.y = this.game.camera._shake.y;
|
17310
|
+
|
17286
17311
|
this.renderDisplayObject(stage, this.projection);
|
17287
17312
|
};
|
17288
17313
|
|
@@ -20194,10 +20219,6 @@ PIXI.CanvasRenderer = function (game) {
|
|
20194
20219
|
*/
|
20195
20220
|
this.refresh = true;
|
20196
20221
|
|
20197
|
-
// This is already done in the Game.setUpRenderer method.
|
20198
|
-
// this.view.width = this.width * this.resolution;
|
20199
|
-
// this.view.height = this.height * this.resolution;
|
20200
|
-
|
20201
20222
|
/**
|
20202
20223
|
* Internal var.
|
20203
20224
|
*
|
@@ -20255,6 +20276,9 @@ PIXI.CanvasRenderer.prototype.render = function (stage) {
|
|
20255
20276
|
this.context.globalAlpha = 1;
|
20256
20277
|
|
20257
20278
|
this.renderSession.currentBlendMode = 0;
|
20279
|
+
this.renderSession.shakeX = this.game.camera._shake.x;
|
20280
|
+
this.renderSession.shakeY = this.game.camera._shake.y;
|
20281
|
+
|
20258
20282
|
this.context.globalCompositeOperation = 'source-over';
|
20259
20283
|
|
20260
20284
|
if (navigator.isCocoonJS && this.view.screencanvas)
|
@@ -20286,8 +20310,8 @@ PIXI.CanvasRenderer.prototype.render = function (stage) {
|
|
20286
20310
|
* @method destroy
|
20287
20311
|
* @param [removeView=true] {boolean} Removes the Canvas element from the DOM.
|
20288
20312
|
*/
|
20289
|
-
PIXI.CanvasRenderer.prototype.destroy = function(removeView)
|
20290
|
-
|
20313
|
+
PIXI.CanvasRenderer.prototype.destroy = function (removeView) {
|
20314
|
+
|
20291
20315
|
if (removeView === undefined) { removeView = true; }
|
20292
20316
|
|
20293
20317
|
if (removeView && this.view.parent)
|
@@ -20309,8 +20333,8 @@ PIXI.CanvasRenderer.prototype.destroy = function(removeView)
|
|
20309
20333
|
* @param width {Number} the new width of the canvas view
|
20310
20334
|
* @param height {Number} the new height of the canvas view
|
20311
20335
|
*/
|
20312
|
-
PIXI.CanvasRenderer.prototype.resize = function(width, height)
|
20313
|
-
|
20336
|
+
PIXI.CanvasRenderer.prototype.resize = function (width, height) {
|
20337
|
+
|
20314
20338
|
this.width = width * this.resolution;
|
20315
20339
|
this.height = height * this.resolution;
|
20316
20340
|
|
@@ -20322,6 +20346,12 @@ PIXI.CanvasRenderer.prototype.resize = function(width, height)
|
|
20322
20346
|
this.view.style.width = this.width / this.resolution + "px";
|
20323
20347
|
this.view.style.height = this.height / this.resolution + "px";
|
20324
20348
|
}
|
20349
|
+
|
20350
|
+
if (this.renderSession.smoothProperty)
|
20351
|
+
{
|
20352
|
+
this.context[this.renderSession.smoothProperty] = (this.renderSession.scaleMode === PIXI.scaleModes.LINEAR);
|
20353
|
+
}
|
20354
|
+
|
20325
20355
|
};
|
20326
20356
|
|
20327
20357
|
/**
|
@@ -21708,13 +21738,16 @@ PIXI.Strip.prototype._renderCanvas = function(renderSession)
|
|
21708
21738
|
|
21709
21739
|
var transform = this.worldTransform;
|
21710
21740
|
|
21741
|
+
var tx = (transform.tx * renderSession.resolution) + renderSession.shakeX;
|
21742
|
+
var ty = (transform.ty * renderSession.resolution) + renderSession.shakeY;
|
21743
|
+
|
21711
21744
|
if (renderSession.roundPixels)
|
21712
21745
|
{
|
21713
|
-
context.setTransform(transform.a, transform.b, transform.c, transform.d,
|
21746
|
+
context.setTransform(transform.a, transform.b, transform.c, transform.d, tx | 0, ty | 0);
|
21714
21747
|
}
|
21715
21748
|
else
|
21716
21749
|
{
|
21717
|
-
context.setTransform(transform.a, transform.b, transform.c, transform.d,
|
21750
|
+
context.setTransform(transform.a, transform.b, transform.c, transform.d, tx, ty);
|
21718
21751
|
}
|
21719
21752
|
|
21720
21753
|
if (this.drawMode === PIXI.Strip.DrawModes.TRIANGLE_STRIP)
|
@@ -22378,8 +22411,10 @@ PIXI.TilingSprite.prototype._renderCanvas = function(renderSession)
|
|
22378
22411
|
|
22379
22412
|
var wt = this.worldTransform;
|
22380
22413
|
var resolution = renderSession.resolution;
|
22414
|
+
var tx = (wt.tx * resolution) + renderSession.shakeX;
|
22415
|
+
var ty = (wt.ty * resolution) + renderSession.shakeY;
|
22381
22416
|
|
22382
|
-
context.setTransform(wt.a * resolution, wt.b * resolution, wt.c * resolution, wt.d * resolution,
|
22417
|
+
context.setTransform(wt.a * resolution, wt.b * resolution, wt.c * resolution, wt.d * resolution, tx, ty);
|
22383
22418
|
|
22384
22419
|
if (this.refreshTexture)
|
22385
22420
|
{
|
@@ -22484,10 +22519,8 @@ PIXI.TilingSprite.prototype.generateTilingTexture = function(forcePowerOfTwo, re
|
|
22484
22519
|
var texture = this.texture;
|
22485
22520
|
var frame = texture.frame;
|
22486
22521
|
|
22487
|
-
|
22488
|
-
|
22489
|
-
var targetWidth = this._frame.sourceSizeW;
|
22490
|
-
var targetHeight = this._frame.sourceSizeH;
|
22522
|
+
var targetWidth = this._frame.sourceSizeW || this._frame.width;
|
22523
|
+
var targetHeight = this._frame.sourceSizeH || this._frame.height;
|
22491
22524
|
|
22492
22525
|
var dx = 0;
|
22493
22526
|
var dy = 0;
|
@@ -22709,7 +22742,7 @@ Object.defineProperty(PIXI.TilingSprite.prototype, 'height', {
|
|
22709
22742
|
}).call(this);
|
22710
22743
|
/**
|
22711
22744
|
* @author Richard Davey <rich@photonstorm.com>
|
22712
|
-
* @copyright
|
22745
|
+
* @copyright 2016 Photon Storm Ltd.
|
22713
22746
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
22714
22747
|
*/
|
22715
22748
|
|
@@ -22720,7 +22753,7 @@ Object.defineProperty(PIXI.TilingSprite.prototype, 'height', {
|
|
22720
22753
|
/* global Phaser:true */
|
22721
22754
|
/**
|
22722
22755
|
* @author Richard Davey <rich@photonstorm.com>
|
22723
|
-
* @copyright
|
22756
|
+
* @copyright 2016 Photon Storm Ltd.
|
22724
22757
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
22725
22758
|
*/
|
22726
22759
|
|
@@ -22734,7 +22767,7 @@ var Phaser = Phaser || {
|
|
22734
22767
|
* @constant
|
22735
22768
|
* @type {string}
|
22736
22769
|
*/
|
22737
|
-
VERSION: '2.4.
|
22770
|
+
VERSION: '2.4.7',
|
22738
22771
|
|
22739
22772
|
/**
|
22740
22773
|
* An array of Phaser game instances.
|
@@ -23085,7 +23118,7 @@ var Phaser = Phaser || {
|
|
23085
23118
|
};
|
23086
23119
|
|
23087
23120
|
/**
|
23088
|
-
* @copyright
|
23121
|
+
* @copyright 2016 Photon Storm Ltd.
|
23089
23122
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
23090
23123
|
*/
|
23091
23124
|
|
@@ -23240,7 +23273,7 @@ if (!window.console)
|
|
23240
23273
|
|
23241
23274
|
/**
|
23242
23275
|
* @author Richard Davey <rich@photonstorm.com>
|
23243
|
-
* @copyright
|
23276
|
+
* @copyright 2016 Photon Storm Ltd.
|
23244
23277
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
23245
23278
|
*/
|
23246
23279
|
|
@@ -23647,7 +23680,7 @@ Phaser.Utils = {
|
|
23647
23680
|
|
23648
23681
|
/**
|
23649
23682
|
* @author Richard Davey <rich@photonstorm.com>
|
23650
|
-
* @copyright
|
23683
|
+
* @copyright 2016 Photon Storm Ltd.
|
23651
23684
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
23652
23685
|
*/
|
23653
23686
|
|
@@ -24222,7 +24255,7 @@ PIXI.Circle = Phaser.Circle;
|
|
24222
24255
|
/**
|
24223
24256
|
* @author Richard Davey <rich@photonstorm.com>
|
24224
24257
|
* @author Chad Engler <chad@pantherdev.com>
|
24225
|
-
* @copyright
|
24258
|
+
* @copyright 2016 Photon Storm Ltd.
|
24226
24259
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
24227
24260
|
*/
|
24228
24261
|
|
@@ -24548,7 +24581,7 @@ PIXI.Ellipse = Phaser.Ellipse;
|
|
24548
24581
|
|
24549
24582
|
/**
|
24550
24583
|
* @author Richard Davey <rich@photonstorm.com>
|
24551
|
-
* @copyright
|
24584
|
+
* @copyright 2016 Photon Storm Ltd.
|
24552
24585
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
24553
24586
|
*/
|
24554
24587
|
|
@@ -25193,7 +25226,7 @@ Phaser.Line.reflect = function (a, b) {
|
|
25193
25226
|
/**
|
25194
25227
|
* @author Mat Groves http://matgroves.com/ @Doormat23
|
25195
25228
|
* @author Richard Davey <rich@photonstorm.com>
|
25196
|
-
* @copyright
|
25229
|
+
* @copyright 2016 Photon Storm Ltd.
|
25197
25230
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
25198
25231
|
*/
|
25199
25232
|
|
@@ -25582,7 +25615,7 @@ PIXI.identityMatrix = Phaser.identityMatrix;
|
|
25582
25615
|
|
25583
25616
|
/**
|
25584
25617
|
* @author Richard Davey <rich@photonstorm.com>
|
25585
|
-
* @copyright
|
25618
|
+
* @copyright 2016 Photon Storm Ltd.
|
25586
25619
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
25587
25620
|
*/
|
25588
25621
|
|
@@ -26490,7 +26523,7 @@ PIXI.Point = Phaser.Point;
|
|
26490
26523
|
/**
|
26491
26524
|
* @author Richard Davey <rich@photonstorm.com>
|
26492
26525
|
* @author Adrien Brault <adrien.brault@gmail.com>
|
26493
|
-
* @copyright
|
26526
|
+
* @copyright 2016 Photon Storm Ltd.
|
26494
26527
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
26495
26528
|
*/
|
26496
26529
|
|
@@ -26652,6 +26685,7 @@ Phaser.Polygon.prototype = {
|
|
26652
26685
|
* - An array of Point objects: `[new Phaser.Point(x1, y1), ...]`
|
26653
26686
|
* - An array of objects with public x/y properties: `[obj1, obj2, ...]`
|
26654
26687
|
* - An array of paired numbers that represent point coordinates: `[x1,y1, x2,y2, ...]`
|
26688
|
+
* - An array of arrays with two elements representing x/y coordinates: `[[x1, y1], [x2, y2], ...]`
|
26655
26689
|
* - As separate Point arguments: `setTo(new Phaser.Point(x1, y1), ...)`
|
26656
26690
|
* - As separate objects with public x/y properties arguments: `setTo(obj1, obj2, ...)`
|
26657
26691
|
* - As separate arguments representing point coordinates: `setTo(x1,y1, x2,y2, ...)`
|
@@ -26685,6 +26719,10 @@ Phaser.Polygon.prototype = {
|
|
26685
26719
|
var p = new PIXI.Point(points[i], points[i + 1]);
|
26686
26720
|
i++;
|
26687
26721
|
}
|
26722
|
+
else if (Array.isArray(points[i]))
|
26723
|
+
{
|
26724
|
+
var p = new PIXI.Point(points[i][0], points[i][1]);
|
26725
|
+
}
|
26688
26726
|
else
|
26689
26727
|
{
|
26690
26728
|
var p = new PIXI.Point(points[i].x, points[i].y);
|
@@ -26783,7 +26821,7 @@ PIXI.Polygon = Phaser.Polygon;
|
|
26783
26821
|
|
26784
26822
|
/**
|
26785
26823
|
* @author Richard Davey <rich@photonstorm.com>
|
26786
|
-
* @copyright
|
26824
|
+
* @copyright 2016 Photon Storm Ltd.
|
26787
26825
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
26788
26826
|
*/
|
26789
26827
|
|
@@ -27791,7 +27829,7 @@ PIXI.EmptyRectangle = new Phaser.Rectangle(0, 0, 0, 0);
|
|
27791
27829
|
/**
|
27792
27830
|
* @author Mat Groves http://matgroves.com/
|
27793
27831
|
* @author Richard Davey <rich@photonstorm.com>
|
27794
|
-
* @copyright
|
27832
|
+
* @copyright 2016 Photon Storm Ltd.
|
27795
27833
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
27796
27834
|
*/
|
27797
27835
|
|
@@ -27902,7 +27940,7 @@ PIXI.RoundedRectangle = Phaser.RoundedRectangle;
|
|
27902
27940
|
|
27903
27941
|
/**
|
27904
27942
|
* @author Richard Davey <rich@photonstorm.com>
|
27905
|
-
* @copyright
|
27943
|
+
* @copyright 2016 Photon Storm Ltd.
|
27906
27944
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
27907
27945
|
*/
|
27908
27946
|
|
@@ -27984,12 +28022,12 @@ Phaser.Camera = function (game, id, x, y, width, height) {
|
|
27984
28022
|
this.target = null;
|
27985
28023
|
|
27986
28024
|
/**
|
27987
|
-
* @property {PIXI.DisplayObject} displayObject - The display object to which all game objects are added. Set by World.boot
|
28025
|
+
* @property {PIXI.DisplayObject} displayObject - The display object to which all game objects are added. Set by World.boot.
|
27988
28026
|
*/
|
27989
28027
|
this.displayObject = null;
|
27990
28028
|
|
27991
28029
|
/**
|
27992
|
-
* @property {Phaser.Point} scale - The scale of the display object to which all game objects are added. Set by World.boot
|
28030
|
+
* @property {Phaser.Point} scale - The scale of the display object to which all game objects are added. Set by World.boot.
|
27993
28031
|
*/
|
27994
28032
|
this.scale = null;
|
27995
28033
|
|
@@ -28000,7 +28038,44 @@ Phaser.Camera = function (game, id, x, y, width, height) {
|
|
28000
28038
|
this.totalInView = 0;
|
28001
28039
|
|
28002
28040
|
/**
|
28003
|
-
*
|
28041
|
+
* The linear interpolation value to use when following a target.
|
28042
|
+
* The default values of 1 means the camera will instantly snap to the target coordinates.
|
28043
|
+
* A lower value, such as 0.1 means the camera will more slowly track the target, giving
|
28044
|
+
* a smooth transition. You can set the horizontal and vertical values independently, and also
|
28045
|
+
* adjust this value in real-time during your game.
|
28046
|
+
* @property {Phaser.Point} lerp
|
28047
|
+
* @default
|
28048
|
+
*/
|
28049
|
+
this.lerp = new Phaser.Point(1, 1);
|
28050
|
+
|
28051
|
+
/**
|
28052
|
+
* @property {Phaser.Signal} onShakeComplete - This signal is dispatched when the camera shake effect completes.
|
28053
|
+
*/
|
28054
|
+
this.onShakeComplete = new Phaser.Signal();
|
28055
|
+
|
28056
|
+
/**
|
28057
|
+
* @property {Phaser.Signal} onFlashComplete - This signal is dispatched when the camera flash effect completes.
|
28058
|
+
*/
|
28059
|
+
this.onFlashComplete = new Phaser.Signal();
|
28060
|
+
|
28061
|
+
/**
|
28062
|
+
* This signal is dispatched when the camera fade effect completes.
|
28063
|
+
* When the fade effect completes you will be left with the screen black (or whatever
|
28064
|
+
* color you faded to). In order to reset this call `Camera.resetFX`. This is called
|
28065
|
+
* automatically when you change State.
|
28066
|
+
* @property {Phaser.Signal} onFadeComplete
|
28067
|
+
*/
|
28068
|
+
this.onFadeComplete = new Phaser.Signal();
|
28069
|
+
|
28070
|
+
/**
|
28071
|
+
* The Graphics object used to handle camera fx such as fade and flash.
|
28072
|
+
* @property {Phaser.Graphics} fx
|
28073
|
+
* @protected
|
28074
|
+
*/
|
28075
|
+
this.fx = null;
|
28076
|
+
|
28077
|
+
/**
|
28078
|
+
* @property {Phaser.Point} _targetPosition - Internal point used to calculate target position.
|
28004
28079
|
* @private
|
28005
28080
|
*/
|
28006
28081
|
this._targetPosition = new Phaser.Point();
|
@@ -28019,6 +28094,32 @@ Phaser.Camera = function (game, id, x, y, width, height) {
|
|
28019
28094
|
*/
|
28020
28095
|
this._position = new Phaser.Point();
|
28021
28096
|
|
28097
|
+
/**
|
28098
|
+
* @property {Object} _shake - The shake effect container.
|
28099
|
+
* @private
|
28100
|
+
*/
|
28101
|
+
this._shake = {
|
28102
|
+
intensity: 0,
|
28103
|
+
duration: 0,
|
28104
|
+
horizontal: false,
|
28105
|
+
vertical: false,
|
28106
|
+
shakeBounds: true,
|
28107
|
+
x: 0,
|
28108
|
+
y: 0
|
28109
|
+
};
|
28110
|
+
|
28111
|
+
/**
|
28112
|
+
* @property {number} _fxDuration - FX duration timer.
|
28113
|
+
* @private
|
28114
|
+
*/
|
28115
|
+
this._fxDuration = 0;
|
28116
|
+
|
28117
|
+
/**
|
28118
|
+
* @property {number} _fxType - The FX type running.
|
28119
|
+
* @private
|
28120
|
+
*/
|
28121
|
+
this._fxType = 0;
|
28122
|
+
|
28022
28123
|
};
|
28023
28124
|
|
28024
28125
|
/**
|
@@ -28045,8 +28146,55 @@ Phaser.Camera.FOLLOW_TOPDOWN = 2;
|
|
28045
28146
|
*/
|
28046
28147
|
Phaser.Camera.FOLLOW_TOPDOWN_TIGHT = 3;
|
28047
28148
|
|
28149
|
+
/**
|
28150
|
+
* @constant
|
28151
|
+
* @type {number}
|
28152
|
+
*/
|
28153
|
+
Phaser.Camera.SHAKE_BOTH = 4;
|
28154
|
+
|
28155
|
+
/**
|
28156
|
+
* @constant
|
28157
|
+
* @type {number}
|
28158
|
+
*/
|
28159
|
+
Phaser.Camera.SHAKE_HORIZONTAL = 5;
|
28160
|
+
|
28161
|
+
/**
|
28162
|
+
* @constant
|
28163
|
+
* @type {number}
|
28164
|
+
*/
|
28165
|
+
Phaser.Camera.SHAKE_VERTICAL = 6;
|
28166
|
+
|
28167
|
+
/**
|
28168
|
+
* @constant
|
28169
|
+
* @type {boolean}
|
28170
|
+
*/
|
28171
|
+
Phaser.Camera.ENABLE_FX = true;
|
28172
|
+
|
28048
28173
|
Phaser.Camera.prototype = {
|
28049
28174
|
|
28175
|
+
/**
|
28176
|
+
* Called automatically by Phaser.World.
|
28177
|
+
*
|
28178
|
+
* @method Phaser.Camera#boot
|
28179
|
+
* @private
|
28180
|
+
*/
|
28181
|
+
boot: function () {
|
28182
|
+
|
28183
|
+
this.displayObject = this.game.world;
|
28184
|
+
|
28185
|
+
this.scale = this.game.world.scale;
|
28186
|
+
|
28187
|
+
this.game.camera = this;
|
28188
|
+
|
28189
|
+
if (Phaser.Graphics && Phaser.Camera.ENABLE_FX)
|
28190
|
+
{
|
28191
|
+
this.fx = new Phaser.Graphics(this.game);
|
28192
|
+
|
28193
|
+
this.game.stage.addChild(this.fx);
|
28194
|
+
}
|
28195
|
+
|
28196
|
+
},
|
28197
|
+
|
28050
28198
|
/**
|
28051
28199
|
* Camera preUpdate. Sets the total view counter to zero.
|
28052
28200
|
*
|
@@ -28060,6 +28208,9 @@ Phaser.Camera.prototype = {
|
|
28060
28208
|
|
28061
28209
|
/**
|
28062
28210
|
* Tell the camera which sprite to follow.
|
28211
|
+
*
|
28212
|
+
* You can set the follow type and a linear interpolation value.
|
28213
|
+
* Use low lerp values (such as 0.1) to automatically smooth the camera motion.
|
28063
28214
|
*
|
28064
28215
|
* If you find you're getting a slight "jitter" effect when following a Sprite it's probably to do with sub-pixel rendering of the Sprite position.
|
28065
28216
|
* This can be disabled by setting `game.renderer.renderSession.roundPixels = true` to force full pixel rendering.
|
@@ -28067,12 +28218,17 @@ Phaser.Camera.prototype = {
|
|
28067
28218
|
* @method Phaser.Camera#follow
|
28068
28219
|
* @param {Phaser.Sprite|Phaser.Image|Phaser.Text} target - The object you want the camera to track. Set to null to not follow anything.
|
28069
28220
|
* @param {number} [style] - Leverage one of the existing "deadzone" presets. If you use a custom deadzone, ignore this parameter and manually specify the deadzone after calling follow().
|
28221
|
+
* @param {float} [lerpX=1] - A value between 0 and 1. This value specifies the amount of linear interpolation to use when horizontally tracking the target. The closer the value to 1, the faster the camera will track.
|
28222
|
+
* @param {float} [lerpY=1] - A value between 0 and 1. This value specifies the amount of linear interpolation to use when vertically tracking the target. The closer the value to 1, the faster the camera will track.
|
28070
28223
|
*/
|
28071
|
-
follow: function (target, style) {
|
28224
|
+
follow: function (target, style, lerpX, lerpY) {
|
28072
28225
|
|
28073
28226
|
if (style === undefined) { style = Phaser.Camera.FOLLOW_LOCKON; }
|
28227
|
+
if (lerpX === undefined) { lerpX = 1; }
|
28228
|
+
if (lerpY === undefined) { lerpY = 1; }
|
28074
28229
|
|
28075
28230
|
this.target = target;
|
28231
|
+
this.lerp.set(lerpX, lerpY);
|
28076
28232
|
|
28077
28233
|
var helper;
|
28078
28234
|
|
@@ -28140,16 +28296,156 @@ Phaser.Camera.prototype = {
|
|
28140
28296
|
},
|
28141
28297
|
|
28142
28298
|
/**
|
28143
|
-
*
|
28299
|
+
* This creates a camera shake effect. It works by applying a random amount of additional
|
28300
|
+
* spacing on the x and y axis each frame. You can control the intensity and duration
|
28301
|
+
* of the effect, and if it should effect both axis or just one.
|
28302
|
+
*
|
28303
|
+
* When the shake effect ends the signal Camera.onShakeComplete is dispatched.
|
28304
|
+
*
|
28305
|
+
* @method Phaser.Camera#shake
|
28306
|
+
* @param {float} [intensity=0.05] - The intensity of the camera shake. Given as a percentage of the camera size representing the maximum distance that the camera can move while shaking.
|
28307
|
+
* @param {number} [duration=500] - The duration of the shake effect in milliseconds.
|
28308
|
+
* @param {boolean} [force=true] - If a camera shake effect is already running and force is true it will replace the previous effect, resetting the duration.
|
28309
|
+
* @param {number} [direction=Phaser.Camera.SHAKE_BOTH] - The directions in which the camera can shake. Either Phaser.Camera.SHAKE_BOTH, Phaser.Camera.SHAKE_HORIZONTAL or Phaser.Camera.SHAKE_VERTICAL.
|
28310
|
+
* @param {boolean} [shakeBounds=true] - Is the effect allowed to shake the camera beyond its bounds (if set?).
|
28311
|
+
* @return {boolean} True if the shake effect was started, otherwise false.
|
28312
|
+
*/
|
28313
|
+
shake: function (intensity, duration, force, direction, shakeBounds) {
|
28314
|
+
|
28315
|
+
if (intensity === undefined) { intensity = 0.05; }
|
28316
|
+
if (duration === undefined) { duration = 500; }
|
28317
|
+
if (force === undefined) { force = true; }
|
28318
|
+
if (direction === undefined) { direction = Phaser.Camera.SHAKE_BOTH; }
|
28319
|
+
if (shakeBounds === undefined) { shakeBounds = true; }
|
28320
|
+
|
28321
|
+
if (!force && this._shake.duration > 0)
|
28322
|
+
{
|
28323
|
+
// Can't reset an already running shake
|
28324
|
+
return false;
|
28325
|
+
}
|
28326
|
+
|
28327
|
+
this._shake.intensity = intensity;
|
28328
|
+
this._shake.duration = duration;
|
28329
|
+
this._shake.shakeBounds = shakeBounds;
|
28330
|
+
|
28331
|
+
this._shake.x = 0;
|
28332
|
+
this._shake.y = 0;
|
28333
|
+
|
28334
|
+
this._shake.horizontal = (direction === Phaser.Camera.SHAKE_BOTH || direction === Phaser.Camera.SHAKE_HORIZONTAL);
|
28335
|
+
this._shake.vertical = (direction === Phaser.Camera.SHAKE_BOTH || direction === Phaser.Camera.SHAKE_VERTICAL);
|
28336
|
+
|
28337
|
+
return true;
|
28338
|
+
|
28339
|
+
},
|
28340
|
+
|
28341
|
+
/**
|
28342
|
+
* This creates a camera flash effect. It works by filling the game with the solid fill
|
28343
|
+
* color specified, and then fading it away to alpha 0 over the duration given.
|
28344
|
+
*
|
28345
|
+
* You can use this for things such as hit feedback effects.
|
28346
|
+
*
|
28347
|
+
* When the effect ends the signal Camera.onFlashComplete is dispatched.
|
28348
|
+
*
|
28349
|
+
* @method Phaser.Camera#flash
|
28350
|
+
* @param {numer} [color=0xffffff] - The color of the flash effect. I.e. 0xffffff for white, 0xff0000 for red, etc.
|
28351
|
+
* @param {number} [duration=500] - The duration of the flash effect in milliseconds.
|
28352
|
+
* @param {boolean} [force=false] - If a camera flash or fade effect is already running and force is true it will replace the previous effect, resetting the duration.
|
28353
|
+
* @return {boolean} True if the effect was started, otherwise false.
|
28354
|
+
*/
|
28355
|
+
flash: function (color, duration, force) {
|
28356
|
+
|
28357
|
+
if (color === undefined) { color = 0xffffff; }
|
28358
|
+
if (duration === undefined) { duration = 500; }
|
28359
|
+
if (force === undefined) { force = false; }
|
28360
|
+
|
28361
|
+
if (!this.fx || (!force && this._fxDuration > 0))
|
28362
|
+
{
|
28363
|
+
return false;
|
28364
|
+
}
|
28365
|
+
|
28366
|
+
this.fx.clear();
|
28367
|
+
|
28368
|
+
this.fx.beginFill(color);
|
28369
|
+
this.fx.drawRect(0, 0, this.width, this.height);
|
28370
|
+
this.fx.endFill();
|
28371
|
+
|
28372
|
+
this.fx.alpha = 1;
|
28373
|
+
|
28374
|
+
this._fxDuration = duration;
|
28375
|
+
this._fxType = 0;
|
28376
|
+
|
28377
|
+
return true;
|
28378
|
+
|
28379
|
+
},
|
28380
|
+
|
28381
|
+
/**
|
28382
|
+
* This creates a camera fade effect. It works by filling the game with the
|
28383
|
+
* color specified, over the duration given, ending with a solid fill.
|
28384
|
+
*
|
28385
|
+
* You can use this for things such as transitioning to a new scene.
|
28386
|
+
*
|
28387
|
+
* The game will be left 'filled' at the end of this effect, likely obscuring
|
28388
|
+
* everything. In order to reset it you can call `Camera.resetFX` and it will clear the
|
28389
|
+
* fade. Or you can call `Camera.flash` with the same color as the fade, and it will
|
28390
|
+
* reverse the process, bringing the game back into view again.
|
28391
|
+
*
|
28392
|
+
* When the effect ends the signal Camera.onFadeComplete is dispatched.
|
28393
|
+
*
|
28394
|
+
* @method Phaser.Camera#fade
|
28395
|
+
* @param {numer} [color=0x000000] - The color the game will fade to. I.e. 0x000000 for black, 0xff0000 for red, etc.
|
28396
|
+
* @param {number} [duration=500] - The duration of the fade in milliseconds.
|
28397
|
+
* @param {boolean} [force=false] - If a camera flash or fade effect is already running and force is true it will replace the previous effect, resetting the duration.
|
28398
|
+
* @return {boolean} True if the effect was started, otherwise false.
|
28399
|
+
*/
|
28400
|
+
fade: function (color, duration, force) {
|
28401
|
+
|
28402
|
+
if (color === undefined) { color = 0x000000; }
|
28403
|
+
if (duration === undefined) { duration = 500; }
|
28404
|
+
if (force === undefined) { force = false; }
|
28405
|
+
|
28406
|
+
if (!this.fx || (!force && this._fxDuration > 0))
|
28407
|
+
{
|
28408
|
+
return false;
|
28409
|
+
}
|
28410
|
+
|
28411
|
+
this.fx.clear();
|
28412
|
+
|
28413
|
+
this.fx.beginFill(color);
|
28414
|
+
this.fx.drawRect(0, 0, this.width, this.height);
|
28415
|
+
this.fx.endFill();
|
28416
|
+
|
28417
|
+
this.fx.alpha = 0;
|
28418
|
+
|
28419
|
+
this._fxDuration = duration;
|
28420
|
+
this._fxType = 1;
|
28421
|
+
|
28422
|
+
return true;
|
28423
|
+
|
28424
|
+
},
|
28425
|
+
|
28426
|
+
/**
|
28427
|
+
* The camera update loop. This is called automatically by the core game loop.
|
28428
|
+
*
|
28144
28429
|
* @method Phaser.Camera#update
|
28430
|
+
* @protected
|
28145
28431
|
*/
|
28146
28432
|
update: function () {
|
28147
28433
|
|
28434
|
+
if (this._fxDuration > 0)
|
28435
|
+
{
|
28436
|
+
this.updateFX();
|
28437
|
+
}
|
28438
|
+
|
28148
28439
|
if (this.target)
|
28149
28440
|
{
|
28150
28441
|
this.updateTarget();
|
28151
28442
|
}
|
28152
28443
|
|
28444
|
+
if (this._shake.duration > 0)
|
28445
|
+
{
|
28446
|
+
this.updateShake();
|
28447
|
+
}
|
28448
|
+
|
28153
28449
|
if (this.bounds)
|
28154
28450
|
{
|
28155
28451
|
this.checkBounds();
|
@@ -28158,61 +28454,128 @@ Phaser.Camera.prototype = {
|
|
28158
28454
|
if (this.roundPx)
|
28159
28455
|
{
|
28160
28456
|
this.view.floor();
|
28457
|
+
this._shake.x = Math.floor(this._shake.x);
|
28458
|
+
this._shake.y = Math.floor(this._shake.y);
|
28161
28459
|
}
|
28162
28460
|
|
28461
|
+
// this.displayObject.position.x = -(this.view.x + this._shake.x);
|
28462
|
+
// this.displayObject.position.y = -(this.view.y + this._shake.y);
|
28163
28463
|
this.displayObject.position.x = -this.view.x;
|
28164
28464
|
this.displayObject.position.y = -this.view.y;
|
28165
28465
|
|
28166
28466
|
},
|
28167
28467
|
|
28168
28468
|
/**
|
28169
|
-
*
|
28170
|
-
*
|
28469
|
+
* Update the camera flash and fade effects.
|
28470
|
+
*
|
28471
|
+
* @method Phaser.Camera#updateFX
|
28171
28472
|
* @private
|
28172
28473
|
*/
|
28173
|
-
|
28474
|
+
updateFX: function () {
|
28174
28475
|
|
28175
|
-
|
28476
|
+
if (this._fxType === 0)
|
28477
|
+
{
|
28478
|
+
// flash
|
28479
|
+
this.fx.alpha -= this.game.time.elapsedMS / this._fxDuration;
|
28176
28480
|
|
28177
|
-
|
28481
|
+
if (this.fx.alpha <= 0)
|
28482
|
+
{
|
28483
|
+
this._fxDuration = 0;
|
28484
|
+
this.fx.alpha = 0;
|
28485
|
+
this.onFlashComplete.dispatch();
|
28486
|
+
}
|
28487
|
+
}
|
28488
|
+
else
|
28178
28489
|
{
|
28179
|
-
|
28490
|
+
// fade
|
28491
|
+
this.fx.alpha += this.game.time.elapsedMS / this._fxDuration;
|
28492
|
+
|
28493
|
+
if (this.fx.alpha >= 1)
|
28494
|
+
{
|
28495
|
+
this._fxDuration = 0;
|
28496
|
+
this.fx.alpha = 1;
|
28497
|
+
this.onFadeComplete.dispatch();
|
28498
|
+
}
|
28180
28499
|
}
|
28181
28500
|
|
28501
|
+
},
|
28502
|
+
|
28503
|
+
/**
|
28504
|
+
* Update the camera shake effect.
|
28505
|
+
*
|
28506
|
+
* @method Phaser.Camera#updateShake
|
28507
|
+
* @private
|
28508
|
+
*/
|
28509
|
+
updateShake: function () {
|
28510
|
+
|
28511
|
+
this._shake.duration -= this.game.time.elapsedMS;
|
28512
|
+
|
28513
|
+
if (this._shake.duration <= 0)
|
28514
|
+
{
|
28515
|
+
this.onShakeComplete.dispatch();
|
28516
|
+
this._shake.x = 0;
|
28517
|
+
this._shake.y = 0;
|
28518
|
+
}
|
28519
|
+
else
|
28520
|
+
{
|
28521
|
+
if (this._shake.horizontal)
|
28522
|
+
{
|
28523
|
+
this._shake.x = this.game.rnd.frac() * this._shake.intensity * this.view.width * 2 - this._shake.intensity * this.view.width;
|
28524
|
+
}
|
28525
|
+
|
28526
|
+
if (this._shake.vertical)
|
28527
|
+
{
|
28528
|
+
this._shake.y = this.game.rnd.frac() * this._shake.intensity * this.view.height * 2 - this._shake.intensity * this.view.height;
|
28529
|
+
}
|
28530
|
+
}
|
28531
|
+
|
28532
|
+
},
|
28533
|
+
|
28534
|
+
/**
|
28535
|
+
* Internal method that handles tracking a sprite.
|
28536
|
+
*
|
28537
|
+
* @method Phaser.Camera#updateTarget
|
28538
|
+
* @private
|
28539
|
+
*/
|
28540
|
+
updateTarget: function () {
|
28541
|
+
|
28542
|
+
this._targetPosition.copyFrom(this.target.world);
|
28543
|
+
|
28182
28544
|
if (this.deadzone)
|
28183
28545
|
{
|
28184
28546
|
this._edge = this._targetPosition.x - this.view.x;
|
28185
28547
|
|
28186
28548
|
if (this._edge < this.deadzone.left)
|
28187
28549
|
{
|
28188
|
-
this.view.x = this._targetPosition.x - this.deadzone.left;
|
28550
|
+
this.view.x = this.game.math.linear(this.view.x, this._targetPosition.x - this.deadzone.left, this.lerp.x);
|
28189
28551
|
}
|
28190
28552
|
else if (this._edge > this.deadzone.right)
|
28191
28553
|
{
|
28192
|
-
this.view.x = this._targetPosition.x - this.deadzone.right;
|
28554
|
+
this.view.x = this.game.math.linear(this.view.x, this._targetPosition.x - this.deadzone.right, this.lerp.x);
|
28193
28555
|
}
|
28194
28556
|
|
28195
28557
|
this._edge = this._targetPosition.y - this.view.y;
|
28196
28558
|
|
28197
28559
|
if (this._edge < this.deadzone.top)
|
28198
28560
|
{
|
28199
|
-
this.view.y = this._targetPosition.y - this.deadzone.top;
|
28561
|
+
this.view.y = this.game.math.linear(this.view.y, this._targetPosition.y - this.deadzone.top, this.lerp.y);
|
28200
28562
|
}
|
28201
28563
|
else if (this._edge > this.deadzone.bottom)
|
28202
28564
|
{
|
28203
|
-
this.view.y = this._targetPosition.y - this.deadzone.bottom;
|
28565
|
+
this.view.y = this.game.math.linear(this.view.y, this._targetPosition.y - this.deadzone.bottom, this.lerp.y);
|
28204
28566
|
}
|
28205
28567
|
}
|
28206
28568
|
else
|
28207
28569
|
{
|
28208
|
-
this.view.x = this._targetPosition.x - this.view.halfWidth;
|
28209
|
-
this.view.y = this._targetPosition.y - this.view.halfHeight;
|
28570
|
+
this.view.x = this.game.math.linear(this.view.x, this._targetPosition.x - this.view.halfWidth, this.lerp.x);
|
28571
|
+
this.view.y = this.game.math.linear(this.view.y, this._targetPosition.y - this.view.halfHeight, this.lerp.y);
|
28210
28572
|
}
|
28211
28573
|
|
28212
28574
|
},
|
28213
28575
|
|
28214
28576
|
/**
|
28215
28577
|
* Update the Camera bounds to match the game world.
|
28578
|
+
*
|
28216
28579
|
* @method Phaser.Camera#setBoundsToWorld
|
28217
28580
|
*/
|
28218
28581
|
setBoundsToWorld: function () {
|
@@ -28226,36 +28589,68 @@ Phaser.Camera.prototype = {
|
|
28226
28589
|
|
28227
28590
|
/**
|
28228
28591
|
* Method called to ensure the camera doesn't venture outside of the game world.
|
28592
|
+
* Called automatically by Camera.update.
|
28593
|
+
*
|
28229
28594
|
* @method Phaser.Camera#checkBounds
|
28595
|
+
* @protected
|
28230
28596
|
*/
|
28231
28597
|
checkBounds: function () {
|
28232
28598
|
|
28233
28599
|
this.atLimit.x = false;
|
28234
28600
|
this.atLimit.y = false;
|
28235
28601
|
|
28602
|
+
var vx = this.view.x + this._shake.x;
|
28603
|
+
var vw = this.view.right + this._shake.x;
|
28604
|
+
var vy = this.view.y + this._shake.y;
|
28605
|
+
var vh = this.view.bottom + this._shake.y;
|
28606
|
+
|
28236
28607
|
// Make sure we didn't go outside the cameras bounds
|
28237
|
-
if (
|
28608
|
+
if (vx <= this.bounds.x * this.scale.x)
|
28238
28609
|
{
|
28239
28610
|
this.atLimit.x = true;
|
28240
28611
|
this.view.x = this.bounds.x * this.scale.x;
|
28612
|
+
|
28613
|
+
if (!this._shake.shakeBounds)
|
28614
|
+
{
|
28615
|
+
// The camera is up against the bounds, so reset the shake
|
28616
|
+
this._shake.x = 0;
|
28617
|
+
}
|
28241
28618
|
}
|
28242
28619
|
|
28243
|
-
if (
|
28620
|
+
if (vw >= this.bounds.right * this.scale.x)
|
28244
28621
|
{
|
28245
28622
|
this.atLimit.x = true;
|
28246
28623
|
this.view.x = (this.bounds.right * this.scale.x) - this.width;
|
28624
|
+
|
28625
|
+
if (!this._shake.shakeBounds)
|
28626
|
+
{
|
28627
|
+
// The camera is up against the bounds, so reset the shake
|
28628
|
+
this._shake.x = 0;
|
28629
|
+
}
|
28247
28630
|
}
|
28248
28631
|
|
28249
|
-
if (
|
28632
|
+
if (vy <= this.bounds.top * this.scale.y)
|
28250
28633
|
{
|
28251
28634
|
this.atLimit.y = true;
|
28252
28635
|
this.view.y = this.bounds.top * this.scale.y;
|
28636
|
+
|
28637
|
+
if (!this._shake.shakeBounds)
|
28638
|
+
{
|
28639
|
+
// The camera is up against the bounds, so reset the shake
|
28640
|
+
this._shake.y = 0;
|
28641
|
+
}
|
28253
28642
|
}
|
28254
28643
|
|
28255
|
-
if (
|
28644
|
+
if (vh >= this.bounds.bottom * this.scale.y)
|
28256
28645
|
{
|
28257
28646
|
this.atLimit.y = true;
|
28258
28647
|
this.view.y = (this.bounds.bottom * this.scale.y) - this.height;
|
28648
|
+
|
28649
|
+
if (!this._shake.shakeBounds)
|
28650
|
+
{
|
28651
|
+
// The camera is up against the bounds, so reset the shake
|
28652
|
+
this._shake.y = 0;
|
28653
|
+
}
|
28259
28654
|
}
|
28260
28655
|
|
28261
28656
|
},
|
@@ -28296,15 +28691,38 @@ Phaser.Camera.prototype = {
|
|
28296
28691
|
|
28297
28692
|
/**
|
28298
28693
|
* Resets the camera back to 0,0 and un-follows any object it may have been tracking.
|
28694
|
+
* Also immediately resets any camera effects that may have been running such as
|
28695
|
+
* shake, flash or fade.
|
28299
28696
|
*
|
28300
28697
|
* @method Phaser.Camera#reset
|
28301
28698
|
*/
|
28302
28699
|
reset: function () {
|
28303
28700
|
|
28304
28701
|
this.target = null;
|
28702
|
+
|
28305
28703
|
this.view.x = 0;
|
28306
28704
|
this.view.y = 0;
|
28307
28705
|
|
28706
|
+
this._shake.duration = 0;
|
28707
|
+
|
28708
|
+
this.resetFX();
|
28709
|
+
|
28710
|
+
},
|
28711
|
+
|
28712
|
+
/**
|
28713
|
+
* Resets any active FX, such as a fade or flash and immediately clears it.
|
28714
|
+
* Useful to calling after a fade in order to remove the fade from the Stage.
|
28715
|
+
*
|
28716
|
+
* @method Phaser.Camera#resetFX
|
28717
|
+
*/
|
28718
|
+
resetFX: function () {
|
28719
|
+
|
28720
|
+
this.fx.clear();
|
28721
|
+
|
28722
|
+
this.fx.alpha = 0;
|
28723
|
+
|
28724
|
+
this._fxDuration = 0;
|
28725
|
+
|
28308
28726
|
}
|
28309
28727
|
|
28310
28728
|
};
|
@@ -28319,7 +28737,9 @@ Phaser.Camera.prototype.constructor = Phaser.Camera;
|
|
28319
28737
|
Object.defineProperty(Phaser.Camera.prototype, "x", {
|
28320
28738
|
|
28321
28739
|
get: function () {
|
28740
|
+
|
28322
28741
|
return this.view.x;
|
28742
|
+
|
28323
28743
|
},
|
28324
28744
|
|
28325
28745
|
set: function (value) {
|
@@ -28342,7 +28762,9 @@ Object.defineProperty(Phaser.Camera.prototype, "x", {
|
|
28342
28762
|
Object.defineProperty(Phaser.Camera.prototype, "y", {
|
28343
28763
|
|
28344
28764
|
get: function () {
|
28765
|
+
|
28345
28766
|
return this.view.y;
|
28767
|
+
|
28346
28768
|
},
|
28347
28769
|
|
28348
28770
|
set: function (value) {
|
@@ -28365,8 +28787,11 @@ Object.defineProperty(Phaser.Camera.prototype, "y", {
|
|
28365
28787
|
Object.defineProperty(Phaser.Camera.prototype, "position", {
|
28366
28788
|
|
28367
28789
|
get: function () {
|
28368
|
-
|
28790
|
+
|
28791
|
+
this._position.set(this.view.x, this.view.y);
|
28792
|
+
|
28369
28793
|
return this._position;
|
28794
|
+
|
28370
28795
|
},
|
28371
28796
|
|
28372
28797
|
set: function (value) {
|
@@ -28390,11 +28815,15 @@ Object.defineProperty(Phaser.Camera.prototype, "position", {
|
|
28390
28815
|
Object.defineProperty(Phaser.Camera.prototype, "width", {
|
28391
28816
|
|
28392
28817
|
get: function () {
|
28818
|
+
|
28393
28819
|
return this.view.width;
|
28820
|
+
|
28394
28821
|
},
|
28395
28822
|
|
28396
28823
|
set: function (value) {
|
28824
|
+
|
28397
28825
|
this.view.width = value;
|
28826
|
+
|
28398
28827
|
}
|
28399
28828
|
|
28400
28829
|
});
|
@@ -28407,18 +28836,22 @@ Object.defineProperty(Phaser.Camera.prototype, "width", {
|
|
28407
28836
|
Object.defineProperty(Phaser.Camera.prototype, "height", {
|
28408
28837
|
|
28409
28838
|
get: function () {
|
28839
|
+
|
28410
28840
|
return this.view.height;
|
28841
|
+
|
28411
28842
|
},
|
28412
28843
|
|
28413
28844
|
set: function (value) {
|
28845
|
+
|
28414
28846
|
this.view.height = value;
|
28847
|
+
|
28415
28848
|
}
|
28416
28849
|
|
28417
28850
|
});
|
28418
28851
|
|
28419
28852
|
/**
|
28420
28853
|
* @author Richard Davey <rich@photonstorm.com>
|
28421
|
-
* @copyright
|
28854
|
+
* @copyright 2016 Photon Storm Ltd.
|
28422
28855
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
28423
28856
|
*/
|
28424
28857
|
|
@@ -28647,7 +29080,7 @@ Phaser.State.prototype.constructor = Phaser.State;
|
|
28647
29080
|
|
28648
29081
|
/**
|
28649
29082
|
* @author Richard Davey <rich@photonstorm.com>
|
28650
|
-
* @copyright
|
29083
|
+
* @copyright 2016 Photon Storm Ltd.
|
28651
29084
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
28652
29085
|
*/
|
28653
29086
|
|
@@ -29438,20 +29871,63 @@ Object.defineProperty(Phaser.StateManager.prototype, "created", {
|
|
29438
29871
|
/**
|
29439
29872
|
* @author Miller Medeiros http://millermedeiros.github.com/js-signals/
|
29440
29873
|
* @author Richard Davey <rich@photonstorm.com>
|
29441
|
-
* @copyright
|
29874
|
+
* @copyright 2016 Photon Storm Ltd.
|
29442
29875
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
29443
29876
|
*/
|
29444
29877
|
|
29445
29878
|
/**
|
29446
|
-
*
|
29879
|
+
* Signals are what Phaser uses to handle events and event dispatching.
|
29880
|
+
* You can listen for a Signal by binding a callback / function to it.
|
29881
|
+
* This is done by using either `Signal.add` or `Signal.addOnce`.
|
29882
|
+
*
|
29883
|
+
* For example you can listen for a touch or click event from the Input Manager
|
29884
|
+
* by using its `onDown` Signal:
|
29885
|
+
*
|
29886
|
+
* `game.input.onDown.add(function() { ... });`
|
29887
|
+
*
|
29888
|
+
* Rather than inline your function, you can pass a reference:
|
29447
29889
|
*
|
29448
|
-
*
|
29890
|
+
* `game.input.onDown.add(clicked, this);`
|
29891
|
+
* `function clicked () { ... }`
|
29892
|
+
*
|
29893
|
+
* In this case the second argument (`this`) is the context in which your function should be called.
|
29894
|
+
*
|
29895
|
+
* Now every time the InputManager dispatches the `onDown` signal (or event), your function
|
29896
|
+
* will be called.
|
29897
|
+
*
|
29898
|
+
* Very often a Signal will send arguments to your function.
|
29899
|
+
* This is specific to the Signal itself.
|
29900
|
+
* If you're unsure then check the documentation, or failing that simply do:
|
29901
|
+
*
|
29902
|
+
* `Signal.add(function() { console.log(arguments); })`
|
29903
|
+
*
|
29904
|
+
* and it will log all of the arguments your function received from the Signal.
|
29905
|
+
*
|
29906
|
+
* Sprites have lots of default signals you can listen to in their Events class, such as:
|
29907
|
+
*
|
29908
|
+
* `sprite.events.onKilled`
|
29449
29909
|
*
|
29910
|
+
* Which is called automatically whenever the Sprite is killed.
|
29911
|
+
* There are lots of other events, see the Events component for a list.
|
29912
|
+
*
|
29913
|
+
* As well as listening to pre-defined Signals you can also create your own:
|
29914
|
+
*
|
29915
|
+
* `var mySignal = new Phaser.Signal();`
|
29916
|
+
*
|
29917
|
+
* This creates a new Signal. You can bind a callback to it:
|
29918
|
+
*
|
29919
|
+
* `mySignal.add(myCallback, this);`
|
29920
|
+
*
|
29921
|
+
* and then finally when ready you can dispatch the Signal:
|
29922
|
+
*
|
29923
|
+
* `mySignal.dispatch(your arguments);`
|
29924
|
+
*
|
29925
|
+
* And your callback will be invoked. See the dispatch method for more details.
|
29926
|
+
*
|
29450
29927
|
* @class Phaser.Signal
|
29451
29928
|
* @constructor
|
29452
29929
|
*/
|
29453
|
-
Phaser.Signal = function () {
|
29454
|
-
};
|
29930
|
+
Phaser.Signal = function () {};
|
29455
29931
|
|
29456
29932
|
Phaser.Signal.prototype = {
|
29457
29933
|
|
@@ -29497,7 +29973,7 @@ Phaser.Signal.prototype = {
|
|
29497
29973
|
* @property {function} _boundDispatch - The bound dispatch function, if any.
|
29498
29974
|
* @private
|
29499
29975
|
*/
|
29500
|
-
_boundDispatch:
|
29976
|
+
_boundDispatch: false,
|
29501
29977
|
|
29502
29978
|
/**
|
29503
29979
|
* @method Phaser.Signal#validateListener
|
@@ -29901,7 +30377,7 @@ Phaser.Signal.prototype.constructor = Phaser.Signal;
|
|
29901
30377
|
/**
|
29902
30378
|
* @author Miller Medeiros http://millermedeiros.github.com/js-signals/
|
29903
30379
|
* @author Richard Davey <rich@photonstorm.com>
|
29904
|
-
* @copyright
|
30380
|
+
* @copyright 2016 Photon Storm Ltd.
|
29905
30381
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
29906
30382
|
*/
|
29907
30383
|
|
@@ -30100,7 +30576,7 @@ Phaser.SignalBinding.prototype.constructor = Phaser.SignalBinding;
|
|
30100
30576
|
|
30101
30577
|
/**
|
30102
30578
|
* @author Richard Davey <rich@photonstorm.com>
|
30103
|
-
* @copyright
|
30579
|
+
* @copyright 2016 Photon Storm Ltd.
|
30104
30580
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
30105
30581
|
*/
|
30106
30582
|
|
@@ -30348,7 +30824,7 @@ Object.defineProperty(Phaser.Filter.prototype, 'height', {
|
|
30348
30824
|
|
30349
30825
|
/**
|
30350
30826
|
* @author Richard Davey <rich@photonstorm.com>
|
30351
|
-
* @copyright
|
30827
|
+
* @copyright 2016 Photon Storm Ltd.
|
30352
30828
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
30353
30829
|
*/
|
30354
30830
|
|
@@ -30473,7 +30949,7 @@ Phaser.Plugin.prototype.constructor = Phaser.Plugin;
|
|
30473
30949
|
|
30474
30950
|
/**
|
30475
30951
|
* @author Richard Davey <rich@photonstorm.com>
|
30476
|
-
* @copyright
|
30952
|
+
* @copyright 2016 Photon Storm Ltd.
|
30477
30953
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
30478
30954
|
*/
|
30479
30955
|
|
@@ -30759,7 +31235,7 @@ Phaser.PluginManager.prototype.constructor = Phaser.PluginManager;
|
|
30759
31235
|
|
30760
31236
|
/**
|
30761
31237
|
* @author Richard Davey <rich@photonstorm.com>
|
30762
|
-
* @copyright
|
31238
|
+
* @copyright 2016 Photon Storm Ltd.
|
30763
31239
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
30764
31240
|
*/
|
30765
31241
|
|
@@ -30930,7 +31406,7 @@ Phaser.Stage.prototype.update = function () {
|
|
30930
31406
|
|
30931
31407
|
/**
|
30932
31408
|
* This is called automatically before the renderer runs and after the plugins have updated.
|
30933
|
-
* In postUpdate this is where all the final physics
|
31409
|
+
* In postUpdate this is where all the final physics calculations and object positioning happens.
|
30934
31410
|
* The objects are processed in the order of the display list.
|
30935
31411
|
* The only exception to this is if the camera is following an object, in which case that is updated first.
|
30936
31412
|
*
|
@@ -31115,7 +31591,7 @@ Phaser.Stage.prototype.setBackgroundColor = function (color) {
|
|
31115
31591
|
*
|
31116
31592
|
* @method Phaser.Stage#destroy
|
31117
31593
|
*/
|
31118
|
-
Phaser.Stage.prototype.destroy
|
31594
|
+
Phaser.Stage.prototype.destroy = function () {
|
31119
31595
|
|
31120
31596
|
if (this._hiddenVar)
|
31121
31597
|
{
|
@@ -31180,7 +31656,7 @@ Object.defineProperty(Phaser.Stage.prototype, "smoothed", {
|
|
31180
31656
|
|
31181
31657
|
/**
|
31182
31658
|
* @author Richard Davey <rich@photonstorm.com>
|
31183
|
-
* @copyright
|
31659
|
+
* @copyright 2016 Photon Storm Ltd.
|
31184
31660
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
31185
31661
|
*/
|
31186
31662
|
|
@@ -31469,7 +31945,7 @@ Phaser.Group.prototype.add = function (child, silent) {
|
|
31469
31945
|
|
31470
31946
|
if (child.parent !== this)
|
31471
31947
|
{
|
31472
|
-
if (child.body && child.parent)
|
31948
|
+
if (child.body && child.parent && child.parent.hash)
|
31473
31949
|
{
|
31474
31950
|
child.parent.removeFromHash(child);
|
31475
31951
|
}
|
@@ -31979,6 +32455,29 @@ Phaser.Group.prototype.getIndex = function (child) {
|
|
31979
32455
|
|
31980
32456
|
};
|
31981
32457
|
|
32458
|
+
/**
|
32459
|
+
* Searches the Group for the first instance of a child with the `name`
|
32460
|
+
* property matching the given argument. Should more than one child have
|
32461
|
+
* the same name only the first instance is returned.
|
32462
|
+
*
|
32463
|
+
* @method Phaser.Group#getByName
|
32464
|
+
* @param {string} name - The name to search for.
|
32465
|
+
* @return {any} The first child with a matching name, or null if none were found.
|
32466
|
+
*/
|
32467
|
+
Phaser.Group.prototype.getByName = function (name) {
|
32468
|
+
|
32469
|
+
for (var i = 0; i < this.children.length; i++)
|
32470
|
+
{
|
32471
|
+
if (this.children[i].name === name)
|
32472
|
+
{
|
32473
|
+
return this.children[i];
|
32474
|
+
}
|
32475
|
+
}
|
32476
|
+
|
32477
|
+
return null;
|
32478
|
+
|
32479
|
+
};
|
32480
|
+
|
31982
32481
|
/**
|
31983
32482
|
* Replaces a child of this group with the given newChild. The newChild cannot be a member of this group.
|
31984
32483
|
*
|
@@ -32593,7 +33092,6 @@ Phaser.Group.prototype.postUpdate = function () {
|
|
32593
33092
|
|
32594
33093
|
};
|
32595
33094
|
|
32596
|
-
|
32597
33095
|
/**
|
32598
33096
|
* Find children matching a certain predicate.
|
32599
33097
|
*
|
@@ -33500,7 +33998,7 @@ Object.defineProperty(Phaser.Group.prototype, "angle", {
|
|
33500
33998
|
|
33501
33999
|
/**
|
33502
34000
|
* @author Richard Davey <rich@photonstorm.com>
|
33503
|
-
* @copyright
|
34001
|
+
* @copyright 2016 Photon Storm Ltd.
|
33504
34002
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
33505
34003
|
*/
|
33506
34004
|
|
@@ -33567,14 +34065,10 @@ Phaser.World.prototype.boot = function () {
|
|
33567
34065
|
|
33568
34066
|
this.camera = new Phaser.Camera(this.game, 0, 0, 0, this.game.width, this.game.height);
|
33569
34067
|
|
33570
|
-
this.camera.displayObject = this;
|
33571
|
-
|
33572
|
-
this.camera.scale = this.scale;
|
33573
|
-
|
33574
|
-
this.game.camera = this.camera;
|
33575
|
-
|
33576
34068
|
this.game.stage.addChild(this);
|
33577
34069
|
|
34070
|
+
this.camera.boot();
|
34071
|
+
|
33578
34072
|
};
|
33579
34073
|
|
33580
34074
|
/**
|
@@ -33676,6 +34170,9 @@ Phaser.World.prototype.shutdown = function () {
|
|
33676
34170
|
* If they do it will reposition the object to the opposite side of the world, creating a wrap-around effect.
|
33677
34171
|
* If sprite has a P2 body then the body (sprite.body) should be passed as first parameter to the function.
|
33678
34172
|
*
|
34173
|
+
* Please understand there are limitations to this method. For example if you have scaled the World
|
34174
|
+
* then objects won't always be re-positioned correctly, and you'll need to employ your own wrapping function.
|
34175
|
+
*
|
33679
34176
|
* @method Phaser.World#wrap
|
33680
34177
|
* @param {Phaser.Sprite|Phaser.Image|Phaser.TileSprite|Phaser.Text} sprite - The object you wish to wrap around the world bounds.
|
33681
34178
|
* @param {number} [padding=0] - Extra padding added equally to the sprite.x and y coordinates before checking if within the world bounds. Ignored if useBounds is true.
|
@@ -33799,7 +34296,7 @@ Object.defineProperty(Phaser.World.prototype, "height", {
|
|
33799
34296
|
Object.defineProperty(Phaser.World.prototype, "centerX", {
|
33800
34297
|
|
33801
34298
|
get: function () {
|
33802
|
-
return this.bounds.halfWidth;
|
34299
|
+
return this.bounds.halfWidth + this.bounds.x;
|
33803
34300
|
}
|
33804
34301
|
|
33805
34302
|
});
|
@@ -33812,7 +34309,7 @@ Object.defineProperty(Phaser.World.prototype, "centerX", {
|
|
33812
34309
|
Object.defineProperty(Phaser.World.prototype, "centerY", {
|
33813
34310
|
|
33814
34311
|
get: function () {
|
33815
|
-
return this.bounds.halfHeight;
|
34312
|
+
return this.bounds.halfHeight + this.bounds.y;
|
33816
34313
|
}
|
33817
34314
|
|
33818
34315
|
});
|
@@ -33863,7 +34360,7 @@ Object.defineProperty(Phaser.World.prototype, "randomY", {
|
|
33863
34360
|
|
33864
34361
|
/**
|
33865
34362
|
* @author Richard Davey <rich@photonstorm.com>
|
33866
|
-
* @copyright
|
34363
|
+
* @copyright 2016 Photon Storm Ltd.
|
33867
34364
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
33868
34365
|
*/
|
33869
34366
|
|
@@ -34240,7 +34737,7 @@ Phaser.Game = function (width, height, renderer, parent, state, transparent, ant
|
|
34240
34737
|
/**
|
34241
34738
|
* @property {boolean} forceSingleUpdate - Should the game loop force a logic update, regardless of the delta timer? Set to true if you know you need this. You can toggle it on the fly.
|
34242
34739
|
*/
|
34243
|
-
this.forceSingleUpdate =
|
34740
|
+
this.forceSingleUpdate = true;
|
34244
34741
|
|
34245
34742
|
/**
|
34246
34743
|
* @property {number} _nextNotification - The soonest game.time.time value that the next fpsProblemNotifier can be dispatched.
|
@@ -34544,7 +35041,14 @@ Phaser.Game.prototype = {
|
|
34544
35041
|
*/
|
34545
35042
|
setUpRenderer: function () {
|
34546
35043
|
|
34547
|
-
|
35044
|
+
if (this.config['canvas'])
|
35045
|
+
{
|
35046
|
+
this.canvas = this.config['canvas'];
|
35047
|
+
}
|
35048
|
+
else
|
35049
|
+
{
|
35050
|
+
this.canvas = Phaser.Canvas.create(this, this.width, this.height, this.config['canvasID'], true);
|
35051
|
+
}
|
34548
35052
|
|
34549
35053
|
if (this.config['canvasStyle'])
|
34550
35054
|
{
|
@@ -34866,23 +35370,29 @@ Phaser.Game.prototype = {
|
|
34866
35370
|
|
34867
35371
|
this.state.destroy();
|
34868
35372
|
this.sound.destroy();
|
34869
|
-
|
34870
35373
|
this.scale.destroy();
|
34871
35374
|
this.stage.destroy();
|
34872
35375
|
this.input.destroy();
|
34873
35376
|
this.physics.destroy();
|
35377
|
+
this.plugins.destroy();
|
34874
35378
|
|
34875
35379
|
this.state = null;
|
34876
|
-
this.cache = null;
|
34877
|
-
this.input = null;
|
34878
|
-
this.load = null;
|
34879
35380
|
this.sound = null;
|
35381
|
+
this.scale = null;
|
34880
35382
|
this.stage = null;
|
35383
|
+
this.input = null;
|
35384
|
+
this.physics = null;
|
35385
|
+
this.plugins = null;
|
35386
|
+
|
35387
|
+
this.cache = null;
|
35388
|
+
this.load = null;
|
34881
35389
|
this.time = null;
|
34882
35390
|
this.world = null;
|
35391
|
+
|
34883
35392
|
this.isBooted = false;
|
34884
35393
|
|
34885
35394
|
this.renderer.destroy(false);
|
35395
|
+
|
34886
35396
|
Phaser.Canvas.removeFromDOM(this.canvas);
|
34887
35397
|
|
34888
35398
|
Phaser.GAMES[this.id] = null;
|
@@ -34902,8 +35412,14 @@ Phaser.Game.prototype = {
|
|
34902
35412
|
if (!this._paused)
|
34903
35413
|
{
|
34904
35414
|
this._paused = true;
|
35415
|
+
|
34905
35416
|
this.time.gamePaused();
|
34906
|
-
|
35417
|
+
|
35418
|
+
if (this.sound.muteOnPause)
|
35419
|
+
{
|
35420
|
+
this.sound.setMute();
|
35421
|
+
}
|
35422
|
+
|
34907
35423
|
this.onPause.dispatch(event);
|
34908
35424
|
|
34909
35425
|
// Avoids Cordova iOS crash event: https://github.com/photonstorm/phaser/issues/1800
|
@@ -34928,9 +35444,16 @@ Phaser.Game.prototype = {
|
|
34928
35444
|
if (this._paused && !this._codePaused)
|
34929
35445
|
{
|
34930
35446
|
this._paused = false;
|
35447
|
+
|
34931
35448
|
this.time.gameResumed();
|
35449
|
+
|
34932
35450
|
this.input.reset();
|
34933
|
-
|
35451
|
+
|
35452
|
+
if (this.sound.muteOnPause)
|
35453
|
+
{
|
35454
|
+
this.sound.unsetMute();
|
35455
|
+
}
|
35456
|
+
|
34934
35457
|
this.onResume.dispatch(event);
|
34935
35458
|
|
34936
35459
|
// Avoids Cordova iOS crash event: https://github.com/photonstorm/phaser/issues/1800
|
@@ -35034,7 +35557,7 @@ Object.defineProperty(Phaser.Game.prototype, "paused", {
|
|
35034
35557
|
|
35035
35558
|
/**
|
35036
35559
|
* @author Richard Davey <rich@photonstorm.com>
|
35037
|
-
* @copyright
|
35560
|
+
* @copyright 2016 Photon Storm Ltd.
|
35038
35561
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
35039
35562
|
*/
|
35040
35563
|
|
@@ -36122,7 +36645,7 @@ Object.defineProperty(Phaser.Input.prototype, "worldY", {
|
|
36122
36645
|
|
36123
36646
|
/**
|
36124
36647
|
* @author Richard Davey <rich@photonstorm.com>
|
36125
|
-
* @copyright
|
36648
|
+
* @copyright 2016 Photon Storm Ltd.
|
36126
36649
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
36127
36650
|
*/
|
36128
36651
|
|
@@ -36130,10 +36653,10 @@ Object.defineProperty(Phaser.Input.prototype, "worldY", {
|
|
36130
36653
|
* The Mouse class is responsible for handling all aspects of mouse interaction with the browser.
|
36131
36654
|
*
|
36132
36655
|
* It captures and processes mouse events that happen on the game canvas object.
|
36133
|
-
* It also adds a single `mouseup` listener to `window` which is used to capture the mouse being released
|
36656
|
+
* It also adds a single `mouseup` listener to `window` which is used to capture the mouse being released
|
36134
36657
|
* when not over the game.
|
36135
36658
|
*
|
36136
|
-
* You should not normally access this class directly, but instead use a Phaser.Pointer object
|
36659
|
+
* You should not normally access this class directly, but instead use a Phaser.Pointer object
|
36137
36660
|
* which normalises all game input for you, including accurate button handling.
|
36138
36661
|
*
|
36139
36662
|
* @class Phaser.Mouse
|
@@ -36507,7 +37030,7 @@ Phaser.Mouse.prototype = {
|
|
36507
37030
|
|
36508
37031
|
/**
|
36509
37032
|
* The internal method that handles the mouse up event from the window.
|
36510
|
-
*
|
37033
|
+
*
|
36511
37034
|
* @method Phaser.Mouse#onMouseUpGlobal
|
36512
37035
|
* @param {MouseEvent} event - The native event from the browser. This gets stored in Mouse.event.
|
36513
37036
|
*/
|
@@ -36529,7 +37052,7 @@ Phaser.Mouse.prototype = {
|
|
36529
37052
|
|
36530
37053
|
/**
|
36531
37054
|
* The internal method that handles the mouse out event from the window.
|
36532
|
-
*
|
37055
|
+
*
|
36533
37056
|
* @method Phaser.Mouse#onMouseOutGlobal
|
36534
37057
|
* @param {MouseEvent} event - The native event from the browser. This gets stored in Mouse.event.
|
36535
37058
|
*/
|
@@ -36554,7 +37077,7 @@ Phaser.Mouse.prototype = {
|
|
36554
37077
|
// the browser opening a context-menu or similar.
|
36555
37078
|
// On OS X Chrome especially this is bad news, as it blocks
|
36556
37079
|
// us then getting a mouseup event, so we need to force that through.
|
36557
|
-
//
|
37080
|
+
//
|
36558
37081
|
// No matter what, we must cancel the left and right buttons
|
36559
37082
|
|
36560
37083
|
this.input.mousePointer.stop(event);
|
@@ -36683,7 +37206,7 @@ Phaser.Mouse.prototype = {
|
|
36683
37206
|
|
36684
37207
|
/**
|
36685
37208
|
* Internal pointerLockChange handler.
|
36686
|
-
*
|
37209
|
+
*
|
36687
37210
|
* @method Phaser.Mouse#pointerLockChange
|
36688
37211
|
* @param {Event} event - The native event from the browser. This gets stored in Mouse.event.
|
36689
37212
|
*/
|
@@ -36744,6 +37267,7 @@ Phaser.Mouse.prototype = {
|
|
36744
37267
|
}
|
36745
37268
|
|
36746
37269
|
window.removeEventListener('mouseup', this._onMouseUpGlobal, true);
|
37270
|
+
window.removeEventListener('mouseout', this._onMouseOutGlobal, true);
|
36747
37271
|
|
36748
37272
|
document.removeEventListener('pointerlockchange', this._pointerLockChange, true);
|
36749
37273
|
document.removeEventListener('mozpointerlockchange', this._pointerLockChange, true);
|
@@ -36841,7 +37365,7 @@ Object.defineProperties(WheelEventProxy.prototype, {
|
|
36841
37365
|
|
36842
37366
|
/**
|
36843
37367
|
* @author Richard Davey <rich@photonstorm.com>
|
36844
|
-
* @copyright
|
37368
|
+
* @copyright 2016 Photon Storm Ltd.
|
36845
37369
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
36846
37370
|
*/
|
36847
37371
|
|
@@ -37293,7 +37817,7 @@ Phaser.MSPointer.prototype.constructor = Phaser.MSPointer;
|
|
37293
37817
|
/**
|
37294
37818
|
* @author Richard Davey <rich@photonstorm.com>
|
37295
37819
|
* @author @karlmacklin <tacklemcclean@gmail.com>
|
37296
|
-
* @copyright
|
37820
|
+
* @copyright 2016 Photon Storm Ltd.
|
37297
37821
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
37298
37822
|
*/
|
37299
37823
|
|
@@ -37614,7 +38138,7 @@ Object.defineProperty(Phaser.DeviceButton.prototype, "duration", {
|
|
37614
38138
|
|
37615
38139
|
/**
|
37616
38140
|
* @author Richard Davey <rich@photonstorm.com>
|
37617
|
-
* @copyright
|
38141
|
+
* @copyright 2016 Photon Storm Ltd.
|
37618
38142
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
37619
38143
|
*/
|
37620
38144
|
|
@@ -38850,7 +39374,7 @@ Phaser.PointerMode = {
|
|
38850
39374
|
|
38851
39375
|
/**
|
38852
39376
|
* @author Richard Davey <rich@photonstorm.com>
|
38853
|
-
* @copyright
|
39377
|
+
* @copyright 2016 Photon Storm Ltd.
|
38854
39378
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
38855
39379
|
*/
|
38856
39380
|
|
@@ -39314,7 +39838,7 @@ Phaser.Touch.prototype.constructor = Phaser.Touch;
|
|
39314
39838
|
|
39315
39839
|
/**
|
39316
39840
|
* @author Richard Davey <rich@photonstorm.com>
|
39317
|
-
* @copyright
|
39841
|
+
* @copyright 2016 Photon Storm Ltd.
|
39318
39842
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
39319
39843
|
*/
|
39320
39844
|
|
@@ -39539,6 +40063,8 @@ Phaser.InputHandler = function (sprite) {
|
|
39539
40063
|
id: 0,
|
39540
40064
|
x: 0,
|
39541
40065
|
y: 0,
|
40066
|
+
camX: 0,
|
40067
|
+
camY: 0,
|
39542
40068
|
isDown: false,
|
39543
40069
|
isUp: false,
|
39544
40070
|
isOver: false,
|
@@ -40268,13 +40794,19 @@ Phaser.InputHandler.prototype = {
|
|
40268
40794
|
data.isUp = false;
|
40269
40795
|
data.timeDown = this.game.time.time;
|
40270
40796
|
|
40797
|
+
// It's possible the onInputDown event creates a new Sprite that is on-top of this one, so we ought to force a Pointer update
|
40798
|
+
pointer.dirty = true;
|
40799
|
+
|
40271
40800
|
if (this.sprite && this.sprite.events)
|
40272
40801
|
{
|
40273
40802
|
this.sprite.events.onInputDown$dispatch(this.sprite, pointer);
|
40803
|
+
// The onInputDown event might have destroyed this sprite.
|
40804
|
+
if (this.sprite === null)
|
40805
|
+
{
|
40806
|
+
return;
|
40807
|
+
}
|
40274
40808
|
}
|
40275
40809
|
|
40276
|
-
// It's possible the onInputDown event created a new Sprite that is on-top of this one, so we ought to force a Pointer update
|
40277
|
-
pointer.dirty = true;
|
40278
40810
|
|
40279
40811
|
// Start drag
|
40280
40812
|
if (this.draggable && this.isDragged === false)
|
@@ -40401,14 +40933,17 @@ Phaser.InputHandler.prototype = {
|
|
40401
40933
|
}
|
40402
40934
|
else
|
40403
40935
|
{
|
40936
|
+
var cx = this.game.camera.x - this._pointerData[pointer.id].camX;
|
40937
|
+
var cy = this.game.camera.y - this._pointerData[pointer.id].camY;
|
40938
|
+
|
40404
40939
|
if (this.allowHorizontalDrag)
|
40405
40940
|
{
|
40406
|
-
this.sprite.x = px;
|
40941
|
+
this.sprite.x = px + cx;
|
40407
40942
|
}
|
40408
40943
|
|
40409
40944
|
if (this.allowVerticalDrag)
|
40410
40945
|
{
|
40411
|
-
this.sprite.y = py;
|
40946
|
+
this.sprite.y = py + cy;
|
40412
40947
|
}
|
40413
40948
|
|
40414
40949
|
if (this.boundsRect)
|
@@ -40626,19 +41161,23 @@ Phaser.InputHandler.prototype = {
|
|
40626
41161
|
|
40627
41162
|
this.isDragged = true;
|
40628
41163
|
this._draggedPointerID = pointer.id;
|
41164
|
+
|
41165
|
+
this._pointerData[pointer.id].camX = this.game.camera.x;
|
41166
|
+
this._pointerData[pointer.id].camY = this.game.camera.y;
|
41167
|
+
|
40629
41168
|
this._pointerData[pointer.id].isDragged = true;
|
40630
41169
|
|
40631
41170
|
if (this.sprite.fixedToCamera)
|
40632
41171
|
{
|
40633
41172
|
if (this.dragFromCenter)
|
40634
41173
|
{
|
40635
|
-
this.sprite.
|
40636
|
-
|
40637
|
-
|
40638
|
-
|
40639
|
-
{
|
40640
|
-
this._dragPoint.setTo(this.sprite.cameraOffset.x - pointer.x, this.sprite.cameraOffset.y - pointer.y);
|
41174
|
+
var bounds = this.sprite.getBounds();
|
41175
|
+
|
41176
|
+
this.sprite.cameraOffset.x = this.globalToLocalX(pointer.x) + (this.sprite.cameraOffset.x - bounds.centerX);
|
41177
|
+
this.sprite.cameraOffset.y = this.globalToLocalY(pointer.y) + (this.sprite.cameraOffset.y - bounds.centerY);
|
40641
41178
|
}
|
41179
|
+
|
41180
|
+
this._dragPoint.setTo(this.sprite.cameraOffset.x - pointer.x, this.sprite.cameraOffset.y - pointer.y);
|
40642
41181
|
}
|
40643
41182
|
else
|
40644
41183
|
{
|
@@ -40920,7 +41459,7 @@ Phaser.InputHandler.prototype.constructor = Phaser.InputHandler;
|
|
40920
41459
|
|
40921
41460
|
/**
|
40922
41461
|
* @author @karlmacklin <tacklemcclean@gmail.com>
|
40923
|
-
* @copyright
|
41462
|
+
* @copyright 2016 Photon Storm Ltd.
|
40924
41463
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
40925
41464
|
*/
|
40926
41465
|
|
@@ -41583,7 +42122,7 @@ Phaser.Gamepad.PS3XC_STICK_RIGHT_Y = 3; // analog stick, range -1..1
|
|
41583
42122
|
/**
|
41584
42123
|
* @author @karlmacklin <tacklemcclean@gmail.com>
|
41585
42124
|
* @author Richard Davey <rich@photonstorm.com>
|
41586
|
-
* @copyright
|
42125
|
+
* @copyright 2016 Photon Storm Ltd.
|
41587
42126
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
41588
42127
|
*/
|
41589
42128
|
|
@@ -42138,7 +42677,7 @@ Phaser.SinglePad.prototype.constructor = Phaser.SinglePad;
|
|
42138
42677
|
|
42139
42678
|
/**
|
42140
42679
|
* @author Richard Davey <rich@photonstorm.com>
|
42141
|
-
* @copyright
|
42680
|
+
* @copyright 2016 Photon Storm Ltd.
|
42142
42681
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
42143
42682
|
*/
|
42144
42683
|
|
@@ -42503,7 +43042,7 @@ Phaser.Key.prototype.constructor = Phaser.Key;
|
|
42503
43042
|
|
42504
43043
|
/**
|
42505
43044
|
* @author Richard Davey <rich@photonstorm.com>
|
42506
|
-
* @copyright
|
43045
|
+
* @copyright 2016 Photon Storm Ltd.
|
42507
43046
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
42508
43047
|
*/
|
42509
43048
|
|
@@ -42513,6 +43052,10 @@ Phaser.Key.prototype.constructor = Phaser.Key;
|
|
42513
43052
|
* _Note_: many keyboards are unable to process certain combinations of keys due to hardware limitations known as ghosting.
|
42514
43053
|
* See http://www.html5gamedevs.com/topic/4876-impossible-to-use-more-than-2-keyboard-input-buttons-at-the-same-time/ for more details.
|
42515
43054
|
*
|
43055
|
+
* Also please be aware that certain browser extensions can disable or override Phaser keyboard handling.
|
43056
|
+
* For example the Chrome extension vimium is known to disable Phaser from using the D key. And there are others.
|
43057
|
+
* So please check your extensions before opening Phaser issues.
|
43058
|
+
*
|
42516
43059
|
* @class Phaser.Keyboard
|
42517
43060
|
* @constructor
|
42518
43061
|
* @param {Phaser.Game} game - A reference to the currently running game.
|
@@ -43317,7 +43860,7 @@ for (var key in Phaser.KeyCode) {
|
|
43317
43860
|
|
43318
43861
|
/**
|
43319
43862
|
* @author Richard Davey <rich@photonstorm.com>
|
43320
|
-
* @copyright
|
43863
|
+
* @copyright 2016 Photon Storm Ltd.
|
43321
43864
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
43322
43865
|
*/
|
43323
43866
|
|
@@ -43325,7 +43868,7 @@ Phaser.Component = function () {};
|
|
43325
43868
|
|
43326
43869
|
/**
|
43327
43870
|
* @author Richard Davey <rich@photonstorm.com>
|
43328
|
-
* @copyright
|
43871
|
+
* @copyright 2016 Photon Storm Ltd.
|
43329
43872
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
43330
43873
|
*/
|
43331
43874
|
|
@@ -43371,7 +43914,7 @@ Phaser.Component.Angle.prototype = {
|
|
43371
43914
|
|
43372
43915
|
/**
|
43373
43916
|
* @author Richard Davey <rich@photonstorm.com>
|
43374
|
-
* @copyright
|
43917
|
+
* @copyright 2016 Photon Storm Ltd.
|
43375
43918
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
43376
43919
|
*/
|
43377
43920
|
|
@@ -43412,7 +43955,7 @@ Phaser.Component.Animation.prototype = {
|
|
43412
43955
|
|
43413
43956
|
/**
|
43414
43957
|
* @author Richard Davey <rich@photonstorm.com>
|
43415
|
-
* @copyright
|
43958
|
+
* @copyright 2016 Photon Storm Ltd.
|
43416
43959
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
43417
43960
|
*/
|
43418
43961
|
|
@@ -43467,7 +44010,7 @@ Phaser.Component.AutoCull.prototype = {
|
|
43467
44010
|
|
43468
44011
|
/**
|
43469
44012
|
* @author Richard Davey <rich@photonstorm.com>
|
43470
|
-
* @copyright
|
44013
|
+
* @copyright 2016 Photon Storm Ltd.
|
43471
44014
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
43472
44015
|
*/
|
43473
44016
|
|
@@ -43588,7 +44131,7 @@ Phaser.Component.Bounds.prototype = {
|
|
43588
44131
|
|
43589
44132
|
/**
|
43590
44133
|
* @author Richard Davey <rich@photonstorm.com>
|
43591
|
-
* @copyright
|
44134
|
+
* @copyright 2016 Photon Storm Ltd.
|
43592
44135
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
43593
44136
|
*/
|
43594
44137
|
|
@@ -43685,7 +44228,7 @@ Phaser.Component.BringToTop.prototype.moveDown = function () {
|
|
43685
44228
|
|
43686
44229
|
/**
|
43687
44230
|
* @author Richard Davey <rich@photonstorm.com>
|
43688
|
-
* @copyright
|
44231
|
+
* @copyright 2016 Photon Storm Ltd.
|
43689
44232
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
43690
44233
|
*/
|
43691
44234
|
|
@@ -44041,7 +44584,7 @@ Phaser.Component.Core.prototype = {
|
|
44041
44584
|
|
44042
44585
|
/**
|
44043
44586
|
* @author Richard Davey <rich@photonstorm.com>
|
44044
|
-
* @copyright
|
44587
|
+
* @copyright 2016 Photon Storm Ltd.
|
44045
44588
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
44046
44589
|
*/
|
44047
44590
|
|
@@ -44159,7 +44702,7 @@ Phaser.Component.Crop.prototype = {
|
|
44159
44702
|
|
44160
44703
|
/**
|
44161
44704
|
* @author Richard Davey <rich@photonstorm.com>
|
44162
|
-
* @copyright
|
44705
|
+
* @copyright 2016 Photon Storm Ltd.
|
44163
44706
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
44164
44707
|
*/
|
44165
44708
|
|
@@ -44228,7 +44771,7 @@ Phaser.Component.Delta.prototype = {
|
|
44228
44771
|
|
44229
44772
|
/**
|
44230
44773
|
* @author Richard Davey <rich@photonstorm.com>
|
44231
|
-
* @copyright
|
44774
|
+
* @copyright 2016 Photon Storm Ltd.
|
44232
44775
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
44233
44776
|
*/
|
44234
44777
|
|
@@ -44308,6 +44851,8 @@ Phaser.Component.Destroy.prototype = {
|
|
44308
44851
|
this.events.destroy();
|
44309
44852
|
}
|
44310
44853
|
|
44854
|
+
this.game.tweens.removeFrom(this);
|
44855
|
+
|
44311
44856
|
var i = this.children.length;
|
44312
44857
|
|
44313
44858
|
if (destroyChildren)
|
@@ -44389,7 +44934,7 @@ Phaser.Component.Destroy.prototype = {
|
|
44389
44934
|
|
44390
44935
|
/**
|
44391
44936
|
* @author Richard Davey <rich@photonstorm.com>
|
44392
|
-
* @copyright
|
44937
|
+
* @copyright 2016 Photon Storm Ltd.
|
44393
44938
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
44394
44939
|
*/
|
44395
44940
|
|
@@ -44583,7 +45128,7 @@ for (var prop in Phaser.Events.prototype)
|
|
44583
45128
|
|
44584
45129
|
/**
|
44585
45130
|
* @author Richard Davey <rich@photonstorm.com>
|
44586
|
-
* @copyright
|
45131
|
+
* @copyright 2016 Photon Storm Ltd.
|
44587
45132
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
44588
45133
|
*/
|
44589
45134
|
|
@@ -44672,7 +45217,7 @@ Phaser.Component.FixedToCamera.prototype = {
|
|
44672
45217
|
|
44673
45218
|
/**
|
44674
45219
|
* @author Richard Davey <rich@photonstorm.com>
|
44675
|
-
* @copyright
|
45220
|
+
* @copyright 2016 Photon Storm Ltd.
|
44676
45221
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
44677
45222
|
*/
|
44678
45223
|
|
@@ -44779,7 +45324,7 @@ Phaser.Component.Health.prototype = {
|
|
44779
45324
|
|
44780
45325
|
/**
|
44781
45326
|
* @author Richard Davey <rich@photonstorm.com>
|
44782
|
-
* @copyright
|
45327
|
+
* @copyright 2016 Photon Storm Ltd.
|
44783
45328
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
44784
45329
|
*/
|
44785
45330
|
|
@@ -44816,7 +45361,7 @@ Phaser.Component.InCamera.prototype = {
|
|
44816
45361
|
|
44817
45362
|
/**
|
44818
45363
|
* @author Richard Davey <rich@photonstorm.com>
|
44819
|
-
* @copyright
|
45364
|
+
* @copyright 2016 Photon Storm Ltd.
|
44820
45365
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
44821
45366
|
*/
|
44822
45367
|
|
@@ -44889,7 +45434,7 @@ Phaser.Component.InputEnabled.prototype = {
|
|
44889
45434
|
|
44890
45435
|
/**
|
44891
45436
|
* @author Richard Davey <rich@photonstorm.com>
|
44892
|
-
* @copyright
|
45437
|
+
* @copyright 2016 Photon Storm Ltd.
|
44893
45438
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
44894
45439
|
*/
|
44895
45440
|
|
@@ -44929,6 +45474,12 @@ Phaser.Component.InWorld.preUpdate = function () {
|
|
44929
45474
|
else
|
44930
45475
|
{
|
44931
45476
|
this.renderable = false;
|
45477
|
+
|
45478
|
+
if (this.outOfCameraBoundsKill)
|
45479
|
+
{
|
45480
|
+
this.kill();
|
45481
|
+
return false;
|
45482
|
+
}
|
44932
45483
|
}
|
44933
45484
|
}
|
44934
45485
|
|
@@ -44988,6 +45539,15 @@ Phaser.Component.InWorld.prototype = {
|
|
44988
45539
|
*/
|
44989
45540
|
outOfBoundsKill: false,
|
44990
45541
|
|
45542
|
+
/**
|
45543
|
+
* If this and the `autoCull` property are both set to `true`, then the `kill` method
|
45544
|
+
* is called as soon as the Game Object leaves the camera bounds.
|
45545
|
+
*
|
45546
|
+
* @property {boolean} outOfCameraBoundsKill
|
45547
|
+
* @default
|
45548
|
+
*/
|
45549
|
+
outOfCameraBoundsKill: false,
|
45550
|
+
|
44991
45551
|
/**
|
44992
45552
|
* @property {boolean} _outOfBoundsFired - Internal state var.
|
44993
45553
|
* @private
|
@@ -45014,7 +45574,7 @@ Phaser.Component.InWorld.prototype = {
|
|
45014
45574
|
|
45015
45575
|
/**
|
45016
45576
|
* @author Richard Davey <rich@photonstorm.com>
|
45017
|
-
* @copyright
|
45577
|
+
* @copyright 2016 Photon Storm Ltd.
|
45018
45578
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
45019
45579
|
*/
|
45020
45580
|
|
@@ -45143,7 +45703,7 @@ Phaser.Component.LifeSpan.prototype = {
|
|
45143
45703
|
|
45144
45704
|
/**
|
45145
45705
|
* @author Richard Davey <rich@photonstorm.com>
|
45146
|
-
* @copyright
|
45706
|
+
* @copyright 2016 Photon Storm Ltd.
|
45147
45707
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
45148
45708
|
*/
|
45149
45709
|
|
@@ -45184,6 +45744,8 @@ Phaser.Component.LoadTexture.prototype = {
|
|
45184
45744
|
* to use a Texture Atlas later in development by simply searching your code for 'PENDING_ATLAS'
|
45185
45745
|
* and swapping it to be the key of the atlas data.
|
45186
45746
|
*
|
45747
|
+
* Note: You cannot use a RenderTexture as a texture for a TileSprite.
|
45748
|
+
*
|
45187
45749
|
* @method
|
45188
45750
|
* @param {string|Phaser.RenderTexture|Phaser.BitmapData|Phaser.Video|PIXI.Texture} key - This is the image or texture used by the Sprite during rendering. It can be a string which is a reference to the Cache Image entry, or an instance of a RenderTexture, BitmapData, Video or PIXI.Texture.
|
45189
45751
|
* @param {string|number} [frame] - If this Sprite is using part of a sprite sheet or texture atlas you can specify the exact frame to use by giving a string or numeric index.
|
@@ -45228,6 +45790,10 @@ Phaser.Component.LoadTexture.prototype = {
|
|
45228
45790
|
{
|
45229
45791
|
setFrame = !this.animations.loadFrameData(cache.getFrameData(key.key, Phaser.Cache.BITMAPDATA), frame);
|
45230
45792
|
}
|
45793
|
+
else
|
45794
|
+
{
|
45795
|
+
setFrame = !this.animations.loadFrameData(key.frameData, 0);
|
45796
|
+
}
|
45231
45797
|
}
|
45232
45798
|
else if (Phaser.Video && key instanceof Phaser.Video)
|
45233
45799
|
{
|
@@ -45240,6 +45806,12 @@ Phaser.Component.LoadTexture.prototype = {
|
|
45240
45806
|
key.onChangeSource.add(this.resizeFrame, this);
|
45241
45807
|
this.texture.valid = valid;
|
45242
45808
|
}
|
45809
|
+
else if (Phaser.Tilemap && key instanceof Phaser.TilemapLayer)
|
45810
|
+
{
|
45811
|
+
// this.customRender = true;
|
45812
|
+
|
45813
|
+
this.setTexture(PIXI.Texture.fromCanvas(key.canvas));
|
45814
|
+
}
|
45243
45815
|
else if (key instanceof PIXI.Texture)
|
45244
45816
|
{
|
45245
45817
|
this.setTexture(key);
|
@@ -45423,7 +45995,7 @@ Phaser.Component.LoadTexture.prototype = {
|
|
45423
45995
|
|
45424
45996
|
/**
|
45425
45997
|
* @author Richard Davey <rich@photonstorm.com>
|
45426
|
-
* @copyright
|
45998
|
+
* @copyright 2016 Photon Storm Ltd.
|
45427
45999
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
45428
46000
|
*/
|
45429
46001
|
|
@@ -45459,7 +46031,7 @@ Phaser.Component.Overlap.prototype = {
|
|
45459
46031
|
|
45460
46032
|
/**
|
45461
46033
|
* @author Richard Davey <rich@photonstorm.com>
|
45462
|
-
* @copyright
|
46034
|
+
* @copyright 2016 Photon Storm Ltd.
|
45463
46035
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
45464
46036
|
*/
|
45465
46037
|
|
@@ -45605,7 +46177,7 @@ Phaser.Component.PhysicsBody.prototype = {
|
|
45605
46177
|
|
45606
46178
|
/**
|
45607
46179
|
* @author Richard Davey <rich@photonstorm.com>
|
45608
|
-
* @copyright
|
46180
|
+
* @copyright 2016 Photon Storm Ltd.
|
45609
46181
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
45610
46182
|
*/
|
45611
46183
|
|
@@ -45669,7 +46241,7 @@ Phaser.Component.Reset.prototype.reset = function (x, y, health) {
|
|
45669
46241
|
|
45670
46242
|
/**
|
45671
46243
|
* @author Richard Davey <rich@photonstorm.com>
|
45672
|
-
* @copyright
|
46244
|
+
* @copyright 2016 Photon Storm Ltd.
|
45673
46245
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
45674
46246
|
*/
|
45675
46247
|
|
@@ -45837,7 +46409,7 @@ Phaser.Component.ScaleMinMax.prototype = {
|
|
45837
46409
|
};
|
45838
46410
|
/**
|
45839
46411
|
* @author Richard Davey <rich@photonstorm.com>
|
45840
|
-
* @copyright
|
46412
|
+
* @copyright 2016 Photon Storm Ltd.
|
45841
46413
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
45842
46414
|
*/
|
45843
46415
|
|
@@ -45891,7 +46463,7 @@ Phaser.Component.Smoothed.prototype = {
|
|
45891
46463
|
|
45892
46464
|
/**
|
45893
46465
|
* @author Richard Davey <rich@photonstorm.com>
|
45894
|
-
* @copyright
|
46466
|
+
* @copyright 2016 Photon Storm Ltd.
|
45895
46467
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
45896
46468
|
*/
|
45897
46469
|
|
@@ -46141,7 +46713,7 @@ Phaser.GameObjectFactory.prototype = {
|
|
46141
46713
|
* @param {number} y - The y coordinate of the TileSprite. The coordinate is relative to any parent container this TileSprite may be in.
|
46142
46714
|
* @param {number} width - The width of the TileSprite.
|
46143
46715
|
* @param {number} height - The height of the TileSprite.
|
46144
|
-
* @param {string|Phaser.
|
46716
|
+
* @param {string|Phaser.BitmapData|PIXI.Texture} key - This is the image or texture used by the TileSprite during rendering. It can be a string which is a reference to the Phaser Image Cache entry, or an instance of a PIXI.Texture or BitmapData.
|
46145
46717
|
* @param {string|number} [frame] - If a Texture Atlas or Sprite Sheet is used this allows you to specify the frame to be used. Use either an integer for a Frame ID or a string for a frame name.
|
46146
46718
|
* @param {Phaser.Group} [group] - Optional Group to add the object to. If not specified it will be added to the World group.
|
46147
46719
|
* @return {Phaser.TileSprite} The newly created TileSprite object.
|
@@ -46454,7 +47026,7 @@ Phaser.GameObjectFactory.prototype.constructor = Phaser.GameObjectFactory;
|
|
46454
47026
|
|
46455
47027
|
/**
|
46456
47028
|
* @author Richard Davey <rich@photonstorm.com>
|
46457
|
-
* @copyright
|
47029
|
+
* @copyright 2016 Photon Storm Ltd.
|
46458
47030
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
46459
47031
|
*/
|
46460
47032
|
|
@@ -46622,7 +47194,7 @@ Phaser.GameObjectCreator.prototype = {
|
|
46622
47194
|
* @param {number} y - The y coordinate (in world space) to position the TileSprite at.
|
46623
47195
|
* @param {number} width - The width of the TileSprite.
|
46624
47196
|
* @param {number} height - The height of the TileSprite.
|
46625
|
-
* @param {string|Phaser.
|
47197
|
+
* @param {string|Phaser.BitmapData|PIXI.Texture} key - This is the image or texture used by the TileSprite during rendering. It can be a string which is a reference to the Phaser Image Cache entry, or an instance of a PIXI.Texture or BitmapData.
|
46626
47198
|
* @param {string|number} frame - If this TileSprite is using part of a sprite sheet or texture atlas you can specify the exact frame to use by giving a string or numeric index.
|
46627
47199
|
* @return {Phaser.TileSprite} The newly created tileSprite object.
|
46628
47200
|
*/
|
@@ -46884,7 +47456,7 @@ Phaser.GameObjectCreator.prototype.constructor = Phaser.GameObjectCreator;
|
|
46884
47456
|
|
46885
47457
|
/**
|
46886
47458
|
* @author Richard Davey <rich@photonstorm.com>
|
46887
|
-
* @copyright
|
47459
|
+
* @copyright 2016 Photon Storm Ltd.
|
46888
47460
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
46889
47461
|
*/
|
46890
47462
|
|
@@ -47001,7 +47573,7 @@ Phaser.Sprite.prototype.preUpdate = function() {
|
|
47001
47573
|
|
47002
47574
|
/**
|
47003
47575
|
* @author Richard Davey <rich@photonstorm.com>
|
47004
|
-
* @copyright
|
47576
|
+
* @copyright 2016 Photon Storm Ltd.
|
47005
47577
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
47006
47578
|
*/
|
47007
47579
|
|
@@ -47094,7 +47666,7 @@ Phaser.Image.prototype.preUpdate = function() {
|
|
47094
47666
|
|
47095
47667
|
/**
|
47096
47668
|
* @author Richard Davey <rich@photonstorm.com>
|
47097
|
-
* @copyright
|
47669
|
+
* @copyright 2016 Photon Storm Ltd.
|
47098
47670
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
47099
47671
|
*/
|
47100
47672
|
|
@@ -47690,7 +48262,7 @@ Phaser.Button.prototype.onInputUpHandler = function (sprite, pointer, isOver) {
|
|
47690
48262
|
|
47691
48263
|
/**
|
47692
48264
|
* @author Richard Davey <rich@photonstorm.com>
|
47693
|
-
* @copyright
|
48265
|
+
* @copyright 2016 Photon Storm Ltd.
|
47694
48266
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
47695
48267
|
*/
|
47696
48268
|
|
@@ -47732,7 +48304,7 @@ Phaser.SpriteBatch.prototype.constructor = Phaser.SpriteBatch;
|
|
47732
48304
|
|
47733
48305
|
/**
|
47734
48306
|
* @author Richard Davey <rich@photonstorm.com>
|
47735
|
-
* @copyright
|
48307
|
+
* @copyright 2016 Photon Storm Ltd.
|
47736
48308
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
47737
48309
|
*/
|
47738
48310
|
|
@@ -47854,11 +48426,16 @@ Phaser.BitmapData = function (game, key, width, height) {
|
|
47854
48426
|
*/
|
47855
48427
|
this.texture = new PIXI.Texture(this.baseTexture);
|
47856
48428
|
|
48429
|
+
/**
|
48430
|
+
* @property {Phaser.FrameData} frameData - The FrameData container this BitmapData uses for rendering.
|
48431
|
+
*/
|
48432
|
+
this.frameData = new Phaser.FrameData();
|
48433
|
+
|
47857
48434
|
/**
|
47858
48435
|
* @property {Phaser.Frame} textureFrame - The Frame this BitmapData uses for rendering.
|
47859
48436
|
* @default
|
47860
48437
|
*/
|
47861
|
-
this.textureFrame = new Phaser.Frame(0, 0, 0, width, height, 'bitmapData');
|
48438
|
+
this.textureFrame = this.frameData.addFrame(new Phaser.Frame(0, 0, 0, width, height, 'bitmapData'));
|
47862
48439
|
|
47863
48440
|
this.texture.frame = this.textureFrame;
|
47864
48441
|
|
@@ -48987,6 +49564,7 @@ Phaser.BitmapData.prototype = {
|
|
48987
49564
|
}
|
48988
49565
|
|
48989
49566
|
this._image = source.tintedTexture;
|
49567
|
+
this._pos.set(0);
|
48990
49568
|
}
|
48991
49569
|
}
|
48992
49570
|
else
|
@@ -49589,6 +50167,8 @@ Phaser.BitmapData.prototype = {
|
|
49589
50167
|
*/
|
49590
50168
|
destroy: function () {
|
49591
50169
|
|
50170
|
+
this.frameData.destroy();
|
50171
|
+
|
49592
50172
|
this.texture.destroy(true);
|
49593
50173
|
|
49594
50174
|
PIXI.CanvasPool.remove(this);
|
@@ -50808,13 +51388,15 @@ PIXI.Graphics.prototype._renderCanvas = function(renderSession)
|
|
50808
51388
|
}
|
50809
51389
|
|
50810
51390
|
var resolution = renderSession.resolution;
|
51391
|
+
var tx = (transform.tx * renderSession.resolution) + renderSession.shakeX;
|
51392
|
+
var ty = (transform.ty * renderSession.resolution) + renderSession.shakeY;
|
50811
51393
|
|
50812
51394
|
context.setTransform(transform.a * resolution,
|
50813
51395
|
transform.b * resolution,
|
50814
51396
|
transform.c * resolution,
|
50815
51397
|
transform.d * resolution,
|
50816
|
-
|
50817
|
-
|
51398
|
+
tx,
|
51399
|
+
ty);
|
50818
51400
|
|
50819
51401
|
PIXI.CanvasGraphics.renderGraphics(this, context);
|
50820
51402
|
|
@@ -53361,7 +53943,7 @@ PIXI.CanvasGraphics.updateGraphicsTint = function(graphics)
|
|
53361
53943
|
|
53362
53944
|
/**
|
53363
53945
|
* @author Richard Davey <rich@photonstorm.com>
|
53364
|
-
* @copyright
|
53946
|
+
* @copyright 2016 Photon Storm Ltd.
|
53365
53947
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
53366
53948
|
*/
|
53367
53949
|
|
@@ -53403,6 +53985,12 @@ Phaser.Graphics = function (game, x, y) {
|
|
53403
53985
|
*/
|
53404
53986
|
this.physicsType = Phaser.SPRITE;
|
53405
53987
|
|
53988
|
+
/**
|
53989
|
+
* @property {Phaser.Point} anchor - Required for a Graphics shape to work as a Physics body, do not modify this value.
|
53990
|
+
* @private
|
53991
|
+
*/
|
53992
|
+
this.anchor = new Phaser.Point();
|
53993
|
+
|
53406
53994
|
PIXI.Graphics.call(this);
|
53407
53995
|
|
53408
53996
|
Phaser.Component.Core.init.call(this, game, x, y, '', null);
|
@@ -53571,7 +54159,7 @@ Phaser.Graphics.prototype.drawTriangles = function(vertices, indices, cull) {
|
|
53571
54159
|
|
53572
54160
|
/**
|
53573
54161
|
* @author Richard Davey <rich@photonstorm.com>
|
53574
|
-
* @copyright
|
54162
|
+
* @copyright 2016 Photon Storm Ltd.
|
53575
54163
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
53576
54164
|
*/
|
53577
54165
|
|
@@ -53725,7 +54313,7 @@ Phaser.RenderTexture.prototype.render = function (displayObject, matrix, clear)
|
|
53725
54313
|
|
53726
54314
|
/**
|
53727
54315
|
* @author Richard Davey <rich@photonstorm.com>
|
53728
|
-
* @copyright
|
54316
|
+
* @copyright 2016 Photon Storm Ltd.
|
53729
54317
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
53730
54318
|
*/
|
53731
54319
|
|
@@ -53759,6 +54347,7 @@ Phaser.RenderTexture.prototype.render = function (displayObject, matrix, clear)
|
|
53759
54347
|
* @param {number} [style.strokeThickness=0] - A number that represents the thickness of the stroke. Default is 0 (no stroke).
|
53760
54348
|
* @param {boolean} [style.wordWrap=false] - Indicates if word wrap should be used.
|
53761
54349
|
* @param {number} [style.wordWrapWidth=100] - The width in pixels at which text will wrap.
|
54350
|
+
* @param {number} [style.maxLines=0] - The maximum number of lines to be shown for wrapped text.
|
53762
54351
|
* @param {number} [style.tabs=0] - The size (in pixels) of the tabs, for when text includes tab characters. 0 disables. Can be an array of varying tab sizes, one per tab stop.
|
53763
54352
|
*/
|
53764
54353
|
Phaser.Text = function (game, x, y, text, style) {
|
@@ -54009,6 +54598,7 @@ Phaser.Text.prototype.setShadow = function (x, y, color, blur, shadowStroke, sha
|
|
54009
54598
|
* @param {number} [style.strokeThickness=0] - A number that represents the thickness of the stroke. Default is 0 (no stroke).
|
54010
54599
|
* @param {boolean} [style.wordWrap=false] - Indicates if word wrap should be used.
|
54011
54600
|
* @param {number} [style.wordWrapWidth=100] - The width in pixels at which text will wrap.
|
54601
|
+
* @param {number} [style.maxLines=0] - The maximum number of lines to be shown for wrapped text.
|
54012
54602
|
* @param {number|array} [style.tabs=0] - The size (in pixels) of the tabs, for when text includes tab characters. 0 disables. Can be an array of varying tab sizes, one per tab stop.
|
54013
54603
|
* @return {Phaser.Text} This Text instance.
|
54014
54604
|
*/
|
@@ -54025,6 +54615,7 @@ Phaser.Text.prototype.setStyle = function (style) {
|
|
54025
54615
|
style.strokeThickness = style.strokeThickness || 0;
|
54026
54616
|
style.wordWrap = style.wordWrap || false;
|
54027
54617
|
style.wordWrapWidth = style.wordWrapWidth || 100;
|
54618
|
+
style.maxLines = style.maxLines || 0;
|
54028
54619
|
style.shadowOffsetX = style.shadowOffsetX || 0;
|
54029
54620
|
style.shadowOffsetY = style.shadowOffsetY || 0;
|
54030
54621
|
style.shadowColor = style.shadowColor || 'rgba(0,0,0,0)';
|
@@ -54061,6 +54652,7 @@ Phaser.Text.prototype.setStyle = function (style) {
|
|
54061
54652
|
this._fontComponents = components;
|
54062
54653
|
|
54063
54654
|
style.font = this.componentsToFont(this._fontComponents);
|
54655
|
+
|
54064
54656
|
this.style = style;
|
54065
54657
|
this.dirty = true;
|
54066
54658
|
|
@@ -54096,7 +54688,14 @@ Phaser.Text.prototype.updateText = function () {
|
|
54096
54688
|
var maxLineWidth = 0;
|
54097
54689
|
var fontProperties = this.determineFontProperties(this.style.font);
|
54098
54690
|
|
54099
|
-
|
54691
|
+
var drawnLines = lines.length;
|
54692
|
+
|
54693
|
+
if (this.style.maxLines > 0 && this.style.maxLines < lines.length)
|
54694
|
+
{
|
54695
|
+
drawnLines = this.style.maxLines;
|
54696
|
+
}
|
54697
|
+
|
54698
|
+
for (var i = 0; i < drawnLines; i++)
|
54100
54699
|
{
|
54101
54700
|
if (tabs === 0)
|
54102
54701
|
{
|
@@ -54153,7 +54752,7 @@ Phaser.Text.prototype.updateText = function () {
|
|
54153
54752
|
|
54154
54753
|
// Calculate text height
|
54155
54754
|
var lineHeight = fontProperties.fontSize + this.style.strokeThickness + this.padding.y;
|
54156
|
-
var height = lineHeight *
|
54755
|
+
var height = lineHeight * drawnLines;
|
54157
54756
|
var lineSpacing = this._lineSpacing;
|
54158
54757
|
|
54159
54758
|
if (lineSpacing < 0 && Math.abs(lineSpacing) > lineHeight)
|
@@ -54164,7 +54763,7 @@ Phaser.Text.prototype.updateText = function () {
|
|
54164
54763
|
// Adjust for line spacing
|
54165
54764
|
if (lineSpacing !== 0)
|
54166
54765
|
{
|
54167
|
-
height += lineSpacing * lines.length;
|
54766
|
+
height += (lineSpacing > 0) ? lineSpacing * lines.length : lineSpacing * (lines.length - 1);
|
54168
54767
|
}
|
54169
54768
|
|
54170
54769
|
this.canvas.height = height * this._res;
|
@@ -54197,7 +54796,7 @@ Phaser.Text.prototype.updateText = function () {
|
|
54197
54796
|
this._charCount = 0;
|
54198
54797
|
|
54199
54798
|
// Draw text line by line
|
54200
|
-
for (i = 0; i <
|
54799
|
+
for (i = 0; i < drawnLines; i++)
|
54201
54800
|
{
|
54202
54801
|
// Split the line by
|
54203
54802
|
|
@@ -54802,18 +55401,27 @@ Phaser.Text.prototype.fontToComponents = function (font) {
|
|
54802
55401
|
|
54803
55402
|
if (m)
|
54804
55403
|
{
|
55404
|
+
var family = m[5].trim();
|
55405
|
+
|
55406
|
+
// If it looks like the value should be quoted, but isn't, then quote it.
|
55407
|
+
if (!/^(?:inherit|serif|sans-serif|cursive|fantasy|monospace)$/.exec(family) && !/['",]/.exec(family))
|
55408
|
+
{
|
55409
|
+
family = "'" + family + "'";
|
55410
|
+
}
|
55411
|
+
|
54805
55412
|
return {
|
54806
55413
|
font: font,
|
54807
55414
|
fontStyle: m[1] || 'normal',
|
54808
55415
|
fontVariant: m[2] || 'normal',
|
54809
55416
|
fontWeight: m[3] || 'normal',
|
54810
55417
|
fontSize: m[4] || 'medium',
|
54811
|
-
fontFamily:
|
55418
|
+
fontFamily: family
|
54812
55419
|
};
|
54813
55420
|
}
|
54814
55421
|
else
|
54815
55422
|
{
|
54816
55423
|
console.warn("Phaser.Text - unparsable CSS font: " + font);
|
55424
|
+
|
54817
55425
|
return {
|
54818
55426
|
font: font
|
54819
55427
|
};
|
@@ -55886,7 +56494,7 @@ Phaser.Text.fontPropertiesContext = Phaser.Text.fontPropertiesCanvas.getContext(
|
|
55886
56494
|
|
55887
56495
|
/**
|
55888
56496
|
* @author Richard Davey <rich@photonstorm.com>
|
55889
|
-
* @copyright
|
56497
|
+
* @copyright 2016 Photon Storm Ltd.
|
55890
56498
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
55891
56499
|
*/
|
55892
56500
|
|
@@ -55999,7 +56607,7 @@ Phaser.BitmapText = function (game, x, y, font, text, size, align) {
|
|
55999
56607
|
* @property {string} _text - Internal cache var.
|
56000
56608
|
* @private
|
56001
56609
|
*/
|
56002
|
-
this._text = text;
|
56610
|
+
this._text = text.toString() || '';
|
56003
56611
|
|
56004
56612
|
/**
|
56005
56613
|
* @property {string} _data - Internal cache var.
|
@@ -56594,7 +57202,7 @@ Object.defineProperty(Phaser.BitmapText.prototype, 'smoothed', {
|
|
56594
57202
|
|
56595
57203
|
/**
|
56596
57204
|
* @author Richard Davey <rich@photonstorm.com>
|
56597
|
-
* @copyright
|
57205
|
+
* @copyright 2016 Photon Storm Ltd.
|
56598
57206
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
56599
57207
|
*/
|
56600
57208
|
|
@@ -57199,7 +57807,7 @@ Object.defineProperty(Phaser.RetroFont.prototype, "smoothed", {
|
|
57199
57807
|
|
57200
57808
|
/**
|
57201
57809
|
* @author Richard Davey <rich@photonstorm.com>
|
57202
|
-
* @copyright
|
57810
|
+
* @copyright 2016 Photon Storm Ltd, Richard Davey
|
57203
57811
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
57204
57812
|
*/
|
57205
57813
|
|
@@ -57409,7 +58017,7 @@ Object.defineProperty(Phaser.Rope.prototype, "segments", {
|
|
57409
58017
|
|
57410
58018
|
/**
|
57411
58019
|
* @author Richard Davey <rich@photonstorm.com>
|
57412
|
-
* @copyright
|
58020
|
+
* @copyright 2016 Photon Storm Ltd.
|
57413
58021
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
57414
58022
|
*/
|
57415
58023
|
|
@@ -57462,7 +58070,7 @@ Object.defineProperty(Phaser.Rope.prototype, "segments", {
|
|
57462
58070
|
* @param {number} y - The y coordinate (in world space) to position the TileSprite at.
|
57463
58071
|
* @param {number} width - The width of the TileSprite.
|
57464
58072
|
* @param {number} height - The height of the TileSprite.
|
57465
|
-
* @param {string|Phaser.
|
58073
|
+
* @param {string|Phaser.BitmapData|PIXI.Texture} key - This is the image or texture used by the TileSprite during rendering. It can be a string which is a reference to the Phaser Image Cache entry, or an instance of a PIXI.Texture or BitmapData.
|
57466
58074
|
* @param {string|number} frame - If this TileSprite is using part of a sprite sheet or texture atlas you can specify the exact frame to use by giving a string or numeric index.
|
57467
58075
|
*/
|
57468
58076
|
Phaser.TileSprite = function (game, x, y, width, height, key, frame) {
|
@@ -57624,7 +58232,7 @@ Phaser.TileSprite.prototype.reset = function(x, y) {
|
|
57624
58232
|
|
57625
58233
|
/**
|
57626
58234
|
* @author Richard Davey <rich@photonstorm.com>
|
57627
|
-
* @copyright
|
58235
|
+
* @copyright 2016 Photon Storm Ltd.
|
57628
58236
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
57629
58237
|
*/
|
57630
58238
|
|
@@ -59001,7 +59609,7 @@ Phaser.Device.isAndroidStockBrowser = function () {
|
|
59001
59609
|
|
59002
59610
|
/**
|
59003
59611
|
* @author Richard Davey <rich@photonstorm.com>
|
59004
|
-
* @copyright
|
59612
|
+
* @copyright 2016 Photon Storm Ltd.
|
59005
59613
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
59006
59614
|
*/
|
59007
59615
|
|
@@ -59309,7 +59917,7 @@ Phaser.Canvas = {
|
|
59309
59917
|
|
59310
59918
|
/**
|
59311
59919
|
* @author Richard Davey <rich@photonstorm.com>
|
59312
|
-
* @copyright
|
59920
|
+
* @copyright 2016 Photon Storm Ltd.
|
59313
59921
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
59314
59922
|
*/
|
59315
59923
|
|
@@ -59478,7 +60086,7 @@ Phaser.RequestAnimationFrame.prototype.constructor = Phaser.RequestAnimationFram
|
|
59478
60086
|
|
59479
60087
|
/**
|
59480
60088
|
* @author Richard Davey <rich@photonstorm.com>
|
59481
|
-
* @copyright
|
60089
|
+
* @copyright 2016 Photon Storm Ltd.
|
59482
60090
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
59483
60091
|
*/
|
59484
60092
|
|
@@ -60374,16 +60982,29 @@ Phaser.Math = {
|
|
60374
60982
|
},
|
60375
60983
|
|
60376
60984
|
/**
|
60377
|
-
* Force a value within the boundaries by clamping
|
60985
|
+
* Force a value within the boundaries by clamping it to the range `min`, `max`.
|
60378
60986
|
*
|
60379
60987
|
* @method Phaser.Math#clamp
|
60380
|
-
* @param {
|
60381
|
-
* @param {
|
60382
|
-
* @param {
|
60383
|
-
* @return {number}
|
60988
|
+
* @param {float} v - The value to be clamped.
|
60989
|
+
* @param {float} min - The minimum bounds.
|
60990
|
+
* @param {float} max - The maximum bounds.
|
60991
|
+
* @return {number} The clamped value.
|
60384
60992
|
*/
|
60385
|
-
clamp: function (
|
60386
|
-
|
60993
|
+
clamp: function (v, min, max) {
|
60994
|
+
|
60995
|
+
if (v < min)
|
60996
|
+
{
|
60997
|
+
return min;
|
60998
|
+
}
|
60999
|
+
else if (max < v)
|
61000
|
+
{
|
61001
|
+
return max;
|
61002
|
+
}
|
61003
|
+
else
|
61004
|
+
{
|
61005
|
+
return v;
|
61006
|
+
}
|
61007
|
+
|
60387
61008
|
},
|
60388
61009
|
|
60389
61010
|
/**
|
@@ -60432,24 +61053,29 @@ Phaser.Math = {
|
|
60432
61053
|
* Smoothstep function as detailed at http://en.wikipedia.org/wiki/Smoothstep
|
60433
61054
|
*
|
60434
61055
|
* @method Phaser.Math#smoothstep
|
60435
|
-
* @param {
|
60436
|
-
* @param {
|
60437
|
-
* @param {
|
60438
|
-
* @return {
|
61056
|
+
* @param {float} x - The input value.
|
61057
|
+
* @param {float} min - The left edge. Should be smaller than the right edge.
|
61058
|
+
* @param {float} max - The right edge.
|
61059
|
+
* @return {float} A value between 0 and 1.
|
60439
61060
|
*/
|
60440
61061
|
smoothstep: function (x, min, max) {
|
61062
|
+
|
61063
|
+
// Scale, bias and saturate x to 0..1 range
|
60441
61064
|
x = Math.max(0, Math.min(1, (x - min) / (max - min)));
|
61065
|
+
|
61066
|
+
// Evaluate polynomial
|
60442
61067
|
return x * x * (3 - 2 * x);
|
61068
|
+
|
60443
61069
|
},
|
60444
61070
|
|
60445
61071
|
/**
|
60446
61072
|
* Smootherstep function as detailed at http://en.wikipedia.org/wiki/Smoothstep
|
60447
61073
|
*
|
60448
61074
|
* @method Phaser.Math#smootherstep
|
60449
|
-
* @param {
|
60450
|
-
* @param {
|
60451
|
-
* @param {
|
60452
|
-
* @return {
|
61075
|
+
* @param {float} x - The input value.
|
61076
|
+
* @param {float} min - The left edge. Should be smaller than the right edge.
|
61077
|
+
* @param {float} max - The right edge.
|
61078
|
+
* @return {float} A value between 0 and 1.
|
60453
61079
|
*/
|
60454
61080
|
smootherstep: function (x, min, max) {
|
60455
61081
|
x = Math.max(0, Math.min(1, (x - min) / (max - min)));
|
@@ -60514,7 +61140,7 @@ Phaser.Math.degToRad = function degToRad (degrees) {
|
|
60514
61140
|
};
|
60515
61141
|
|
60516
61142
|
/**
|
60517
|
-
* Convert
|
61143
|
+
* Convert radians to degrees.
|
60518
61144
|
*
|
60519
61145
|
* @method Phaser.Math#radToDeg
|
60520
61146
|
* @param {number} radians - Angle in radians.
|
@@ -60528,7 +61154,7 @@ Phaser.Math.radToDeg = function radToDeg (radians) {
|
|
60528
61154
|
|
60529
61155
|
/**
|
60530
61156
|
* @author Richard Davey <rich@photonstorm.com>
|
60531
|
-
* @copyright
|
61157
|
+
* @copyright 2016 Photon Storm Ltd.
|
60532
61158
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
60533
61159
|
*/
|
60534
61160
|
|
@@ -60885,7 +61511,7 @@ Phaser.RandomDataGenerator.prototype.constructor = Phaser.RandomDataGenerator;
|
|
60885
61511
|
/**
|
60886
61512
|
* @author Timo Hausmann
|
60887
61513
|
* @author Richard Davey <rich@photonstorm.com>
|
60888
|
-
* @copyright
|
61514
|
+
* @copyright 2016 Photon Storm Ltd.
|
60889
61515
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
60890
61516
|
*/
|
60891
61517
|
|
@@ -61237,7 +61863,7 @@ Phaser.QuadTree.prototype.constructor = Phaser.QuadTree;
|
|
61237
61863
|
|
61238
61864
|
/**
|
61239
61865
|
* @author Richard Davey <rich@photonstorm.com>
|
61240
|
-
* @copyright
|
61866
|
+
* @copyright 2016 Photon Storm Ltd.
|
61241
61867
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
61242
61868
|
*/
|
61243
61869
|
|
@@ -61387,8 +62013,8 @@ Phaser.Net.prototype = {
|
|
61387
62013
|
},
|
61388
62014
|
|
61389
62015
|
/**
|
61390
|
-
*
|
61391
|
-
*
|
62016
|
+
* Takes a Uniform Resource Identifier (URI) component (previously created by encodeURIComponent or by a similar routine) and
|
62017
|
+
* decodes it, replacing \ with spaces in the return. Used internally by the Net classes.
|
61392
62018
|
*
|
61393
62019
|
* @method Phaser.Net#decodeURI
|
61394
62020
|
* @param {string} value - The URI component to be decoded.
|
@@ -61404,7 +62030,7 @@ Phaser.Net.prototype.constructor = Phaser.Net;
|
|
61404
62030
|
|
61405
62031
|
/**
|
61406
62032
|
* @author Richard Davey <rich@photonstorm.com>
|
61407
|
-
* @copyright
|
62033
|
+
* @copyright 2016 Photon Storm Ltd.
|
61408
62034
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
61409
62035
|
*/
|
61410
62036
|
|
@@ -61765,7 +62391,7 @@ Phaser.TweenManager.prototype.constructor = Phaser.TweenManager;
|
|
61765
62391
|
|
61766
62392
|
/**
|
61767
62393
|
* @author Richard Davey <rich@photonstorm.com>
|
61768
|
-
* @copyright
|
62394
|
+
* @copyright 2016 Photon Storm Ltd.
|
61769
62395
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
61770
62396
|
*/
|
61771
62397
|
|
@@ -61842,8 +62468,9 @@ Phaser.Tween = function (target, game, manager) {
|
|
61842
62468
|
this.onStart = new Phaser.Signal();
|
61843
62469
|
|
61844
62470
|
/**
|
61845
|
-
* The onLoop event is fired if the Tween or any child
|
62471
|
+
* The onLoop event is fired if the Tween, or any child tweens loop.
|
61846
62472
|
* It will be sent 2 parameters: the target object and this tween.
|
62473
|
+
*
|
61847
62474
|
* @property {Phaser.Signal} onLoop
|
61848
62475
|
*/
|
61849
62476
|
this.onLoop = new Phaser.Signal();
|
@@ -62312,10 +62939,9 @@ Phaser.Tween.prototype = {
|
|
62312
62939
|
/**
|
62313
62940
|
* Set how many times this tween and all of its children will repeat.
|
62314
62941
|
* A tween (A) with 3 children (B,C,D) with a `repeatAll` value of 2 would play as: ABCDABCD before completing.
|
62315
|
-
* When all child tweens have completed Tween.onLoop will be dispatched.
|
62316
62942
|
*
|
62317
|
-
* @method Phaser.Tween#
|
62318
|
-
* @param {number} total - How many times this tween and all children should repeat before completing. Set to zero to remove an active repeat. Set to -1 to repeat forever.
|
62943
|
+
* @method Phaser.Tween#repeatAll
|
62944
|
+
* @param {number} [total=0] - How many times this tween and all children should repeat before completing. Set to zero to remove an active repeat. Set to -1 to repeat forever.
|
62319
62945
|
* @return {Phaser.Tween} This tween. Useful for method chaining.
|
62320
62946
|
*/
|
62321
62947
|
repeatAll: function (total) {
|
@@ -62363,7 +62989,8 @@ Phaser.Tween.prototype = {
|
|
62363
62989
|
},
|
62364
62990
|
|
62365
62991
|
/**
|
62366
|
-
* Enables the looping of this tween
|
62992
|
+
* Enables the looping of this tween. The tween will loop forever, and onComplete will never fire.
|
62993
|
+
*
|
62367
62994
|
* If `value` is `true` then this is the same as setting `Tween.repeatAll(-1)`.
|
62368
62995
|
* If `value` is `false` it is the same as setting `Tween.repeatAll(0)` and will reset the `repeatCounter` to zero.
|
62369
62996
|
*
|
@@ -62374,21 +63001,14 @@ Phaser.Tween.prototype = {
|
|
62374
63001
|
* .to({ y: 0 }, 1000, Phaser.Easing.Linear.None)
|
62375
63002
|
* .loop();
|
62376
63003
|
* @method Phaser.Tween#loop
|
62377
|
-
* @param {boolean} [value=true] - If `true` this tween
|
63004
|
+
* @param {boolean} [value=true] - If `true` this tween will loop once it reaches the end. Set to `false` to remove an active loop.
|
62378
63005
|
* @return {Phaser.Tween} This tween. Useful for method chaining.
|
62379
63006
|
*/
|
62380
63007
|
loop: function (value) {
|
62381
63008
|
|
62382
63009
|
if (value === undefined) { value = true; }
|
62383
63010
|
|
62384
|
-
|
62385
|
-
{
|
62386
|
-
this.repeatAll(-1);
|
62387
|
-
}
|
62388
|
-
else
|
62389
|
-
{
|
62390
|
-
this.repeatCounter = 0;
|
62391
|
-
}
|
63011
|
+
this.repeatCounter = (value) ? -1 : 0;
|
62392
63012
|
|
62393
63013
|
return this;
|
62394
63014
|
|
@@ -62494,7 +63114,7 @@ Phaser.Tween.prototype = {
|
|
62494
63114
|
*/
|
62495
63115
|
update: function (time) {
|
62496
63116
|
|
62497
|
-
if (this.pendingDelete)
|
63117
|
+
if (this.pendingDelete || !this.target)
|
62498
63118
|
{
|
62499
63119
|
return false;
|
62500
63120
|
}
|
@@ -62528,7 +63148,7 @@ Phaser.Tween.prototype = {
|
|
62528
63148
|
}
|
62529
63149
|
else if (status === Phaser.TweenData.LOOPED)
|
62530
63150
|
{
|
62531
|
-
if (this.repeatCounter === -1)
|
63151
|
+
if (this.timeline[this.current].repeatCounter === -1)
|
62532
63152
|
{
|
62533
63153
|
this.onLoop.dispatch(this.target, this);
|
62534
63154
|
}
|
@@ -62536,6 +63156,7 @@ Phaser.Tween.prototype = {
|
|
62536
63156
|
{
|
62537
63157
|
this.onRepeat.dispatch(this.target, this);
|
62538
63158
|
}
|
63159
|
+
|
62539
63160
|
return true;
|
62540
63161
|
}
|
62541
63162
|
else if (status === Phaser.TweenData.COMPLETE)
|
@@ -62625,13 +63246,8 @@ Phaser.Tween.prototype = {
|
|
62625
63246
|
return null;
|
62626
63247
|
}
|
62627
63248
|
|
62628
|
-
if (frameRate === undefined) {
|
62629
|
-
|
62630
|
-
}
|
62631
|
-
|
62632
|
-
if (data === undefined) {
|
62633
|
-
data = [];
|
62634
|
-
}
|
63249
|
+
if (frameRate === undefined) { frameRate = 60; }
|
63250
|
+
if (data === undefined) { data = []; }
|
62635
63251
|
|
62636
63252
|
// Populate the tween data
|
62637
63253
|
for (var i = 0; i < this.timeline.length; i++)
|
@@ -62690,7 +63306,7 @@ Phaser.Tween.prototype.constructor = Phaser.Tween;
|
|
62690
63306
|
|
62691
63307
|
/**
|
62692
63308
|
* @author Richard Davey <rich@photonstorm.com>
|
62693
|
-
* @copyright
|
63309
|
+
* @copyright 2016 Photon Storm Ltd.
|
62694
63310
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
62695
63311
|
*/
|
62696
63312
|
|
@@ -62767,6 +63383,12 @@ Phaser.TweenData = function (parent) {
|
|
62767
63383
|
*/
|
62768
63384
|
this.repeatDelay = 0;
|
62769
63385
|
|
63386
|
+
/**
|
63387
|
+
* @property {number} repeatTotal - The total number of times this Tween will repeat.
|
63388
|
+
* @readonly
|
63389
|
+
*/
|
63390
|
+
this.repeatTotal = 0;
|
63391
|
+
|
62770
63392
|
/**
|
62771
63393
|
* @property {boolean} interpolate - True if the Tween will use interpolation (i.e. is an Array to Array tween)
|
62772
63394
|
* @default
|
@@ -62883,7 +63505,7 @@ Phaser.TweenData.prototype = {
|
|
62883
63505
|
this.duration = duration;
|
62884
63506
|
this.easingFunction = ease;
|
62885
63507
|
this.delay = delay;
|
62886
|
-
this.
|
63508
|
+
this.repeatTotal = repeat;
|
62887
63509
|
this.yoyo = yoyo;
|
62888
63510
|
|
62889
63511
|
this.isFrom = false;
|
@@ -62911,7 +63533,7 @@ Phaser.TweenData.prototype = {
|
|
62911
63533
|
this.duration = duration;
|
62912
63534
|
this.easingFunction = ease;
|
62913
63535
|
this.delay = delay;
|
62914
|
-
this.
|
63536
|
+
this.repeatTotal = repeat;
|
62915
63537
|
this.yoyo = yoyo;
|
62916
63538
|
|
62917
63539
|
this.isFrom = true;
|
@@ -62961,6 +63583,7 @@ Phaser.TweenData.prototype = {
|
|
62961
63583
|
|
62962
63584
|
this.value = 0;
|
62963
63585
|
this.yoyoCounter = 0;
|
63586
|
+
this.repeatCounter = this.repeatTotal;
|
62964
63587
|
|
62965
63588
|
return this;
|
62966
63589
|
|
@@ -63264,7 +63887,7 @@ Phaser.TweenData.prototype.constructor = Phaser.TweenData;
|
|
63264
63887
|
|
63265
63888
|
/**
|
63266
63889
|
* @author Richard Davey <rich@photonstorm.com>
|
63267
|
-
* @copyright
|
63890
|
+
* @copyright 2016 Photon Storm Ltd.
|
63268
63891
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
63269
63892
|
*/
|
63270
63893
|
|
@@ -63839,7 +64462,7 @@ Phaser.Easing.Power4 = Phaser.Easing.Quintic.Out;
|
|
63839
64462
|
|
63840
64463
|
/**
|
63841
64464
|
* @author Richard Davey <rich@photonstorm.com>
|
63842
|
-
* @copyright
|
64465
|
+
* @copyright 2016 Photon Storm Ltd.
|
63843
64466
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
63844
64467
|
*/
|
63845
64468
|
|
@@ -64468,7 +65091,7 @@ Phaser.Time.prototype.constructor = Phaser.Time;
|
|
64468
65091
|
|
64469
65092
|
/**
|
64470
65093
|
* @author Richard Davey <rich@photonstorm.com>
|
64471
|
-
* @copyright
|
65094
|
+
* @copyright 2016 Photon Storm Ltd.
|
64472
65095
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
64473
65096
|
*/
|
64474
65097
|
|
@@ -65225,7 +65848,7 @@ Phaser.Timer.prototype.constructor = Phaser.Timer;
|
|
65225
65848
|
|
65226
65849
|
/**
|
65227
65850
|
* @author Richard Davey <rich@photonstorm.com>
|
65228
|
-
* @copyright
|
65851
|
+
* @copyright 2016 Photon Storm Ltd.
|
65229
65852
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
65230
65853
|
*/
|
65231
65854
|
|
@@ -65235,7 +65858,7 @@ Phaser.Timer.prototype.constructor = Phaser.Timer;
|
|
65235
65858
|
* It consists of a delay, which is a value in milliseconds after which the event will fire.
|
65236
65859
|
* When the event fires it calls a specific callback with the specified arguments.
|
65237
65860
|
*
|
65238
|
-
* Use {@link Phaser.Timer#add}, {@link Phaser.Timer#
|
65861
|
+
* Use {@link Phaser.Timer#add}, {@link Phaser.Timer#repeat}, or {@link Phaser.Timer#loop} methods to create a new event.
|
65239
65862
|
*
|
65240
65863
|
* @class Phaser.TimerEvent
|
65241
65864
|
* @constructor
|
@@ -65304,7 +65927,7 @@ Phaser.TimerEvent.prototype.constructor = Phaser.TimerEvent;
|
|
65304
65927
|
|
65305
65928
|
/**
|
65306
65929
|
* @author Richard Davey <rich@photonstorm.com>
|
65307
|
-
* @copyright
|
65930
|
+
* @copyright 2016 Photon Storm Ltd.
|
65308
65931
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
65309
65932
|
*/
|
65310
65933
|
|
@@ -65873,7 +66496,7 @@ Object.defineProperty(Phaser.AnimationManager.prototype, 'frameName', {
|
|
65873
66496
|
|
65874
66497
|
/**
|
65875
66498
|
* @author Richard Davey <rich@photonstorm.com>
|
65876
|
-
* @copyright
|
66499
|
+
* @copyright 2016 Photon Storm Ltd.
|
65877
66500
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
65878
66501
|
*/
|
65879
66502
|
|
@@ -66695,7 +67318,7 @@ Phaser.Animation.generateFrameNames = function (prefix, start, stop, suffix, zer
|
|
66695
67318
|
|
66696
67319
|
/**
|
66697
67320
|
* @author Richard Davey <rich@photonstorm.com>
|
66698
|
-
* @copyright
|
67321
|
+
* @copyright 2016 Photon Storm Ltd.
|
66699
67322
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
66700
67323
|
*/
|
66701
67324
|
|
@@ -66926,7 +67549,7 @@ Phaser.Frame.prototype.constructor = Phaser.Frame;
|
|
66926
67549
|
|
66927
67550
|
/**
|
66928
67551
|
* @author Richard Davey <rich@photonstorm.com>
|
66929
|
-
* @copyright
|
67552
|
+
* @copyright 2016 Photon Storm Ltd.
|
66930
67553
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
66931
67554
|
*/
|
66932
67555
|
|
@@ -67172,6 +67795,18 @@ Phaser.FrameData.prototype = {
|
|
67172
67795
|
|
67173
67796
|
return output;
|
67174
67797
|
|
67798
|
+
},
|
67799
|
+
|
67800
|
+
/**
|
67801
|
+
* Destroys this FrameData collection by nulling the _frames and _frameNames arrays.
|
67802
|
+
*
|
67803
|
+
* @method Phaser.FrameData#destroy
|
67804
|
+
*/
|
67805
|
+
destroy: function () {
|
67806
|
+
|
67807
|
+
this._frames = null;
|
67808
|
+
this._frameNames = null;
|
67809
|
+
|
67175
67810
|
}
|
67176
67811
|
|
67177
67812
|
};
|
@@ -67193,7 +67828,7 @@ Object.defineProperty(Phaser.FrameData.prototype, "total", {
|
|
67193
67828
|
|
67194
67829
|
/**
|
67195
67830
|
* @author Richard Davey <rich@photonstorm.com>
|
67196
|
-
* @copyright
|
67831
|
+
* @copyright 2016 Photon Storm Ltd.
|
67197
67832
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
67198
67833
|
*/
|
67199
67834
|
|
@@ -67521,7 +68156,7 @@ Phaser.AnimationParser = {
|
|
67521
68156
|
|
67522
68157
|
/**
|
67523
68158
|
* @author Richard Davey <rich@photonstorm.com>
|
67524
|
-
* @copyright
|
68159
|
+
* @copyright 2016 Photon Storm Ltd.
|
67525
68160
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
67526
68161
|
*/
|
67527
68162
|
|
@@ -69544,7 +70179,7 @@ Phaser.Cache.prototype.constructor = Phaser.Cache;
|
|
69544
70179
|
/* jshint wsh:true */
|
69545
70180
|
/**
|
69546
70181
|
* @author Richard Davey <rich@photonstorm.com>
|
69547
|
-
* @copyright
|
70182
|
+
* @copyright 2016 Photon Storm Ltd.
|
69548
70183
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
69549
70184
|
*/
|
69550
70185
|
|
@@ -71658,7 +72293,7 @@ Phaser.Loader.prototype = {
|
|
71658
72293
|
{
|
71659
72294
|
if (file.asBlob)
|
71660
72295
|
{
|
71661
|
-
this.xhrLoad(file, this.transformUrl(file.url, file), '
|
72296
|
+
this.xhrLoad(file, this.transformUrl(file.url, file), 'blob', this.fileComplete);
|
71662
72297
|
}
|
71663
72298
|
else
|
71664
72299
|
{
|
@@ -71819,9 +72454,9 @@ Phaser.Loader.prototype = {
|
|
71819
72454
|
var playThroughEvent = function () {
|
71820
72455
|
file.data.removeEventListener('canplaythrough', playThroughEvent, false);
|
71821
72456
|
file.data.onerror = null;
|
71822
|
-
|
71823
|
-
Phaser.GAMES[_this.game.id].load.fileComplete(file);
|
72457
|
+
_this.fileComplete(file);
|
71824
72458
|
};
|
72459
|
+
|
71825
72460
|
file.data.onerror = function () {
|
71826
72461
|
file.data.removeEventListener('canplaythrough', playThroughEvent, false);
|
71827
72462
|
file.data.onerror = null;
|
@@ -72245,7 +72880,7 @@ Phaser.Loader.prototype = {
|
|
72245
72880
|
{
|
72246
72881
|
try
|
72247
72882
|
{
|
72248
|
-
file.data =
|
72883
|
+
file.data = xhr.response;
|
72249
72884
|
}
|
72250
72885
|
catch (e)
|
72251
72886
|
{
|
@@ -72581,7 +73216,7 @@ Phaser.Loader.prototype.constructor = Phaser.Loader;
|
|
72581
73216
|
|
72582
73217
|
/**
|
72583
73218
|
* @author Richard Davey <rich@photonstorm.com>
|
72584
|
-
* @copyright
|
73219
|
+
* @copyright 2016 Photon Storm Ltd.
|
72585
73220
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
72586
73221
|
*/
|
72587
73222
|
|
@@ -72750,7 +73385,7 @@ Phaser.LoaderParser = {
|
|
72750
73385
|
/**
|
72751
73386
|
* @author Jeremy Dowell <jeremy@codevinsky.com>
|
72752
73387
|
* @author Richard Davey <rich@photonstorm.com>
|
72753
|
-
* @copyright
|
73388
|
+
* @copyright 2016 Photon Storm Ltd.
|
72754
73389
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
72755
73390
|
*/
|
72756
73391
|
|
@@ -72880,7 +73515,7 @@ Phaser.AudioSprite.prototype.constructor = Phaser.AudioSprite;
|
|
72880
73515
|
|
72881
73516
|
/**
|
72882
73517
|
* @author Richard Davey <rich@photonstorm.com>
|
72883
|
-
* @copyright
|
73518
|
+
* @copyright 2016 Photon Storm Ltd.
|
72884
73519
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
72885
73520
|
*/
|
72886
73521
|
|
@@ -73469,7 +74104,7 @@ Phaser.Sound.prototype = {
|
|
73469
74104
|
if (volume === undefined) { volume = this._volume; }
|
73470
74105
|
if (loop === undefined) { loop = this.loop; }
|
73471
74106
|
|
73472
|
-
this.position = position;
|
74107
|
+
this.position = Math.max(0, position);
|
73473
74108
|
this.volume = volume;
|
73474
74109
|
this.loop = loop;
|
73475
74110
|
this.duration = 0;
|
@@ -73575,7 +74210,7 @@ Phaser.Sound.prototype = {
|
|
73575
74210
|
this._sound.currentTime = this.position;
|
73576
74211
|
this._sound.muted = this._muted;
|
73577
74212
|
|
73578
|
-
if (this._muted)
|
74213
|
+
if (this._muted || this.game.sound.mute)
|
73579
74214
|
{
|
73580
74215
|
this._sound.volume = 0;
|
73581
74216
|
}
|
@@ -73650,7 +74285,7 @@ Phaser.Sound.prototype = {
|
|
73650
74285
|
{
|
73651
74286
|
if (this.usingWebAudio)
|
73652
74287
|
{
|
73653
|
-
var p = this.position + (this.pausedPosition / 1000);
|
74288
|
+
var p = Math.max(0, this.position + (this.pausedPosition / 1000));
|
73654
74289
|
|
73655
74290
|
this._sound = this.context.createBufferSource();
|
73656
74291
|
this._sound.buffer = this._buffer;
|
@@ -73781,17 +74416,17 @@ Phaser.Sound.prototype = {
|
|
73781
74416
|
},
|
73782
74417
|
|
73783
74418
|
/**
|
73784
|
-
|
73785
|
-
|
73786
|
-
|
73787
|
-
|
73788
|
-
|
73789
|
-
|
73790
|
-
|
73791
|
-
|
73792
|
-
|
73793
|
-
|
73794
|
-
|
74419
|
+
* Starts this sound playing (or restarts it if already doing so) and sets the volume to zero.
|
74420
|
+
* Then increases the volume from 0 to 1 over the duration specified.
|
74421
|
+
*
|
74422
|
+
* At the end of the fade Sound.onFadeComplete is dispatched with this Sound object as the first parameter,
|
74423
|
+
* and the final volume (1) as the second parameter.
|
74424
|
+
*
|
74425
|
+
* @method Phaser.Sound#fadeIn
|
74426
|
+
* @param {number} [duration=1000] - The time in milliseconds over which the Sound should fade in.
|
74427
|
+
* @param {boolean} [loop=false] - Should the Sound be set to loop? Note that this doesn't cause the fade to repeat.
|
74428
|
+
* @param {string} [marker=(current marker)] - The marker to start at; defaults to the current (last played) marker. To start playing from the beginning specify specify a marker of `''`.
|
74429
|
+
*/
|
73795
74430
|
fadeIn: function (duration, loop, marker) {
|
73796
74431
|
|
73797
74432
|
if (loop === undefined) { loop = false; }
|
@@ -73809,13 +74444,13 @@ Phaser.Sound.prototype = {
|
|
73809
74444
|
},
|
73810
74445
|
|
73811
74446
|
/**
|
73812
|
-
|
73813
|
-
|
73814
|
-
|
73815
|
-
|
73816
|
-
|
73817
|
-
|
73818
|
-
|
74447
|
+
* Decreases the volume of this Sound from its current value to 0 over the duration specified.
|
74448
|
+
* At the end of the fade Sound.onFadeComplete is dispatched with this Sound object as the first parameter,
|
74449
|
+
* and the final volume (0) as the second parameter.
|
74450
|
+
*
|
74451
|
+
* @method Phaser.Sound#fadeOut
|
74452
|
+
* @param {number} [duration=1000] - The time in milliseconds over which the Sound should fade out.
|
74453
|
+
*/
|
73819
74454
|
fadeOut: function (duration) {
|
73820
74455
|
|
73821
74456
|
this.fadeTo(duration, 0);
|
@@ -73823,14 +74458,14 @@ Phaser.Sound.prototype = {
|
|
73823
74458
|
},
|
73824
74459
|
|
73825
74460
|
/**
|
73826
|
-
|
73827
|
-
|
73828
|
-
|
73829
|
-
|
73830
|
-
|
73831
|
-
|
73832
|
-
|
73833
|
-
|
74461
|
+
* Fades the volume of this Sound from its current value to the given volume over the duration specified.
|
74462
|
+
* At the end of the fade Sound.onFadeComplete is dispatched with this Sound object as the first parameter,
|
74463
|
+
* and the final volume (volume) as the second parameter.
|
74464
|
+
*
|
74465
|
+
* @method Phaser.Sound#fadeTo
|
74466
|
+
* @param {number} [duration=1000] - The time in milliseconds during which the Sound should fade out.
|
74467
|
+
* @param {number} [volume] - The volume which the Sound should fade to. This is a value between 0 and 1.
|
74468
|
+
*/
|
73834
74469
|
fadeTo: function (duration, volume) {
|
73835
74470
|
|
73836
74471
|
if (!this.isPlaying || this.paused || volume === this.volume)
|
@@ -73853,11 +74488,11 @@ Phaser.Sound.prototype = {
|
|
73853
74488
|
},
|
73854
74489
|
|
73855
74490
|
/**
|
73856
|
-
|
73857
|
-
|
73858
|
-
|
73859
|
-
|
73860
|
-
|
74491
|
+
* Internal handler for Sound.fadeIn, Sound.fadeOut and Sound.fadeTo.
|
74492
|
+
*
|
74493
|
+
* @method Phaser.Sound#fadeComplete
|
74494
|
+
* @private
|
74495
|
+
*/
|
73861
74496
|
fadeComplete: function () {
|
73862
74497
|
|
73863
74498
|
this.onFadeComplete.dispatch(this, this.volume);
|
@@ -73869,6 +74504,28 @@ Phaser.Sound.prototype = {
|
|
73869
74504
|
|
73870
74505
|
},
|
73871
74506
|
|
74507
|
+
/**
|
74508
|
+
* Called automatically by SoundManager.volume.
|
74509
|
+
*
|
74510
|
+
* Sets the volume of AudioTag Sounds as a percentage of the Global Volume.
|
74511
|
+
*
|
74512
|
+
* You should not normally call this directly.
|
74513
|
+
*
|
74514
|
+
* @method Phaser.Sound#updateGlobalVolume
|
74515
|
+
* @protected
|
74516
|
+
* @param {float} globalVolume - The global SoundManager volume.
|
74517
|
+
*/
|
74518
|
+
updateGlobalVolume: function (globalVolume) {
|
74519
|
+
|
74520
|
+
// this._volume is the % of the global volume this sound should be played at
|
74521
|
+
|
74522
|
+
if (this.usingAudioTag && this._sound)
|
74523
|
+
{
|
74524
|
+
this._sound.volume = globalVolume * this._volume;
|
74525
|
+
}
|
74526
|
+
|
74527
|
+
},
|
74528
|
+
|
73872
74529
|
/**
|
73873
74530
|
* Destroys this sound and all associated events and removes it from the SoundManager.
|
73874
74531
|
*
|
@@ -74031,7 +74688,7 @@ Object.defineProperty(Phaser.Sound.prototype, "volume", {
|
|
74031
74688
|
|
74032
74689
|
/**
|
74033
74690
|
* @author Richard Davey <rich@photonstorm.com>
|
74034
|
-
* @copyright
|
74691
|
+
* @copyright 2016 Photon Storm Ltd.
|
74035
74692
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
74036
74693
|
*/
|
74037
74694
|
|
@@ -74047,7 +74704,8 @@ Object.defineProperty(Phaser.Sound.prototype, "volume", {
|
|
74047
74704
|
*
|
74048
74705
|
* Mobile warning: There are some mobile devices (certain iPad 2 and iPad Mini revisions) that cannot play 48000 Hz audio.
|
74049
74706
|
* When they try to play the audio becomes extremely distorted and buzzes, eventually crashing the sound system.
|
74050
|
-
* The solution is to use a lower encoding rate such as 44100 Hz.
|
74707
|
+
* The solution is to use a lower encoding rate such as 44100 Hz. Sometimes the audio context will
|
74708
|
+
* be created with a sampleRate of 48000. If this happens and audio distorts you should re-create the context.
|
74051
74709
|
*
|
74052
74710
|
* @class Phaser.SoundManager
|
74053
74711
|
* @constructor
|
@@ -74125,6 +74783,15 @@ Phaser.SoundManager = function (game) {
|
|
74125
74783
|
*/
|
74126
74784
|
this.channels = 32;
|
74127
74785
|
|
74786
|
+
/**
|
74787
|
+
* Set to true to have all sound muted when the Phaser game pauses (such as on loss of focus),
|
74788
|
+
* or set to false to keep audio playing, regardless of the game pause state. You may need to
|
74789
|
+
* do this should you wish to control audio muting via external DOM buttons or similar.
|
74790
|
+
* @property {boolean} muteOnPause
|
74791
|
+
* @default
|
74792
|
+
*/
|
74793
|
+
this.muteOnPause = true;
|
74794
|
+
|
74128
74795
|
/**
|
74129
74796
|
* @property {boolean} _codeMuted - Internal mute tracking var.
|
74130
74797
|
* @private
|
@@ -74291,7 +74958,7 @@ Phaser.SoundManager.prototype = {
|
|
74291
74958
|
/**
|
74292
74959
|
* Sets the Input Manager touch callback to be SoundManager.unlock.
|
74293
74960
|
* Required for iOS audio device unlocking. Mostly just used internally.
|
74294
|
-
*
|
74961
|
+
*
|
74295
74962
|
* @method Phaser.SoundManager#setTouchLock
|
74296
74963
|
*/
|
74297
74964
|
setTouchLock: function () {
|
@@ -74316,7 +74983,7 @@ Phaser.SoundManager.prototype = {
|
|
74316
74983
|
|
74317
74984
|
/**
|
74318
74985
|
* Enables the audio, usually after the first touch.
|
74319
|
-
*
|
74986
|
+
*
|
74320
74987
|
* @method Phaser.SoundManager#unlock
|
74321
74988
|
* @return {boolean} True if the callback should be removed, otherwise false.
|
74322
74989
|
*/
|
@@ -74761,12 +75428,20 @@ Phaser.SoundManager.prototype = {
|
|
74761
75428
|
|
74762
75429
|
this.onSoundDecode.dispose();
|
74763
75430
|
|
74764
|
-
this.context
|
74765
|
-
|
74766
|
-
if (this.context && window['PhaserGlobal'])
|
75431
|
+
if (this.context)
|
74767
75432
|
{
|
74768
|
-
|
74769
|
-
|
75433
|
+
if (window['PhaserGlobal'])
|
75434
|
+
{
|
75435
|
+
// Store this in the PhaserGlobal window var, if set, to allow for re-use if the game is created again without the page refreshing
|
75436
|
+
window['PhaserGlobal'].audioContext = this.context;
|
75437
|
+
}
|
75438
|
+
else
|
75439
|
+
{
|
75440
|
+
if (this.context.close)
|
75441
|
+
{
|
75442
|
+
this.context.close();
|
75443
|
+
}
|
75444
|
+
}
|
74770
75445
|
}
|
74771
75446
|
|
74772
75447
|
}
|
@@ -74853,7 +75528,7 @@ Object.defineProperty(Phaser.SoundManager.prototype, "volume", {
|
|
74853
75528
|
{
|
74854
75529
|
if (this._sounds[i].usingAudioTag)
|
74855
75530
|
{
|
74856
|
-
this._sounds[i].
|
75531
|
+
this._sounds[i].updateGlobalVolume(value);
|
74857
75532
|
}
|
74858
75533
|
}
|
74859
75534
|
}
|
@@ -74868,7 +75543,7 @@ Object.defineProperty(Phaser.SoundManager.prototype, "volume", {
|
|
74868
75543
|
|
74869
75544
|
/**
|
74870
75545
|
* @author Richard Davey <rich@photonstorm.com>
|
74871
|
-
* @copyright
|
75546
|
+
* @copyright 2016 Photon Storm Ltd.
|
74872
75547
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
74873
75548
|
*/
|
74874
75549
|
|
@@ -77244,7 +77919,7 @@ Object.defineProperty(Phaser.ScaleManager.prototype, "isGameLandscape", {
|
|
77244
77919
|
|
77245
77920
|
/**
|
77246
77921
|
* @author Richard Davey <rich@photonstorm.com>
|
77247
|
-
* @copyright
|
77922
|
+
* @copyright 2016 Photon Storm Ltd.
|
77248
77923
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
77249
77924
|
*/
|
77250
77925
|
|
@@ -77352,16 +78027,38 @@ Phaser.Utils.Debug.prototype = {
|
|
77352
78027
|
this.sprite = this.game.make.image(0, 0, this.bmd);
|
77353
78028
|
this.game.stage.addChild(this.sprite);
|
77354
78029
|
|
78030
|
+
this.game.scale.onSizeChange.add(this.resize, this);
|
78031
|
+
|
77355
78032
|
this.canvas = PIXI.CanvasPool.create(this, this.game.width, this.game.height);
|
77356
78033
|
this.context = this.canvas.getContext('2d');
|
77357
78034
|
}
|
77358
78035
|
|
77359
78036
|
},
|
77360
78037
|
|
78038
|
+
/**
|
78039
|
+
* Internal method that resizes the BitmapData and Canvas.
|
78040
|
+
* Called by ScaleManager.onSizeChange only in WebGL mode.
|
78041
|
+
*
|
78042
|
+
* @method Phaser.Utils.Debug#resize
|
78043
|
+
* @protected
|
78044
|
+
* @param {Phaser.ScaleManager} scaleManager - The Phaser ScaleManager.
|
78045
|
+
* @param {number} width - The new width of the game.
|
78046
|
+
* @param {number} height - The new height of the game.
|
78047
|
+
*/
|
78048
|
+
resize: function (scaleManager, width, height) {
|
78049
|
+
|
78050
|
+
this.bmd.resize(width, height);
|
78051
|
+
|
78052
|
+
this.canvas.width = width;
|
78053
|
+
this.canvas.height = height;
|
78054
|
+
|
78055
|
+
},
|
78056
|
+
|
77361
78057
|
/**
|
77362
78058
|
* Internal method that clears the canvas (if a Sprite) ready for a new debug session.
|
77363
78059
|
*
|
77364
78060
|
* @method Phaser.Utils.Debug#preUpdate
|
78061
|
+
* @protected
|
77365
78062
|
*/
|
77366
78063
|
preUpdate: function () {
|
77367
78064
|
|
@@ -78075,7 +78772,7 @@ Phaser.Utils.Debug.prototype.constructor = Phaser.Utils.Debug;
|
|
78075
78772
|
|
78076
78773
|
/**
|
78077
78774
|
* @author Richard Davey <rich@photonstorm.com>
|
78078
|
-
* @copyright
|
78775
|
+
* @copyright 2016 Photon Storm Ltd.
|
78079
78776
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
78080
78777
|
*/
|
78081
78778
|
|
@@ -78508,7 +79205,7 @@ Phaser.Device.whenReady(function (device) {
|
|
78508
79205
|
|
78509
79206
|
/**
|
78510
79207
|
* @author Richard Davey <rich@photonstorm.com>
|
78511
|
-
* @copyright
|
79208
|
+
* @copyright 2016 Photon Storm Ltd.
|
78512
79209
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
78513
79210
|
*/
|
78514
79211
|
|
@@ -78790,7 +79487,7 @@ Phaser.ArraySet.prototype.constructor = Phaser.ArraySet;
|
|
78790
79487
|
|
78791
79488
|
/**
|
78792
79489
|
* @author Richard Davey <rich@photonstorm.com>
|
78793
|
-
* @copyright
|
79490
|
+
* @copyright 2016 Photon Storm Ltd.
|
78794
79491
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
78795
79492
|
*/
|
78796
79493
|
|
@@ -79083,7 +79780,7 @@ Phaser.ArrayUtils = {
|
|
79083
79780
|
|
79084
79781
|
/**
|
79085
79782
|
* @author Richard Davey <rich@photonstorm.com>
|
79086
|
-
* @copyright
|
79783
|
+
* @copyright 2016 Photon Storm Ltd.
|
79087
79784
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
79088
79785
|
*/
|
79089
79786
|
|
@@ -79272,7 +79969,7 @@ Phaser.LinkedList.prototype.constructor = Phaser.LinkedList;
|
|
79272
79969
|
|
79273
79970
|
/**
|
79274
79971
|
* @author Richard Davey <rich@photonstorm.com>
|
79275
|
-
* @copyright
|
79972
|
+
* @copyright 2016 Photon Storm Ltd.
|
79276
79973
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
79277
79974
|
*/
|
79278
79975
|
|
@@ -79281,7 +79978,7 @@ Phaser.LinkedList.prototype.constructor = Phaser.LinkedList;
|
|
79281
79978
|
* quickly and easily, without the need for any external files. You can create textures for sprites and in
|
79282
79979
|
* coming releases we'll add dynamic sound effect generation support as well (like sfxr).
|
79283
79980
|
*
|
79284
|
-
* Access this via `
|
79981
|
+
* Access this via `Game.create` (`this.game.create` from within a State object)
|
79285
79982
|
*
|
79286
79983
|
* @class Phaser.Create
|
79287
79984
|
* @constructor
|
@@ -79477,7 +80174,7 @@ Phaser.Create.prototype.constructor = Phaser.Create;
|
|
79477
80174
|
|
79478
80175
|
/**
|
79479
80176
|
* @author Richard Davey <rich@photonstorm.com>
|
79480
|
-
* @copyright
|
80177
|
+
* @copyright 2016 Photon Storm Ltd.
|
79481
80178
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
79482
80179
|
*/
|
79483
80180
|
|
@@ -79805,7 +80502,7 @@ Phaser.FlexGrid.prototype.constructor = Phaser.FlexGrid;
|
|
79805
80502
|
|
79806
80503
|
/**
|
79807
80504
|
* @author Richard Davey <rich@photonstorm.com>
|
79808
|
-
* @copyright
|
80505
|
+
* @copyright 2016 Photon Storm Ltd.
|
79809
80506
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
79810
80507
|
*/
|
79811
80508
|
|
@@ -79921,7 +80618,7 @@ Phaser.FlexLayer.prototype.debug = function () {
|
|
79921
80618
|
|
79922
80619
|
/**
|
79923
80620
|
* @author Richard Davey <rich@photonstorm.com>
|
79924
|
-
* @copyright
|
80621
|
+
* @copyright 2016 Photon Storm Ltd.
|
79925
80622
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
79926
80623
|
*/
|
79927
80624
|
|
@@ -81261,7 +81958,7 @@ Phaser.Color = {
|
|
81261
81958
|
|
81262
81959
|
/**
|
81263
81960
|
* @author Richard Davey <rich@photonstorm.com>
|
81264
|
-
* @copyright
|
81961
|
+
* @copyright 2016 Photon Storm Ltd.
|
81265
81962
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
81266
81963
|
*/
|
81267
81964
|
|
@@ -81511,6 +82208,10 @@ Phaser.Physics.prototype = {
|
|
81511
82208
|
{
|
81512
82209
|
this.matter.enable(object);
|
81513
82210
|
}
|
82211
|
+
else
|
82212
|
+
{
|
82213
|
+
console.warn(object.key + ' is attempting to enable a physics body using an unknown physics system.');
|
82214
|
+
}
|
81514
82215
|
|
81515
82216
|
},
|
81516
82217
|
|
@@ -81689,7 +82390,7 @@ Phaser.Physics.prototype.constructor = Phaser.Physics;
|
|
81689
82390
|
|
81690
82391
|
/**
|
81691
82392
|
* @author Richard Davey <rich@photonstorm.com>
|
81692
|
-
* @copyright
|
82393
|
+
* @copyright 2016 Photon Storm Ltd.
|
81693
82394
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
81694
82395
|
*/
|
81695
82396
|
|
@@ -82636,42 +83337,46 @@ Phaser.Physics.Arcade.prototype = {
|
|
82636
83337
|
return false;
|
82637
83338
|
}
|
82638
83339
|
|
82639
|
-
|
82640
|
-
|
82641
|
-
var result = false;
|
83340
|
+
var resultX = false;
|
83341
|
+
var resultY = false;
|
82642
83342
|
|
82643
|
-
//
|
83343
|
+
// Do we separate on x or y first?
|
82644
83344
|
if (this.forceX || Math.abs(this.gravity.y + body1.gravity.y) < Math.abs(this.gravity.x + body1.gravity.x))
|
82645
83345
|
{
|
82646
|
-
|
82647
|
-
}
|
82648
|
-
else
|
82649
|
-
{
|
82650
|
-
result = (this.separateY(body1, body2, overlapOnly) || this.separateX(body1, body2, overlapOnly));
|
82651
|
-
}
|
83346
|
+
resultX = this.separateX(body1, body2, overlapOnly);
|
82652
83347
|
|
82653
|
-
|
82654
|
-
|
82655
|
-
|
82656
|
-
|
83348
|
+
// Are they still intersecting? Let's do the other axis then
|
83349
|
+
if (this.intersects(body1, body2))
|
83350
|
+
{
|
83351
|
+
resultY = this.separateY(body1, body2, overlapOnly);
|
83352
|
+
}
|
82657
83353
|
}
|
82658
83354
|
else
|
82659
83355
|
{
|
82660
|
-
|
83356
|
+
resultY = this.separateY(body1, body2, overlapOnly);
|
83357
|
+
|
83358
|
+
// Are they still intersecting? Let's do the other axis then
|
83359
|
+
if (this.intersects(body1, body2))
|
83360
|
+
{
|
83361
|
+
resultX = this.separateX(body1, body2, overlapOnly);
|
83362
|
+
}
|
82661
83363
|
}
|
82662
83364
|
|
83365
|
+
return (resultX || resultY);
|
83366
|
+
|
82663
83367
|
},
|
82664
83368
|
|
82665
83369
|
/**
|
82666
83370
|
* Check for intersection against two bodies.
|
82667
83371
|
*
|
82668
83372
|
* @method Phaser.Physics.Arcade#intersects
|
82669
|
-
* @param {Phaser.Physics.Arcade.Body} body1 - The Body object to check.
|
82670
|
-
* @param {Phaser.Physics.Arcade.Body} body2 - The Body object to check.
|
83373
|
+
* @param {Phaser.Physics.Arcade.Body} body1 - The first Body object to check.
|
83374
|
+
* @param {Phaser.Physics.Arcade.Body} body2 - The second Body object to check.
|
82671
83375
|
* @return {boolean} True if they intersect, otherwise false.
|
82672
83376
|
*/
|
82673
83377
|
intersects: function (body1, body2) {
|
82674
83378
|
|
83379
|
+
// Rect vs. Rect
|
82675
83380
|
if (body1.right <= body2.position.x)
|
82676
83381
|
{
|
82677
83382
|
return false;
|
@@ -82697,261 +83402,268 @@ Phaser.Physics.Arcade.prototype = {
|
|
82697
83402
|
},
|
82698
83403
|
|
82699
83404
|
/**
|
82700
|
-
*
|
83405
|
+
* Calculates the horizontal overlap between two Bodies and sets their properties accordingly, including:
|
83406
|
+
* `touching.left`, `touching.right` and `overlapX`.
|
82701
83407
|
*
|
82702
|
-
* @
|
82703
|
-
* @
|
82704
|
-
* @param {Phaser.Physics.Arcade.Body}
|
82705
|
-
* @
|
82706
|
-
* @param {boolean} overlapOnly - If true the bodies will only have their overlap data set, no separation or exchange of velocity will take place.
|
82707
|
-
* @return {boolean} Returns true if the bodies were separated, otherwise false.
|
83408
|
+
* @method Phaser.Physics.Arcade#getOverlapX
|
83409
|
+
* @param {Phaser.Physics.Arcade.Body} body1 - The first Body to separate.
|
83410
|
+
* @param {Phaser.Physics.Arcade.Body} body2 - The second Body to separate.
|
83411
|
+
* @return {float} Returns the amount of horizontal overlap between the two bodies.
|
82708
83412
|
*/
|
82709
|
-
|
82710
|
-
|
82711
|
-
// Can't separate two immovable bodies
|
82712
|
-
if (body1.immovable && body2.immovable)
|
82713
|
-
{
|
82714
|
-
return false;
|
82715
|
-
}
|
83413
|
+
getOverlapX: function (body1, body2) {
|
82716
83414
|
|
82717
83415
|
var overlap = 0;
|
83416
|
+
var maxOverlap = body1.deltaAbsX() + body2.deltaAbsX() + this.OVERLAP_BIAS;
|
82718
83417
|
|
82719
|
-
|
82720
|
-
if (this.intersects(body1, body2))
|
83418
|
+
if (body1.deltaX() === 0 && body2.deltaX() === 0)
|
82721
83419
|
{
|
82722
|
-
|
83420
|
+
// They overlap but neither of them are moving
|
83421
|
+
body1.embedded = true;
|
83422
|
+
body2.embedded = true;
|
83423
|
+
}
|
83424
|
+
else if (body1.deltaX() > body2.deltaX())
|
83425
|
+
{
|
83426
|
+
// Body1 is moving right and / or Body2 is moving left
|
83427
|
+
overlap = body1.right - body2.x;
|
82723
83428
|
|
82724
|
-
if (
|
83429
|
+
if ((overlap > maxOverlap) || body1.checkCollision.right === false || body2.checkCollision.left === false)
|
82725
83430
|
{
|
82726
|
-
|
82727
|
-
body1.embedded = true;
|
82728
|
-
body2.embedded = true;
|
83431
|
+
overlap = 0;
|
82729
83432
|
}
|
82730
|
-
else
|
83433
|
+
else
|
82731
83434
|
{
|
82732
|
-
|
82733
|
-
|
82734
|
-
|
82735
|
-
|
82736
|
-
{
|
82737
|
-
overlap = 0;
|
82738
|
-
}
|
82739
|
-
else
|
82740
|
-
{
|
82741
|
-
body1.touching.none = false;
|
82742
|
-
body1.touching.right = true;
|
82743
|
-
body2.touching.none = false;
|
82744
|
-
body2.touching.left = true;
|
82745
|
-
}
|
83435
|
+
body1.touching.none = false;
|
83436
|
+
body1.touching.right = true;
|
83437
|
+
body2.touching.none = false;
|
83438
|
+
body2.touching.left = true;
|
82746
83439
|
}
|
82747
|
-
|
82748
|
-
|
82749
|
-
|
82750
|
-
|
83440
|
+
}
|
83441
|
+
else if (body1.deltaX() < body2.deltaX())
|
83442
|
+
{
|
83443
|
+
// Body1 is moving left and/or Body2 is moving right
|
83444
|
+
overlap = body1.x - body2.width - body2.x;
|
82751
83445
|
|
82752
|
-
|
82753
|
-
|
82754
|
-
|
82755
|
-
}
|
82756
|
-
else
|
82757
|
-
{
|
82758
|
-
body1.touching.none = false;
|
82759
|
-
body1.touching.left = true;
|
82760
|
-
body2.touching.none = false;
|
82761
|
-
body2.touching.right = true;
|
82762
|
-
}
|
83446
|
+
if ((-overlap > maxOverlap) || body1.checkCollision.left === false || body2.checkCollision.right === false)
|
83447
|
+
{
|
83448
|
+
overlap = 0;
|
82763
83449
|
}
|
82764
|
-
|
82765
|
-
// Resets the overlapX to zero if there is no overlap, or to the actual pixel value if there is
|
82766
|
-
body1.overlapX = overlap;
|
82767
|
-
body2.overlapX = overlap;
|
82768
|
-
|
82769
|
-
// Then adjust their positions and velocities accordingly (if there was any overlap)
|
82770
|
-
if (overlap !== 0)
|
83450
|
+
else
|
82771
83451
|
{
|
82772
|
-
|
82773
|
-
|
82774
|
-
|
82775
|
-
|
82776
|
-
|
82777
|
-
|
82778
|
-
var v2 = body2.velocity.x;
|
83452
|
+
body1.touching.none = false;
|
83453
|
+
body1.touching.left = true;
|
83454
|
+
body2.touching.none = false;
|
83455
|
+
body2.touching.right = true;
|
83456
|
+
}
|
83457
|
+
}
|
82779
83458
|
|
82780
|
-
|
82781
|
-
|
82782
|
-
|
83459
|
+
// Resets the overlapX to zero if there is no overlap, or to the actual pixel value if there is
|
83460
|
+
body1.overlapX = overlap;
|
83461
|
+
body2.overlapX = overlap;
|
82783
83462
|
|
82784
|
-
|
82785
|
-
body2.x += overlap;
|
83463
|
+
return overlap;
|
82786
83464
|
|
82787
|
-
|
82788
|
-
var nv2 = Math.sqrt((v1 * v1 * body1.mass) / body2.mass) * ((v1 > 0) ? 1 : -1);
|
82789
|
-
var avg = (nv1 + nv2) * 0.5;
|
83465
|
+
},
|
82790
83466
|
|
82791
|
-
|
82792
|
-
|
83467
|
+
/**
|
83468
|
+
* Calculates the vertical overlap between two Bodies and sets their properties accordingly, including:
|
83469
|
+
* `touching.up`, `touching.down` and `overlapY`.
|
83470
|
+
*
|
83471
|
+
* @method Phaser.Physics.Arcade#getOverlapY
|
83472
|
+
* @param {Phaser.Physics.Arcade.Body} body1 - The first Body to separate.
|
83473
|
+
* @param {Phaser.Physics.Arcade.Body} body2 - The second Body to separate.
|
83474
|
+
* @return {float} Returns the amount of vertical overlap between the two bodies.
|
83475
|
+
*/
|
83476
|
+
getOverlapY: function (body1, body2) {
|
82793
83477
|
|
82794
|
-
|
82795
|
-
|
82796
|
-
}
|
82797
|
-
else if (!body1.immovable)
|
82798
|
-
{
|
82799
|
-
body1.x = body1.x - overlap;
|
82800
|
-
body1.velocity.x = v2 - v1 * body1.bounce.x;
|
83478
|
+
var overlap = 0;
|
83479
|
+
var maxOverlap = body1.deltaAbsY() + body2.deltaAbsY() + this.OVERLAP_BIAS;
|
82801
83480
|
|
82802
|
-
|
82803
|
-
|
82804
|
-
|
82805
|
-
|
82806
|
-
|
82807
|
-
|
82808
|
-
|
82809
|
-
|
82810
|
-
|
82811
|
-
|
83481
|
+
if (body1.deltaY() === 0 && body2.deltaY() === 0)
|
83482
|
+
{
|
83483
|
+
// They overlap but neither of them are moving
|
83484
|
+
body1.embedded = true;
|
83485
|
+
body2.embedded = true;
|
83486
|
+
}
|
83487
|
+
else if (body1.deltaY() > body2.deltaY())
|
83488
|
+
{
|
83489
|
+
// Body1 is moving down and/or Body2 is moving up
|
83490
|
+
overlap = body1.bottom - body2.y;
|
82812
83491
|
|
82813
|
-
|
82814
|
-
|
82815
|
-
|
82816
|
-
|
82817
|
-
|
82818
|
-
|
83492
|
+
if ((overlap > maxOverlap) || body1.checkCollision.down === false || body2.checkCollision.up === false)
|
83493
|
+
{
|
83494
|
+
overlap = 0;
|
83495
|
+
}
|
83496
|
+
else
|
83497
|
+
{
|
83498
|
+
body1.touching.none = false;
|
83499
|
+
body1.touching.down = true;
|
83500
|
+
body2.touching.none = false;
|
83501
|
+
body2.touching.up = true;
|
83502
|
+
}
|
83503
|
+
}
|
83504
|
+
else if (body1.deltaY() < body2.deltaY())
|
83505
|
+
{
|
83506
|
+
// Body1 is moving up and/or Body2 is moving down
|
83507
|
+
overlap = body1.y - body2.bottom;
|
82819
83508
|
|
82820
|
-
|
83509
|
+
if ((-overlap > maxOverlap) || body1.checkCollision.up === false || body2.checkCollision.down === false)
|
83510
|
+
{
|
83511
|
+
overlap = 0;
|
83512
|
+
}
|
83513
|
+
else
|
83514
|
+
{
|
83515
|
+
body1.touching.none = false;
|
83516
|
+
body1.touching.up = true;
|
83517
|
+
body2.touching.none = false;
|
83518
|
+
body2.touching.down = true;
|
82821
83519
|
}
|
82822
83520
|
}
|
82823
83521
|
|
82824
|
-
|
83522
|
+
// Resets the overlapY to zero if there is no overlap, or to the actual pixel value if there is
|
83523
|
+
body1.overlapY = overlap;
|
83524
|
+
body2.overlapY = overlap;
|
83525
|
+
|
83526
|
+
return overlap;
|
82825
83527
|
|
82826
83528
|
},
|
82827
83529
|
|
82828
83530
|
/**
|
82829
|
-
* The core separation function to separate two physics bodies on the
|
83531
|
+
* The core separation function to separate two physics bodies on the x axis.
|
82830
83532
|
*
|
83533
|
+
* @method Phaser.Physics.Arcade#separateX
|
82831
83534
|
* @private
|
82832
|
-
* @
|
82833
|
-
* @param {Phaser.Physics.Arcade.Body}
|
82834
|
-
* @param {Phaser.Physics.Arcade.Body} body2 - The Body object to separate.
|
83535
|
+
* @param {Phaser.Physics.Arcade.Body} body1 - The first Body to separate.
|
83536
|
+
* @param {Phaser.Physics.Arcade.Body} body2 - The second Body to separate.
|
82835
83537
|
* @param {boolean} overlapOnly - If true the bodies will only have their overlap data set, no separation or exchange of velocity will take place.
|
82836
|
-
* @return {boolean} Returns true if the bodies were separated, otherwise false.
|
83538
|
+
* @return {boolean} Returns true if the bodies were separated or overlap, otherwise false.
|
82837
83539
|
*/
|
82838
|
-
|
83540
|
+
separateX: function (body1, body2, overlapOnly) {
|
83541
|
+
|
83542
|
+
var overlap = this.getOverlapX(body1, body2);
|
82839
83543
|
|
82840
|
-
// Can't separate two immovable or
|
82841
|
-
if (body1.immovable && body2.immovable)
|
83544
|
+
// Can't separate two immovable bodies, or a body with its own custom separation logic
|
83545
|
+
if (overlapOnly || overlap === 0 || (body1.immovable && body2.immovable) || body1.customSeparateX || body2.customSeparateX)
|
82842
83546
|
{
|
82843
|
-
return false
|
83547
|
+
// return true if there was some overlap, otherwise false
|
83548
|
+
return (overlap !== 0);
|
82844
83549
|
}
|
82845
83550
|
|
82846
|
-
|
83551
|
+
// Adjust their positions and velocities accordingly (if there was any overlap)
|
83552
|
+
var v1 = body1.velocity.x;
|
83553
|
+
var v2 = body2.velocity.x;
|
83554
|
+
|
83555
|
+
if (!body1.immovable && !body2.immovable)
|
83556
|
+
{
|
83557
|
+
overlap *= 0.5;
|
83558
|
+
|
83559
|
+
body1.x -= overlap;
|
83560
|
+
body2.x += overlap;
|
82847
83561
|
|
82848
|
-
|
82849
|
-
|
83562
|
+
var nv1 = Math.sqrt((v2 * v2 * body2.mass) / body1.mass) * ((v2 > 0) ? 1 : -1);
|
83563
|
+
var nv2 = Math.sqrt((v1 * v1 * body1.mass) / body2.mass) * ((v1 > 0) ? 1 : -1);
|
83564
|
+
var avg = (nv1 + nv2) * 0.5;
|
83565
|
+
|
83566
|
+
nv1 -= avg;
|
83567
|
+
nv2 -= avg;
|
83568
|
+
|
83569
|
+
body1.velocity.x = avg + nv1 * body1.bounce.x;
|
83570
|
+
body2.velocity.x = avg + nv2 * body2.bounce.x;
|
83571
|
+
}
|
83572
|
+
else if (!body1.immovable)
|
82850
83573
|
{
|
82851
|
-
|
83574
|
+
body1.x -= overlap;
|
83575
|
+
body1.velocity.x = v2 - v1 * body1.bounce.x;
|
82852
83576
|
|
82853
|
-
|
83577
|
+
// This is special case code that handles things like vertically moving platforms you can ride
|
83578
|
+
if (body2.moves)
|
82854
83579
|
{
|
82855
|
-
|
82856
|
-
body1.embedded = true;
|
82857
|
-
body2.embedded = true;
|
83580
|
+
body1.y += (body2.y - body2.prev.y) * body2.friction.y;
|
82858
83581
|
}
|
82859
|
-
|
82860
|
-
|
82861
|
-
|
82862
|
-
|
83582
|
+
}
|
83583
|
+
else
|
83584
|
+
{
|
83585
|
+
body2.x += overlap;
|
83586
|
+
body2.velocity.x = v1 - v2 * body2.bounce.x;
|
82863
83587
|
|
82864
|
-
|
82865
|
-
|
82866
|
-
overlap = 0;
|
82867
|
-
}
|
82868
|
-
else
|
82869
|
-
{
|
82870
|
-
body1.touching.none = false;
|
82871
|
-
body1.touching.down = true;
|
82872
|
-
body2.touching.none = false;
|
82873
|
-
body2.touching.up = true;
|
82874
|
-
}
|
82875
|
-
}
|
82876
|
-
else if (body1.deltaY() < body2.deltaY())
|
83588
|
+
// This is special case code that handles things like vertically moving platforms you can ride
|
83589
|
+
if (body1.moves)
|
82877
83590
|
{
|
82878
|
-
|
82879
|
-
overlap = body1.y - body2.bottom;
|
82880
|
-
|
82881
|
-
if ((-overlap > maxOverlap) || body1.checkCollision.up === false || body2.checkCollision.down === false)
|
82882
|
-
{
|
82883
|
-
overlap = 0;
|
82884
|
-
}
|
82885
|
-
else
|
82886
|
-
{
|
82887
|
-
body1.touching.none = false;
|
82888
|
-
body1.touching.up = true;
|
82889
|
-
body2.touching.none = false;
|
82890
|
-
body2.touching.down = true;
|
82891
|
-
}
|
83591
|
+
body2.y += (body1.y - body1.prev.y) * body1.friction.y;
|
82892
83592
|
}
|
83593
|
+
}
|
82893
83594
|
|
82894
|
-
|
82895
|
-
|
82896
|
-
body2.overlapY = overlap;
|
83595
|
+
// If we got this far then there WAS overlap, and separation is complete, so return true
|
83596
|
+
return true;
|
82897
83597
|
|
82898
|
-
|
82899
|
-
if (overlap !== 0)
|
82900
|
-
{
|
82901
|
-
if (overlapOnly || body1.customSeparateY || body2.customSeparateY)
|
82902
|
-
{
|
82903
|
-
return true;
|
82904
|
-
}
|
83598
|
+
},
|
82905
83599
|
|
82906
|
-
|
82907
|
-
|
83600
|
+
/**
|
83601
|
+
* The core separation function to separate two physics bodies on the y axis.
|
83602
|
+
*
|
83603
|
+
* @private
|
83604
|
+
* @method Phaser.Physics.Arcade#separateY
|
83605
|
+
* @param {Phaser.Physics.Arcade.Body} body1 - The first Body to separate.
|
83606
|
+
* @param {Phaser.Physics.Arcade.Body} body2 - The second Body to separate.
|
83607
|
+
* @param {boolean} overlapOnly - If true the bodies will only have their overlap data set, no separation or exchange of velocity will take place.
|
83608
|
+
* @return {boolean} Returns true if the bodies were separated or overlap, otherwise false.
|
83609
|
+
*/
|
83610
|
+
separateY: function (body1, body2, overlapOnly) {
|
82908
83611
|
|
82909
|
-
|
82910
|
-
{
|
82911
|
-
overlap *= 0.5;
|
83612
|
+
var overlap = this.getOverlapY(body1, body2);
|
82912
83613
|
|
82913
|
-
|
82914
|
-
|
83614
|
+
// Can't separate two immovable bodies, or a body with its own custom separation logic
|
83615
|
+
if (overlapOnly || overlap === 0 || (body1.immovable && body2.immovable) || body1.customSeparateY || body2.customSeparateY)
|
83616
|
+
{
|
83617
|
+
// return true if there was some overlap, otherwise false
|
83618
|
+
return (overlap !== 0);
|
83619
|
+
}
|
82915
83620
|
|
82916
|
-
|
82917
|
-
|
82918
|
-
|
83621
|
+
// Adjust their positions and velocities accordingly (if there was any overlap)
|
83622
|
+
var v1 = body1.velocity.y;
|
83623
|
+
var v2 = body2.velocity.y;
|
82919
83624
|
|
82920
|
-
|
82921
|
-
|
83625
|
+
if (!body1.immovable && !body2.immovable)
|
83626
|
+
{
|
83627
|
+
overlap *= 0.5;
|
82922
83628
|
|
82923
|
-
|
82924
|
-
|
82925
|
-
}
|
82926
|
-
else if (!body1.immovable)
|
82927
|
-
{
|
82928
|
-
body1.y = body1.y - overlap;
|
82929
|
-
body1.velocity.y = v2 - v1 * body1.bounce.y;
|
83629
|
+
body1.y -= overlap;
|
83630
|
+
body2.y += overlap;
|
82930
83631
|
|
82931
|
-
|
82932
|
-
|
82933
|
-
|
82934
|
-
body1.x += (body2.x - body2.prev.x) * body2.friction.x;
|
82935
|
-
}
|
82936
|
-
}
|
82937
|
-
else if (!body2.immovable)
|
82938
|
-
{
|
82939
|
-
body2.y += overlap;
|
82940
|
-
body2.velocity.y = v1 - v2 * body2.bounce.y;
|
83632
|
+
var nv1 = Math.sqrt((v2 * v2 * body2.mass) / body1.mass) * ((v2 > 0) ? 1 : -1);
|
83633
|
+
var nv2 = Math.sqrt((v1 * v1 * body1.mass) / body2.mass) * ((v1 > 0) ? 1 : -1);
|
83634
|
+
var avg = (nv1 + nv2) * 0.5;
|
82941
83635
|
|
82942
|
-
|
82943
|
-
|
82944
|
-
{
|
82945
|
-
body2.x += (body1.x - body1.prev.x) * body1.friction.x;
|
82946
|
-
}
|
82947
|
-
}
|
83636
|
+
nv1 -= avg;
|
83637
|
+
nv2 -= avg;
|
82948
83638
|
|
82949
|
-
|
83639
|
+
body1.velocity.y = avg + nv1 * body1.bounce.y;
|
83640
|
+
body2.velocity.y = avg + nv2 * body2.bounce.y;
|
83641
|
+
}
|
83642
|
+
else if (!body1.immovable)
|
83643
|
+
{
|
83644
|
+
body1.y -= overlap;
|
83645
|
+
body1.velocity.y = v2 - v1 * body1.bounce.y;
|
83646
|
+
|
83647
|
+
// This is special case code that handles things like horizontal moving platforms you can ride
|
83648
|
+
if (body2.moves)
|
83649
|
+
{
|
83650
|
+
body1.x += (body2.x - body2.prev.x) * body2.friction.x;
|
82950
83651
|
}
|
83652
|
+
}
|
83653
|
+
else
|
83654
|
+
{
|
83655
|
+
body2.y += overlap;
|
83656
|
+
body2.velocity.y = v1 - v2 * body2.bounce.y;
|
82951
83657
|
|
83658
|
+
// This is special case code that handles things like horizontal moving platforms you can ride
|
83659
|
+
if (body1.moves)
|
83660
|
+
{
|
83661
|
+
body2.x += (body1.x - body1.prev.x) * body1.friction.x;
|
83662
|
+
}
|
82952
83663
|
}
|
82953
83664
|
|
82954
|
-
return
|
83665
|
+
// If we got this far then there WAS overlap, and separation is complete, so return true
|
83666
|
+
return true;
|
82955
83667
|
|
82956
83668
|
},
|
82957
83669
|
|
@@ -83411,7 +84123,7 @@ Phaser.Physics.Arcade.prototype = {
|
|
83411
84123
|
|
83412
84124
|
/**
|
83413
84125
|
* @author Richard Davey <rich@photonstorm.com>
|
83414
|
-
* @copyright
|
84126
|
+
* @copyright 2016 Photon Storm Ltd.
|
83415
84127
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
83416
84128
|
*/
|
83417
84129
|
|
@@ -83878,10 +84590,11 @@ Phaser.Physics.Arcade.Body.prototype = {
|
|
83878
84590
|
|
83879
84591
|
if (this.position.x !== this.prev.x || this.position.y !== this.prev.y)
|
83880
84592
|
{
|
83881
|
-
this.speed = Math.sqrt(this.velocity.x * this.velocity.x + this.velocity.y * this.velocity.y);
|
83882
84593
|
this.angle = Math.atan2(this.velocity.y, this.velocity.x);
|
83883
84594
|
}
|
83884
84595
|
|
84596
|
+
this.speed = Math.sqrt(this.velocity.x * this.velocity.x + this.velocity.y * this.velocity.y);
|
84597
|
+
|
83885
84598
|
// Now the State update will throw collision checks at the Body
|
83886
84599
|
// And finally we'll integrate the new position back to the Sprite in postUpdate
|
83887
84600
|
|
@@ -83978,23 +84691,6 @@ Phaser.Physics.Arcade.Body.prototype = {
|
|
83978
84691
|
|
83979
84692
|
},
|
83980
84693
|
|
83981
|
-
/**
|
83982
|
-
* Removes this bodys reference to its parent sprite, freeing it up for gc.
|
83983
|
-
*
|
83984
|
-
* @method Phaser.Physics.Arcade.Body#destroy
|
83985
|
-
*/
|
83986
|
-
destroy: function () {
|
83987
|
-
|
83988
|
-
if (this.sprite.parent && this.sprite.parent instanceof Phaser.Group)
|
83989
|
-
{
|
83990
|
-
this.sprite.parent.removeFromHash(this.sprite);
|
83991
|
-
}
|
83992
|
-
|
83993
|
-
this.sprite.body = null;
|
83994
|
-
this.sprite = null;
|
83995
|
-
|
83996
|
-
},
|
83997
|
-
|
83998
84694
|
/**
|
83999
84695
|
* Internal method.
|
84000
84696
|
*
|
@@ -84040,6 +84736,9 @@ Phaser.Physics.Arcade.Body.prototype = {
|
|
84040
84736
|
* So it could be smaller or larger than the parent Sprite. You can also control the x and y offset, which
|
84041
84737
|
* is the position of the Body relative to the top-left of the Sprite.
|
84042
84738
|
*
|
84739
|
+
* Calling `setSize` will have no effect if you have previously used `Body.setCircle`. To change a collision
|
84740
|
+
* circle use `setCircle` instead.
|
84741
|
+
*
|
84043
84742
|
* @method Phaser.Physics.Arcade.Body#setSize
|
84044
84743
|
* @param {number} width - The width of the Body.
|
84045
84744
|
* @param {number} height - The height of the Body.
|
@@ -84048,6 +84747,11 @@ Phaser.Physics.Arcade.Body.prototype = {
|
|
84048
84747
|
*/
|
84049
84748
|
setSize: function (width, height, offsetX, offsetY) {
|
84050
84749
|
|
84750
|
+
if (this.isCircle)
|
84751
|
+
{
|
84752
|
+
return;
|
84753
|
+
}
|
84754
|
+
|
84051
84755
|
if (offsetX === undefined) { offsetX = this.offset.x; }
|
84052
84756
|
if (offsetY === undefined) { offsetY = this.offset.y; }
|
84053
84757
|
|
@@ -84063,6 +84767,47 @@ Phaser.Physics.Arcade.Body.prototype = {
|
|
84063
84767
|
|
84064
84768
|
},
|
84065
84769
|
|
84770
|
+
/**
|
84771
|
+
* Sets this Body as using a circle, of the given radius, for all collision detection instead of a rectangle.
|
84772
|
+
* The radius is given in pixels and is the distance from the center of the circle to the edge.
|
84773
|
+
*
|
84774
|
+
* You can also control the x and y offset, which is the position of the Body relative to the top-left of the Sprite.
|
84775
|
+
*
|
84776
|
+
* @method Phaser.Physics.Arcade.Body#setCircle
|
84777
|
+
* @param {number} [radius] - The radius of the Body in pixels. Pass a value of zero / undefined, to stop the Body using a circle for collision.
|
84778
|
+
* @param {number} [offsetX] - The X offset of the Body from the Sprite position.
|
84779
|
+
* @param {number} [offsetY] - The Y offset of the Body from the Sprite position.
|
84780
|
+
*/
|
84781
|
+
setCircle: function (radius, offsetX, offsetY) {
|
84782
|
+
|
84783
|
+
if (offsetX === undefined) { offsetX = this.offset.x; }
|
84784
|
+
if (offsetY === undefined) { offsetY = this.offset.y; }
|
84785
|
+
|
84786
|
+
if (radius > 0)
|
84787
|
+
{
|
84788
|
+
this.isCircle = true;
|
84789
|
+
this.radius = radius;
|
84790
|
+
|
84791
|
+
this.sourceWidth = radius * 2;
|
84792
|
+
this.sourceHeight = radius * 2;
|
84793
|
+
|
84794
|
+
this.width = this.sourceWidth * this._sx;
|
84795
|
+
this.height = this.sourceHeight * this._sy;
|
84796
|
+
|
84797
|
+
this.halfWidth = Math.floor(this.width / 2);
|
84798
|
+
this.halfHeight = Math.floor(this.height / 2);
|
84799
|
+
|
84800
|
+
this.offset.setTo(offsetX, offsetY);
|
84801
|
+
|
84802
|
+
this.center.setTo(this.position.x + this.halfWidth, this.position.y + this.halfHeight);
|
84803
|
+
}
|
84804
|
+
else
|
84805
|
+
{
|
84806
|
+
this.isCircle = false;
|
84807
|
+
}
|
84808
|
+
|
84809
|
+
},
|
84810
|
+
|
84066
84811
|
/**
|
84067
84812
|
* Resets all Body values (velocity, acceleration, rotation, etc)
|
84068
84813
|
*
|
@@ -84104,7 +84849,9 @@ Phaser.Physics.Arcade.Body.prototype = {
|
|
84104
84849
|
* @return {boolean} True if the given coordinates are inside this Body, otherwise false.
|
84105
84850
|
*/
|
84106
84851
|
hitTest: function (x, y) {
|
84107
|
-
|
84852
|
+
|
84853
|
+
return (this.isCircle) ? Phaser.Circle.contains(this, x, y) : Phaser.Rectangle.contains(this, x, y);
|
84854
|
+
|
84108
84855
|
},
|
84109
84856
|
|
84110
84857
|
/**
|
@@ -84114,7 +84861,9 @@ Phaser.Physics.Arcade.Body.prototype = {
|
|
84114
84861
|
* @return {boolean} True if in contact with either the world bounds or a tile.
|
84115
84862
|
*/
|
84116
84863
|
onFloor: function () {
|
84864
|
+
|
84117
84865
|
return this.blocked.down;
|
84866
|
+
|
84118
84867
|
},
|
84119
84868
|
|
84120
84869
|
/**
|
@@ -84124,7 +84873,9 @@ Phaser.Physics.Arcade.Body.prototype = {
|
|
84124
84873
|
* @return {boolean} True if in contact with either the world bounds or a tile.
|
84125
84874
|
*/
|
84126
84875
|
onCeiling: function(){
|
84876
|
+
|
84127
84877
|
return this.blocked.up;
|
84878
|
+
|
84128
84879
|
},
|
84129
84880
|
|
84130
84881
|
/**
|
@@ -84134,7 +84885,9 @@ Phaser.Physics.Arcade.Body.prototype = {
|
|
84134
84885
|
* @return {boolean} True if in contact with either the world bounds or a tile.
|
84135
84886
|
*/
|
84136
84887
|
onWall: function () {
|
84888
|
+
|
84137
84889
|
return (this.blocked.left || this.blocked.right);
|
84890
|
+
|
84138
84891
|
},
|
84139
84892
|
|
84140
84893
|
/**
|
@@ -84144,7 +84897,9 @@ Phaser.Physics.Arcade.Body.prototype = {
|
|
84144
84897
|
* @return {number} The absolute delta value.
|
84145
84898
|
*/
|
84146
84899
|
deltaAbsX: function () {
|
84900
|
+
|
84147
84901
|
return (this.deltaX() > 0 ? this.deltaX() : -this.deltaX());
|
84902
|
+
|
84148
84903
|
},
|
84149
84904
|
|
84150
84905
|
/**
|
@@ -84154,7 +84909,9 @@ Phaser.Physics.Arcade.Body.prototype = {
|
|
84154
84909
|
* @return {number} The absolute delta value.
|
84155
84910
|
*/
|
84156
84911
|
deltaAbsY: function () {
|
84912
|
+
|
84157
84913
|
return (this.deltaY() > 0 ? this.deltaY() : -this.deltaY());
|
84914
|
+
|
84158
84915
|
},
|
84159
84916
|
|
84160
84917
|
/**
|
@@ -84164,7 +84921,9 @@ Phaser.Physics.Arcade.Body.prototype = {
|
|
84164
84921
|
* @return {number} The delta value. Positive if the motion was to the right, negative if to the left.
|
84165
84922
|
*/
|
84166
84923
|
deltaX: function () {
|
84924
|
+
|
84167
84925
|
return this.position.x - this.prev.x;
|
84926
|
+
|
84168
84927
|
},
|
84169
84928
|
|
84170
84929
|
/**
|
@@ -84174,7 +84933,9 @@ Phaser.Physics.Arcade.Body.prototype = {
|
|
84174
84933
|
* @return {number} The delta value. Positive if the motion was downwards, negative if upwards.
|
84175
84934
|
*/
|
84176
84935
|
deltaY: function () {
|
84936
|
+
|
84177
84937
|
return this.position.y - this.prev.y;
|
84938
|
+
|
84178
84939
|
},
|
84179
84940
|
|
84180
84941
|
/**
|
@@ -84184,20 +84945,43 @@ Phaser.Physics.Arcade.Body.prototype = {
|
|
84184
84945
|
* @return {number} The delta value. Positive if the motion was clockwise, negative if anti-clockwise.
|
84185
84946
|
*/
|
84186
84947
|
deltaZ: function () {
|
84948
|
+
|
84187
84949
|
return this.rotation - this.preRotation;
|
84950
|
+
|
84951
|
+
},
|
84952
|
+
|
84953
|
+
/**
|
84954
|
+
* Destroys this Body.
|
84955
|
+
*
|
84956
|
+
* First it calls Group.removeFromHash if the Game Object this Body belongs to is part of a Group.
|
84957
|
+
* Then it nulls the Game Objects body reference, and nulls this Body.sprite reference.
|
84958
|
+
*
|
84959
|
+
* @method Phaser.Physics.Arcade.Body#destroy
|
84960
|
+
*/
|
84961
|
+
destroy: function () {
|
84962
|
+
|
84963
|
+
if (this.sprite.parent && this.sprite.parent instanceof Phaser.Group)
|
84964
|
+
{
|
84965
|
+
this.sprite.parent.removeFromHash(this.sprite);
|
84966
|
+
}
|
84967
|
+
|
84968
|
+
this.sprite.body = null;
|
84969
|
+
this.sprite = null;
|
84970
|
+
|
84188
84971
|
}
|
84189
84972
|
|
84190
84973
|
};
|
84191
84974
|
|
84192
84975
|
/**
|
84193
|
-
* @name Phaser.Physics.Arcade.Body#
|
84194
|
-
* @property {number}
|
84195
|
-
* @readonly
|
84976
|
+
* @name Phaser.Physics.Arcade.Body#left
|
84977
|
+
* @property {number} left - The x position of the Body. The same as `Body.x`.
|
84196
84978
|
*/
|
84197
|
-
Object.defineProperty(Phaser.Physics.Arcade.Body.prototype, "
|
84979
|
+
Object.defineProperty(Phaser.Physics.Arcade.Body.prototype, "left", {
|
84198
84980
|
|
84199
84981
|
get: function () {
|
84200
|
-
|
84982
|
+
|
84983
|
+
return this.position.x;
|
84984
|
+
|
84201
84985
|
}
|
84202
84986
|
|
84203
84987
|
});
|
@@ -84210,7 +84994,38 @@ Object.defineProperty(Phaser.Physics.Arcade.Body.prototype, "bottom", {
|
|
84210
84994
|
Object.defineProperty(Phaser.Physics.Arcade.Body.prototype, "right", {
|
84211
84995
|
|
84212
84996
|
get: function () {
|
84997
|
+
|
84213
84998
|
return this.position.x + this.width;
|
84999
|
+
|
85000
|
+
}
|
85001
|
+
|
85002
|
+
});
|
85003
|
+
|
85004
|
+
/**
|
85005
|
+
* @name Phaser.Physics.Arcade.Body#top
|
85006
|
+
* @property {number} top - The y position of the Body. The same as `Body.y`.
|
85007
|
+
*/
|
85008
|
+
Object.defineProperty(Phaser.Physics.Arcade.Body.prototype, "top", {
|
85009
|
+
|
85010
|
+
get: function () {
|
85011
|
+
|
85012
|
+
return this.position.y;
|
85013
|
+
|
85014
|
+
}
|
85015
|
+
|
85016
|
+
});
|
85017
|
+
|
85018
|
+
/**
|
85019
|
+
* @name Phaser.Physics.Arcade.Body#bottom
|
85020
|
+
* @property {number} bottom - The bottom value of this Body (same as Body.y + Body.height)
|
85021
|
+
* @readonly
|
85022
|
+
*/
|
85023
|
+
Object.defineProperty(Phaser.Physics.Arcade.Body.prototype, "bottom", {
|
85024
|
+
|
85025
|
+
get: function () {
|
85026
|
+
|
85027
|
+
return this.position.y + this.height;
|
85028
|
+
|
84214
85029
|
}
|
84215
85030
|
|
84216
85031
|
});
|
@@ -84222,7 +85037,9 @@ Object.defineProperty(Phaser.Physics.Arcade.Body.prototype, "right", {
|
|
84222
85037
|
Object.defineProperty(Phaser.Physics.Arcade.Body.prototype, "x", {
|
84223
85038
|
|
84224
85039
|
get: function () {
|
85040
|
+
|
84225
85041
|
return this.position.x;
|
85042
|
+
|
84226
85043
|
},
|
84227
85044
|
|
84228
85045
|
set: function (value) {
|
@@ -84239,7 +85056,9 @@ Object.defineProperty(Phaser.Physics.Arcade.Body.prototype, "x", {
|
|
84239
85056
|
Object.defineProperty(Phaser.Physics.Arcade.Body.prototype, "y", {
|
84240
85057
|
|
84241
85058
|
get: function () {
|
85059
|
+
|
84242
85060
|
return this.position.y;
|
85061
|
+
|
84243
85062
|
},
|
84244
85063
|
|
84245
85064
|
set: function (value) {
|
@@ -84302,7 +85121,7 @@ Phaser.Physics.Arcade.Body.prototype.constructor = Phaser.Physics.Arcade.Body;
|
|
84302
85121
|
|
84303
85122
|
/**
|
84304
85123
|
* @author Richard Davey <rich@photonstorm.com>
|
84305
|
-
* @copyright
|
85124
|
+
* @copyright 2016 Photon Storm Ltd.
|
84306
85125
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
84307
85126
|
*/
|
84308
85127
|
|
@@ -84710,7 +85529,7 @@ Phaser.Utils.mixinPrototype(Phaser.Physics.Arcade.prototype, Phaser.Physics.Arca
|
|
84710
85529
|
|
84711
85530
|
/**
|
84712
85531
|
* @author Richard Davey <rich@photonstorm.com>
|
84713
|
-
* @copyright
|
85532
|
+
* @copyright 2016 Photon Storm Ltd.
|
84714
85533
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
84715
85534
|
*/
|
84716
85535
|
|
@@ -85325,9 +86144,9 @@ Phaser.Physics.P2.prototype = {
|
|
85325
86144
|
*/
|
85326
86145
|
updateBoundsCollisionGroup: function (setCollisionGroup) {
|
85327
86146
|
|
85328
|
-
|
86147
|
+
if (setCollisionGroup === undefined) { setCollisionGroup = true; }
|
85329
86148
|
|
85330
|
-
|
86149
|
+
var mask = (setCollisionGroup) ? this.boundsCollisionGroup.mask : this.everythingCollisionGroup.mask;
|
85331
86150
|
|
85332
86151
|
if (this.walls.left)
|
85333
86152
|
{
|
@@ -85349,6 +86168,8 @@ Phaser.Physics.P2.prototype = {
|
|
85349
86168
|
this.walls.bottom.shapes[0].collisionGroup = mask;
|
85350
86169
|
}
|
85351
86170
|
|
86171
|
+
this._boundsOwnGroup = setCollisionGroup;
|
86172
|
+
|
85352
86173
|
},
|
85353
86174
|
|
85354
86175
|
/**
|
@@ -85378,85 +86199,64 @@ Phaser.Physics.P2.prototype = {
|
|
85378
86199
|
if (bottom === undefined) { bottom = this._boundsBottom; }
|
85379
86200
|
if (setCollisionGroup === undefined) { setCollisionGroup = this._boundsOwnGroup; }
|
85380
86201
|
|
85381
|
-
|
85382
|
-
|
85383
|
-
|
85384
|
-
|
86202
|
+
this.setupWall(left, 'left', x, y, 1.5707963267948966, setCollisionGroup);
|
86203
|
+
this.setupWall(right, 'right', x + width, y, -1.5707963267948966, setCollisionGroup);
|
86204
|
+
this.setupWall(top, 'top', x, y, -3.141592653589793, setCollisionGroup);
|
86205
|
+
this.setupWall(bottom, 'bottom', x, y + height, 0, setCollisionGroup);
|
85385
86206
|
|
85386
|
-
|
85387
|
-
|
85388
|
-
|
85389
|
-
|
86207
|
+
// Remember the bounds settings in case they change later on via World.setBounds
|
86208
|
+
this._boundsLeft = left;
|
86209
|
+
this._boundsRight = right;
|
86210
|
+
this._boundsTop = top;
|
86211
|
+
this._boundsBottom = bottom;
|
86212
|
+
this._boundsOwnGroup = setCollisionGroup;
|
85390
86213
|
|
85391
|
-
|
85392
|
-
{
|
85393
|
-
this.world.removeBody(this.walls.top);
|
85394
|
-
}
|
86214
|
+
},
|
85395
86215
|
|
85396
|
-
|
85397
|
-
|
85398
|
-
|
85399
|
-
|
86216
|
+
/**
|
86217
|
+
* Internal method called by setBounds. Responsible for creating, updating or
|
86218
|
+
* removing the wall body shapes.
|
86219
|
+
*
|
86220
|
+
* @method Phaser.Physics.P2#setupWall
|
86221
|
+
* @private
|
86222
|
+
* @param {boolean} create - True to create the wall shape, false to remove it.
|
86223
|
+
* @param {string} wall - The wall segment to update.
|
86224
|
+
* @param {number} x - The x coordinate of the wall.
|
86225
|
+
* @param {number} y - The y coordinate of the wall.
|
86226
|
+
* @param {float} angle - The angle of the wall.
|
86227
|
+
* @param {boolean} [setCollisionGroup=true] - If true the Bounds will be set to use its own Collision Group.
|
86228
|
+
*/
|
86229
|
+
setupWall: function (create, wall, x, y, angle, setCollisionGroup) {
|
85400
86230
|
|
85401
|
-
if (
|
86231
|
+
if (create)
|
85402
86232
|
{
|
85403
|
-
|
85404
|
-
this.walls
|
85405
|
-
|
85406
|
-
if (setCollisionGroup)
|
86233
|
+
// We need a left wall. Do we have one already?
|
86234
|
+
if (this.walls[wall])
|
85407
86235
|
{
|
85408
|
-
this.walls
|
86236
|
+
this.walls[wall].position = [ this.pxmi(x), this.pxmi(y) ];
|
85409
86237
|
}
|
85410
|
-
|
85411
|
-
this.world.addBody(this.walls.left);
|
85412
|
-
}
|
85413
|
-
|
85414
|
-
if (right)
|
85415
|
-
{
|
85416
|
-
this.walls.right = new p2.Body({ mass: 0, position: [ this.pxmi(x + width), this.pxmi(y) ], angle: -1.5707963267948966 });
|
85417
|
-
this.walls.right.addShape(new p2.Plane());
|
85418
|
-
|
85419
|
-
if (setCollisionGroup)
|
86238
|
+
else
|
85420
86239
|
{
|
85421
|
-
this.walls
|
85422
|
-
|
85423
|
-
|
85424
|
-
this.world.addBody(this.walls.right);
|
85425
|
-
}
|
86240
|
+
this.walls[wall] = new p2.Body({ mass: 0, position: [ this.pxmi(x), this.pxmi(y) ], angle: angle });
|
86241
|
+
this.walls[wall].addShape(new p2.Plane());
|
85426
86242
|
|
85427
|
-
|
85428
|
-
|
85429
|
-
|
85430
|
-
|
86243
|
+
if (setCollisionGroup)
|
86244
|
+
{
|
86245
|
+
this.walls[wall].shapes[0].collisionGroup = this.boundsCollisionGroup.mask;
|
86246
|
+
}
|
85431
86247
|
|
85432
|
-
|
85433
|
-
{
|
85434
|
-
this.walls.top.shapes[0].collisionGroup = this.boundsCollisionGroup.mask;
|
86248
|
+
this.world.addBody(this.walls[wall]);
|
85435
86249
|
}
|
85436
|
-
|
85437
|
-
this.world.addBody(this.walls.top);
|
85438
86250
|
}
|
85439
|
-
|
85440
|
-
if (bottom)
|
86251
|
+
else
|
85441
86252
|
{
|
85442
|
-
this.walls
|
85443
|
-
this.walls.bottom.addShape(new p2.Plane());
|
85444
|
-
|
85445
|
-
if (setCollisionGroup)
|
86253
|
+
if (this.walls[wall])
|
85446
86254
|
{
|
85447
|
-
this.
|
86255
|
+
this.world.removeBody(this.walls[wall]);
|
86256
|
+
this.walls[wall] = null;
|
85448
86257
|
}
|
85449
|
-
|
85450
|
-
this.world.addBody(this.walls.bottom);
|
85451
86258
|
}
|
85452
86259
|
|
85453
|
-
// Remember the bounds settings in case they change later on via World.setBounds
|
85454
|
-
this._boundsLeft = left;
|
85455
|
-
this._boundsRight = right;
|
85456
|
-
this._boundsTop = top;
|
85457
|
-
this._boundsBottom = bottom;
|
85458
|
-
this._boundsOwnGroup = setCollisionGroup;
|
85459
|
-
|
85460
86260
|
},
|
85461
86261
|
|
85462
86262
|
/**
|
@@ -86779,7 +87579,7 @@ Object.defineProperty(Phaser.Physics.P2.prototype, "total", {
|
|
86779
87579
|
/**
|
86780
87580
|
* @author Georgios Kaleadis https://github.com/georgiee
|
86781
87581
|
* @author Richard Davey <rich@photonstorm.com>
|
86782
|
-
* @copyright
|
87582
|
+
* @copyright 2016 Photon Storm Ltd.
|
86783
87583
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
86784
87584
|
*/
|
86785
87585
|
|
@@ -87008,7 +87808,7 @@ Phaser.Physics.P2.FixtureList.prototype = {
|
|
87008
87808
|
};
|
87009
87809
|
/**
|
87010
87810
|
* @author Richard Davey <rich@photonstorm.com>
|
87011
|
-
* @copyright
|
87811
|
+
* @copyright 2016 Photon Storm Ltd.
|
87012
87812
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
87013
87813
|
*/
|
87014
87814
|
|
@@ -87111,7 +87911,7 @@ Object.defineProperty(Phaser.Physics.P2.PointProxy.prototype, "my", {
|
|
87111
87911
|
|
87112
87912
|
/**
|
87113
87913
|
* @author Richard Davey <rich@photonstorm.com>
|
87114
|
-
* @copyright
|
87914
|
+
* @copyright 2016 Photon Storm Ltd.
|
87115
87915
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
87116
87916
|
*/
|
87117
87917
|
|
@@ -87214,7 +88014,7 @@ Object.defineProperty(Phaser.Physics.P2.InversePointProxy.prototype, "my", {
|
|
87214
88014
|
|
87215
88015
|
/**
|
87216
88016
|
* @author Richard Davey <rich@photonstorm.com>
|
87217
|
-
* @copyright
|
88017
|
+
* @copyright 2016 Photon Storm Ltd.
|
87218
88018
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
87219
88019
|
*/
|
87220
88020
|
|
@@ -87936,6 +88736,40 @@ Phaser.Physics.P2.Body.prototype = {
|
|
87936
88736
|
|
87937
88737
|
},
|
87938
88738
|
|
88739
|
+
/**
|
88740
|
+
* Applies a force to the Body that causes it to 'thrust' to the left, based on its current angle and the given speed.
|
88741
|
+
* The speed is represented in pixels per second. So a value of 100 would move 100 pixels in 1 second (1000ms).
|
88742
|
+
*
|
88743
|
+
* @method Phaser.Physics.P2.Body#thrustLeft
|
88744
|
+
* @param {number} speed - The speed at which it should move to the left.
|
88745
|
+
*/
|
88746
|
+
thrustLeft: function (speed) {
|
88747
|
+
|
88748
|
+
var magnitude = this.world.pxmi(-speed);
|
88749
|
+
var angle = this.data.angle;
|
88750
|
+
|
88751
|
+
this.data.force[0] += magnitude * Math.cos(angle);
|
88752
|
+
this.data.force[1] += magnitude * Math.sin(angle);
|
88753
|
+
|
88754
|
+
},
|
88755
|
+
|
88756
|
+
/**
|
88757
|
+
* Applies a force to the Body that causes it to 'thrust' to the right, based on its current angle and the given speed.
|
88758
|
+
* The speed is represented in pixels per second. So a value of 100 would move 100 pixels in 1 second (1000ms).
|
88759
|
+
*
|
88760
|
+
* @method Phaser.Physics.P2.Body#thrustRight
|
88761
|
+
* @param {number} speed - The speed at which it should move to the right.
|
88762
|
+
*/
|
88763
|
+
thrustRight: function (speed) {
|
88764
|
+
|
88765
|
+
var magnitude = this.world.pxmi(-speed);
|
88766
|
+
var angle = this.data.angle;
|
88767
|
+
|
88768
|
+
this.data.force[0] -= magnitude * Math.cos(angle);
|
88769
|
+
this.data.force[1] -= magnitude * Math.sin(angle);
|
88770
|
+
|
88771
|
+
},
|
88772
|
+
|
87939
88773
|
/**
|
87940
88774
|
* Applies a force to the Body that causes it to 'thrust' backwards (in reverse), based on its current angle and the given speed.
|
87941
88775
|
* The speed is represented in pixels per second. So a value of 100 would move 100 pixels in 1 second (1000ms).
|
@@ -88031,8 +88865,8 @@ Phaser.Physics.P2.Body.prototype = {
|
|
88031
88865
|
*/
|
88032
88866
|
postUpdate: function () {
|
88033
88867
|
|
88034
|
-
this.sprite.x = this.world.mpxi(this.data.position[0]);
|
88035
|
-
this.sprite.y = this.world.mpxi(this.data.position[1]);
|
88868
|
+
this.sprite.x = this.world.mpxi(this.data.position[0]) + this.offset.x;
|
88869
|
+
this.sprite.y = this.world.mpxi(this.data.position[1]) + this.offset.y;
|
88036
88870
|
|
88037
88871
|
if (!this.fixedRotation)
|
88038
88872
|
{
|
@@ -89163,7 +89997,7 @@ Object.defineProperty(Phaser.Physics.P2.Body.prototype, "collideWorldBounds", {
|
|
89163
89997
|
/**
|
89164
89998
|
* @author George https://github.com/georgiee
|
89165
89999
|
* @author Richard Davey <rich@photonstorm.com>
|
89166
|
-
* @copyright
|
90000
|
+
* @copyright 2016 Photon Storm Ltd.
|
89167
90001
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
89168
90002
|
*/
|
89169
90003
|
|
@@ -89620,7 +90454,7 @@ Phaser.Utils.extend(Phaser.Physics.P2.BodyDebug.prototype, {
|
|
89620
90454
|
var hex;
|
89621
90455
|
hex = c.toString(16);
|
89622
90456
|
|
89623
|
-
if (hex.
|
90457
|
+
if (hex.length === 2)
|
89624
90458
|
{
|
89625
90459
|
return hex;
|
89626
90460
|
}
|
@@ -89635,7 +90469,7 @@ Phaser.Utils.extend(Phaser.Physics.P2.BodyDebug.prototype, {
|
|
89635
90469
|
|
89636
90470
|
/**
|
89637
90471
|
* @author Richard Davey <rich@photonstorm.com>
|
89638
|
-
* @copyright
|
90472
|
+
* @copyright 2016 Photon Storm Ltd.
|
89639
90473
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
89640
90474
|
*/
|
89641
90475
|
|
@@ -89712,7 +90546,7 @@ Phaser.Physics.P2.Spring.prototype.constructor = Phaser.Physics.P2.Spring;
|
|
89712
90546
|
|
89713
90547
|
/**
|
89714
90548
|
* @author Richard Davey <rich@photonstorm.com>
|
89715
|
-
* @copyright
|
90549
|
+
* @copyright 2016 Photon Storm Ltd.
|
89716
90550
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
89717
90551
|
*/
|
89718
90552
|
|
@@ -89768,7 +90602,7 @@ Phaser.Physics.P2.Spring.prototype.constructor = Phaser.Physics.P2.Spring;
|
|
89768
90602
|
|
89769
90603
|
/**
|
89770
90604
|
* @author Richard Davey <rich@photonstorm.com>
|
89771
|
-
* @copyright
|
90605
|
+
* @copyright 2016 Photon Storm Ltd.
|
89772
90606
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
89773
90607
|
*/
|
89774
90608
|
|
@@ -89798,7 +90632,7 @@ Phaser.Physics.P2.Material.prototype.constructor = Phaser.Physics.P2.Material;
|
|
89798
90632
|
|
89799
90633
|
/**
|
89800
90634
|
* @author Richard Davey <rich@photonstorm.com>
|
89801
|
-
* @copyright
|
90635
|
+
* @copyright 2016 Photon Storm Ltd.
|
89802
90636
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
89803
90637
|
*/
|
89804
90638
|
|
@@ -89862,7 +90696,7 @@ Phaser.Physics.P2.ContactMaterial.prototype.constructor = Phaser.Physics.P2.Cont
|
|
89862
90696
|
|
89863
90697
|
/**
|
89864
90698
|
* @author Richard Davey <rich@photonstorm.com>
|
89865
|
-
* @copyright
|
90699
|
+
* @copyright 2016 Photon Storm Ltd.
|
89866
90700
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
89867
90701
|
*/
|
89868
90702
|
|
@@ -89884,7 +90718,7 @@ Phaser.Physics.P2.CollisionGroup = function (bitmask) {
|
|
89884
90718
|
|
89885
90719
|
/**
|
89886
90720
|
* @author Richard Davey <rich@photonstorm.com>
|
89887
|
-
* @copyright
|
90721
|
+
* @copyright 2016 Photon Storm Ltd.
|
89888
90722
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
89889
90723
|
*/
|
89890
90724
|
|
@@ -89934,7 +90768,7 @@ Phaser.Physics.P2.DistanceConstraint.prototype.constructor = Phaser.Physics.P2.D
|
|
89934
90768
|
|
89935
90769
|
/**
|
89936
90770
|
* @author Richard Davey <rich@photonstorm.com>
|
89937
|
-
* @copyright
|
90771
|
+
* @copyright 2016 Photon Storm Ltd.
|
89938
90772
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
89939
90773
|
*/
|
89940
90774
|
|
@@ -89975,7 +90809,7 @@ Phaser.Physics.P2.GearConstraint.prototype.constructor = Phaser.Physics.P2.GearC
|
|
89975
90809
|
|
89976
90810
|
/**
|
89977
90811
|
* @author Richard Davey <rich@photonstorm.com>
|
89978
|
-
* @copyright
|
90812
|
+
* @copyright 2016 Photon Storm Ltd.
|
89979
90813
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
89980
90814
|
*/
|
89981
90815
|
|
@@ -90020,7 +90854,7 @@ Phaser.Physics.P2.LockConstraint.prototype.constructor = Phaser.Physics.P2.LockC
|
|
90020
90854
|
|
90021
90855
|
/**
|
90022
90856
|
* @author Richard Davey <rich@photonstorm.com>
|
90023
|
-
* @copyright
|
90857
|
+
* @copyright 2016 Photon Storm Ltd.
|
90024
90858
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
90025
90859
|
*/
|
90026
90860
|
|
@@ -90070,7 +90904,7 @@ Phaser.Physics.P2.PrismaticConstraint.prototype.constructor = Phaser.Physics.P2.
|
|
90070
90904
|
|
90071
90905
|
/**
|
90072
90906
|
* @author Richard Davey <rich@photonstorm.com>
|
90073
|
-
* @copyright
|
90907
|
+
* @copyright 2016 Photon Storm Ltd.
|
90074
90908
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
90075
90909
|
*/
|
90076
90910
|
|
@@ -90122,7 +90956,7 @@ Phaser.Physics.P2.RevoluteConstraint.prototype.constructor = Phaser.Physics.P2.R
|
|
90122
90956
|
|
90123
90957
|
/**
|
90124
90958
|
* @author Richard Davey <rich@photonstorm.com>
|
90125
|
-
* @copyright
|
90959
|
+
* @copyright 2016 Photon Storm Ltd.
|
90126
90960
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
90127
90961
|
*/
|
90128
90962
|
|
@@ -90253,7 +91087,7 @@ Phaser.ImageCollection.prototype.constructor = Phaser.ImageCollection;
|
|
90253
91087
|
|
90254
91088
|
/**
|
90255
91089
|
* @author Richard Davey <rich@photonstorm.com>
|
90256
|
-
* @copyright
|
91090
|
+
* @copyright 2016 Photon Storm Ltd.
|
90257
91091
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
90258
91092
|
*/
|
90259
91093
|
|
@@ -90661,7 +91495,7 @@ Object.defineProperty(Phaser.Tile.prototype, "bottom", {
|
|
90661
91495
|
|
90662
91496
|
/**
|
90663
91497
|
* @author Richard Davey <rich@photonstorm.com>
|
90664
|
-
* @copyright
|
91498
|
+
* @copyright 2016 Photon Storm Ltd.
|
90665
91499
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
90666
91500
|
*/
|
90667
91501
|
|
@@ -92583,7 +93417,7 @@ Object.defineProperty(Phaser.Tilemap.prototype, "layer", {
|
|
92583
93417
|
|
92584
93418
|
/**
|
92585
93419
|
* @author Richard Davey <rich@photonstorm.com>
|
92586
|
-
* @copyright
|
93420
|
+
* @copyright 2016 Photon Storm Ltd.
|
92587
93421
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
92588
93422
|
*/
|
92589
93423
|
|
@@ -93871,7 +94705,7 @@ Object.defineProperty(Phaser.TilemapLayer.prototype, "collisionHeight", {
|
|
93871
94705
|
|
93872
94706
|
/**
|
93873
94707
|
* @author Richard Davey <rich@photonstorm.com>
|
93874
|
-
* @copyright
|
94708
|
+
* @copyright 2016 Photon Storm Ltd.
|
93875
94709
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
93876
94710
|
*/
|
93877
94711
|
|
@@ -93884,7 +94718,7 @@ Object.defineProperty(Phaser.TilemapLayer.prototype, "collisionHeight", {
|
|
93884
94718
|
Phaser.TilemapParser = {
|
93885
94719
|
|
93886
94720
|
/**
|
93887
|
-
* When scanning the Tiled map data the TilemapParser can either insert a null value (true) or
|
94721
|
+
* When scanning the Tiled map data the TilemapParser can either insert a null value (true) or
|
93888
94722
|
* a Phaser.Tile instance with an index of -1 (false, the default). Depending on your game type
|
93889
94723
|
* depends how this should be configured. If you've a large sparsely populated map and the tile
|
93890
94724
|
* data doesn't need to change then setting this value to `true` will help with memory consumption.
|
@@ -94104,15 +94938,15 @@ Phaser.TilemapParser = {
|
|
94104
94938
|
}
|
94105
94939
|
|
94106
94940
|
var curl = json.layers[i];
|
94107
|
-
|
94941
|
+
|
94108
94942
|
// Base64 decode data if necessary
|
94109
|
-
// NOTE: uncompressed base64 only.
|
94943
|
+
// NOTE: uncompressed base64 only.
|
94110
94944
|
if (!curl.compression && curl.encoding && curl.encoding === "base64") {
|
94111
94945
|
var binaryString = window.atob(curl.data);
|
94112
94946
|
var len = binaryString.length;
|
94113
94947
|
var bytes = new Array( len );
|
94114
94948
|
// Interpret binaryString as an array of bytes representing
|
94115
|
-
// little-endian encoded uint32 values.
|
94949
|
+
// little-endian encoded uint32 values.
|
94116
94950
|
for (var j = 0; j < len; j+=4) {
|
94117
94951
|
bytes[j/4] = (binaryString.charCodeAt(j) |
|
94118
94952
|
binaryString.charCodeAt(j+1) << 8 |
|
@@ -94120,6 +94954,11 @@ Phaser.TilemapParser = {
|
|
94120
94954
|
binaryString.charCodeAt(j+3) << 24) >>> 0;
|
94121
94955
|
}
|
94122
94956
|
curl.data = bytes;
|
94957
|
+
delete curl.encoding;
|
94958
|
+
}
|
94959
|
+
else if(curl.compression){
|
94960
|
+
console.warn('TilemapParser.parseTiledJSON - Layer compression is unsupported, skipping layer \'' + curl.name + '\'');
|
94961
|
+
continue;
|
94123
94962
|
}
|
94124
94963
|
|
94125
94964
|
|
@@ -94163,7 +95002,7 @@ Phaser.TilemapParser = {
|
|
94163
95002
|
flipped = false;
|
94164
95003
|
gid = curl.data[t];
|
94165
95004
|
|
94166
|
-
// If true the current tile is flipped or rotated (Tiled TMX format)
|
95005
|
+
// If true the current tile is flipped or rotated (Tiled TMX format)
|
94167
95006
|
if (gid > 0x20000000)
|
94168
95007
|
{
|
94169
95008
|
flippedVal = 0;
|
@@ -94188,7 +95027,7 @@ Phaser.TilemapParser = {
|
|
94188
95027
|
gid -= 0x20000000;
|
94189
95028
|
flippedVal += 1;
|
94190
95029
|
}
|
94191
|
-
|
95030
|
+
|
94192
95031
|
switch (flippedVal)
|
94193
95032
|
{
|
94194
95033
|
case 5:
|
@@ -94317,7 +95156,7 @@ Phaser.TilemapParser = {
|
|
94317
95156
|
else
|
94318
95157
|
{
|
94319
95158
|
var newCollection = new Phaser.ImageCollection(set.name, set.firstgid, set.tilewidth, set.tileheight, set.margin, set.spacing, set.properties);
|
94320
|
-
|
95159
|
+
|
94321
95160
|
for (var ti in set.tiles)
|
94322
95161
|
{
|
94323
95162
|
var image = set.tiles[ti].image;
|
@@ -94556,7 +95395,7 @@ Phaser.TilemapParser = {
|
|
94556
95395
|
|
94557
95396
|
/**
|
94558
95397
|
* @author Richard Davey <rich@photonstorm.com>
|
94559
|
-
* @copyright
|
95398
|
+
* @copyright 2016 Photon Storm Ltd.
|
94560
95399
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
94561
95400
|
*/
|
94562
95401
|
|
@@ -94774,7 +95613,7 @@ Phaser.Tileset.prototype = {
|
|
94774
95613
|
|
94775
95614
|
if (rowCount % 1 !== 0 || colCount % 1 !== 0)
|
94776
95615
|
{
|
94777
|
-
console.warn("Phaser.Tileset - image tile area is not an even multiple of tile size");
|
95616
|
+
console.warn("Phaser.Tileset - " + this.name + " image tile area is not an even multiple of tile size");
|
94778
95617
|
}
|
94779
95618
|
|
94780
95619
|
// In Tiled a tileset image that is not an even multiple of the tile dimensions
|
@@ -94817,7 +95656,7 @@ Phaser.Tileset.prototype.constructor = Phaser.Tileset;
|
|
94817
95656
|
|
94818
95657
|
/**
|
94819
95658
|
* @author Richard Davey <rich@photonstorm.com>
|
94820
|
-
* @copyright
|
95659
|
+
* @copyright 2016 Photon Storm Ltd.
|
94821
95660
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
94822
95661
|
*/
|
94823
95662
|
|
@@ -94983,7 +95822,7 @@ Phaser.Particle.prototype.reset = function(x, y, health) {
|
|
94983
95822
|
|
94984
95823
|
/**
|
94985
95824
|
* @author Richard Davey <rich@photonstorm.com>
|
94986
|
-
* @copyright
|
95825
|
+
* @copyright 2016 Photon Storm Ltd.
|
94987
95826
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
94988
95827
|
*/
|
94989
95828
|
|
@@ -95064,7 +95903,7 @@ Phaser.Particles.prototype.constructor = Phaser.Particles;
|
|
95064
95903
|
|
95065
95904
|
/**
|
95066
95905
|
* @author Richard Davey <rich@photonstorm.com>
|
95067
|
-
* @copyright
|
95906
|
+
* @copyright 2016 Photon Storm Ltd.
|
95068
95907
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
95069
95908
|
*/
|
95070
95909
|
|
@@ -95076,7 +95915,7 @@ Phaser.Particles.prototype.constructor = Phaser.Particles;
|
|
95076
95915
|
Phaser.Particles.Arcade = {};
|
95077
95916
|
/**
|
95078
95917
|
* @author Richard Davey <rich@photonstorm.com>
|
95079
|
-
* @copyright
|
95918
|
+
* @copyright 2016 Photon Storm Ltd.
|
95080
95919
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
95081
95920
|
*/
|
95082
95921
|
|
@@ -95617,7 +96456,7 @@ Phaser.Particles.Arcade.Emitter.prototype.start = function (explode, lifespan, f
|
|
95617
96456
|
else
|
95618
96457
|
{
|
95619
96458
|
this.on = true;
|
95620
|
-
this._quantity
|
96459
|
+
this._quantity = quantity;
|
95621
96460
|
this._counter = 0;
|
95622
96461
|
this._timer = this.game.time.time + frequency * this.game.time.slowMotion;
|
95623
96462
|
}
|
@@ -96078,21 +96917,21 @@ Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype, "bottom", {
|
|
96078
96917
|
|
96079
96918
|
/**
|
96080
96919
|
* @author Richard Davey <rich@photonstorm.com>
|
96081
|
-
* @copyright
|
96920
|
+
* @copyright 2016 Photon Storm Ltd.
|
96082
96921
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
96083
96922
|
*/
|
96084
96923
|
|
96085
96924
|
/**
|
96086
96925
|
* A Video object that takes a previously loaded Video from the Phaser Cache and handles playback of it.
|
96087
|
-
*
|
96926
|
+
*
|
96088
96927
|
* Alternatively it takes a getUserMedia feed from an active webcam and streams the contents of that to
|
96089
96928
|
* the Video instead (see `startMediaStream` method)
|
96090
|
-
*
|
96929
|
+
*
|
96091
96930
|
* The video can then be applied to a Sprite as a texture. If multiple Sprites share the same Video texture and playback
|
96092
96931
|
* changes (i.e. you pause the video, or seek to a new time) then this change will be seen across all Sprites simultaneously.
|
96093
96932
|
*
|
96094
96933
|
* Due to a bug in IE11 you cannot play a video texture to a Sprite in WebGL. For IE11 force Canvas mode.
|
96095
|
-
*
|
96934
|
+
*
|
96096
96935
|
* If you need each Sprite to be able to play a video fully independently then you will need one Video object per Sprite.
|
96097
96936
|
* Please understand the obvious performance implications of doing this, and the memory required to hold videos in RAM.
|
96098
96937
|
*
|
@@ -96101,7 +96940,7 @@ Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype, "bottom", {
|
|
96101
96940
|
* it's worth noting that every single Video needs to be touch unlocked, not just the first one. You can use the `changeSource`
|
96102
96941
|
* method to try and work around this limitation, but see the method help for details.
|
96103
96942
|
*
|
96104
|
-
* Small screen devices, especially iPod and iPhone will launch the video in its own native video player,
|
96943
|
+
* Small screen devices, especially iPod and iPhone will launch the video in its own native video player,
|
96105
96944
|
* outside of the Safari browser. There is no way to avoid this, it's a device imposed limitation.
|
96106
96945
|
*
|
96107
96946
|
* @class Phaser.Video
|
@@ -96356,7 +97195,7 @@ Phaser.Video = function (game, key, url) {
|
|
96356
97195
|
* A snapshot grabbed from the video. This is initially black. Populate it by calling Video.grab().
|
96357
97196
|
* When called the BitmapData is updated with a grab taken from the current video playing or active video stream.
|
96358
97197
|
* If Phaser has been compiled without BitmapData support this property will always be `null`.
|
96359
|
-
*
|
97198
|
+
*
|
96360
97199
|
* @property {Phaser.BitmapData} snapshot
|
96361
97200
|
* @readOnly
|
96362
97201
|
*/
|
@@ -96796,11 +97635,11 @@ Phaser.Video.prototype = {
|
|
96796
97635
|
|
96797
97636
|
/**
|
96798
97637
|
* Stops the video playing.
|
96799
|
-
*
|
97638
|
+
*
|
96800
97639
|
* This removes all locally set signals.
|
96801
|
-
*
|
97640
|
+
*
|
96802
97641
|
* If you only wish to pause playback of the video, to resume at a later time, use `Video.paused = true` instead.
|
96803
|
-
* If the video hasn't finished downloading calling `Video.stop` will not abort the download. To do that you need to
|
97642
|
+
* If the video hasn't finished downloading calling `Video.stop` will not abort the download. To do that you need to
|
96804
97643
|
* call `Video.destroy` instead.
|
96805
97644
|
*
|
96806
97645
|
* If you are using a video stream from a webcam then calling Stop will disconnect the MediaStream session and disable the webcam.
|
@@ -96838,7 +97677,17 @@ Phaser.Video.prototype = {
|
|
96838
97677
|
}
|
96839
97678
|
else
|
96840
97679
|
{
|
96841
|
-
this.videoStream.
|
97680
|
+
if (this.videoStream.getTracks)
|
97681
|
+
{
|
97682
|
+
this.videoStream.getTracks().forEach(function (track) {
|
97683
|
+
track.stop();
|
97684
|
+
});
|
97685
|
+
}
|
97686
|
+
else
|
97687
|
+
{
|
97688
|
+
this.videoStream.stop();
|
97689
|
+
}
|
97690
|
+
|
96842
97691
|
}
|
96843
97692
|
}
|
96844
97693
|
|
@@ -97018,7 +97867,7 @@ Phaser.Video.prototype = {
|
|
97018
97867
|
* On some mobile browsers you cannot play a video until the user has explicitly touched the video to allow it.
|
97019
97868
|
* Phaser handles this via the `setTouchLock` method. However if you have 3 different videos, maybe an "Intro", "Start" and "Game Over"
|
97020
97869
|
* split into three different Video objects, then you will need the user to touch-unlock every single one of them.
|
97021
|
-
*
|
97870
|
+
*
|
97022
97871
|
* You can avoid this by using just one Video object and simply changing the video source. Once a Video element is unlocked it remains
|
97023
97872
|
* unlocked, even if the source changes. So you can use this to your benefit to avoid forcing the user to 'touch' the video yet again.
|
97024
97873
|
*
|
@@ -97065,7 +97914,7 @@ Phaser.Video.prototype = {
|
|
97065
97914
|
|
97066
97915
|
/**
|
97067
97916
|
* Internal callback that monitors the download progress of a video after changing its source.
|
97068
|
-
*
|
97917
|
+
*
|
97069
97918
|
* @method Phaser.Video#checkVideoProgress
|
97070
97919
|
* @private
|
97071
97920
|
*/
|
@@ -97096,7 +97945,7 @@ Phaser.Video.prototype = {
|
|
97096
97945
|
/**
|
97097
97946
|
* Sets the Input Manager touch callback to be Video.unlock.
|
97098
97947
|
* Required for mobile video unlocking. Mostly just used internally.
|
97099
|
-
*
|
97948
|
+
*
|
97100
97949
|
* @method Phaser.Video#setTouchLock
|
97101
97950
|
*/
|
97102
97951
|
setTouchLock: function () {
|
@@ -97110,7 +97959,7 @@ Phaser.Video.prototype = {
|
|
97110
97959
|
* Enables the video on mobile devices, usually after the first touch.
|
97111
97960
|
* If the SoundManager hasn't been unlocked then this will automatically unlock that as well.
|
97112
97961
|
* Only one video can be pending unlock at any one time.
|
97113
|
-
*
|
97962
|
+
*
|
97114
97963
|
* @method Phaser.Video#unlock
|
97115
97964
|
*/
|
97116
97965
|
unlock: function () {
|
@@ -97174,7 +98023,7 @@ Phaser.Video.prototype = {
|
|
97174
98023
|
/**
|
97175
98024
|
* Removes the Video element from the DOM by calling parentNode.removeChild on itself.
|
97176
98025
|
* Also removes the autoplay and src attributes and nulls the reference.
|
97177
|
-
*
|
98026
|
+
*
|
97178
98027
|
* @method Phaser.Video#removeVideoElement
|
97179
98028
|
*/
|
97180
98029
|
removeVideoElement: function () {
|
@@ -97320,7 +98169,7 @@ Object.defineProperty(Phaser.Video.prototype, "mute", {
|
|
97320
98169
|
/**
|
97321
98170
|
* Gets or sets the paused state of the Video.
|
97322
98171
|
* If the video is still touch locked (such as on iOS devices) this call has no effect.
|
97323
|
-
*
|
98172
|
+
*
|
97324
98173
|
* @name Phaser.Video#paused
|
97325
98174
|
* @property {boolean} paused
|
97326
98175
|
*/
|
@@ -97424,7 +98273,7 @@ Object.defineProperty(Phaser.Video.prototype, "playbackRate", {
|
|
97424
98273
|
* Gets or sets if the Video is set to loop.
|
97425
98274
|
* Please note that at present some browsers (i.e. Chrome) do not support *seamless* video looping.
|
97426
98275
|
* If the video isn't yet set this will always return false.
|
97427
|
-
*
|
98276
|
+
*
|
97428
98277
|
* @name Phaser.Video#loop
|
97429
98278
|
* @property {boolean} loop
|
97430
98279
|
*/
|
@@ -97471,7 +98320,7 @@ Phaser.Video.prototype.constructor = Phaser.Video;
|
|
97471
98320
|
/* global Phaser:true */
|
97472
98321
|
/**
|
97473
98322
|
* @author Richard Davey <rich@photonstorm.com>
|
97474
|
-
* @copyright
|
98323
|
+
* @copyright 2016 Photon Storm Ltd.
|
97475
98324
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
97476
98325
|
*/
|
97477
98326
|
|
@@ -97515,7 +98364,7 @@ PIXI.TextureSilentFail = true;
|
|
97515
98364
|
|
97516
98365
|
/**
|
97517
98366
|
* @author Richard Davey <rich@photonstorm.com>
|
97518
|
-
* @copyright
|
98367
|
+
* @copyright 2016 Photon Storm Ltd.
|
97519
98368
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
97520
98369
|
*/
|
97521
98370
|
|