Skip to content

Commit 1486e16

Browse files
committed
Added physicsType property.
1 parent 55048a4 commit 1486e16

7 files changed

Lines changed: 44 additions & 4 deletions

File tree

src/core/Group.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@ Phaser.Group = function (game, parent, name, addToStage, enableBody, physicsBody
7878
*/
7979
this.type = Phaser.GROUP;
8080

81+
/**
82+
* @property {number} physicsType - The const physics body type of this object.
83+
* @readonly
84+
*/
85+
this.physicsType = Phaser.GROUP;
86+
8187
/**
8288
* The alive property is useful for Groups that are children of other Groups and need to be included/excluded in checks like forEachAlive.
8389
* @property {boolean} alive

src/gameobjects/Button.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ Phaser.Button = function (game, x, y, key, callback, callbackContext, overFrame,
4949
*/
5050
this.type = Phaser.BUTTON;
5151

52+
/**
53+
* @property {number} physicsType - The const physics body type of this object.
54+
* @readonly
55+
*/
56+
this.physicsType = Phaser.SPRITE;
57+
5258
/**
5359
* The name or ID of the Over state frame.
5460
* @property {string|integer} onOverFrame

src/gameobjects/Graphics.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ Phaser.Graphics = function (game, x, y) {
3636
*/
3737
this.type = Phaser.GRAPHICS;
3838

39+
/**
40+
* @property {number} physicsType - The const physics body type of this object.
41+
* @readonly
42+
*/
43+
this.physicsType = Phaser.SPRITE;
44+
3945
PIXI.Graphics.call(this);
4046

4147
Phaser.Component.Core.init.call(this, game, x, y, '', null);

src/gameobjects/Sprite.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ Phaser.Sprite = function (game, x, y, key, frame) {
5252
*/
5353
this.type = Phaser.SPRITE;
5454

55+
/**
56+
* @property {number} physicsType - The const physics body type of this object.
57+
* @readonly
58+
*/
59+
this.physicsType = Phaser.SPRITE;
60+
5561
PIXI.Sprite.call(this, PIXI.TextureCache['__default']);
5662

5763
Phaser.Component.Core.init.call(this, game, x, y, key, frame);
@@ -61,7 +67,7 @@ Phaser.Sprite = function (game, x, y, key, frame) {
6167
Phaser.Sprite.prototype = Object.create(PIXI.Sprite.prototype);
6268
Phaser.Sprite.prototype.constructor = Phaser.Sprite;
6369

64-
var components = [
70+
Phaser.Component.Core.install.call(Phaser.Sprite.prototype, [
6571
'Angle',
6672
'Animation',
6773
'AutoCull',
@@ -80,9 +86,7 @@ var components = [
8086
'Reset',
8187
'ScaleMinMax',
8288
'Smoothed'
83-
];
84-
85-
Phaser.Component.Core.install.call(Phaser.Sprite.prototype, components);
89+
]);
8690

8791
Phaser.Sprite.prototype.preUpdatePhysics = Phaser.Component.PhysicsBody.preUpdate;
8892
Phaser.Sprite.prototype.preUpdateLifeSpan = Phaser.Component.LifeSpan.preUpdate;

src/gameobjects/Text.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ Phaser.Text = function (game, x, y, text, style) {
5757
*/
5858
this.type = Phaser.TEXT;
5959

60+
/**
61+
* @property {number} physicsType - The const physics body type of this object.
62+
* @readonly
63+
*/
64+
this.physicsType = Phaser.SPRITE;
65+
6066
/**
6167
* Specify a padding value which is added to the line width and height when calculating the Text size.
6268
* ALlows you to add extra spacing if Phaser is unable to accurately determine the true font dimensions.

src/particles/arcade/Emitter.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ Phaser.Particles.Arcade.Emitter = function (game, x, y, maxParticles) {
3838
*/
3939
this.type = Phaser.EMITTER;
4040

41+
/**
42+
* @property {number} physicsType - The const physics body type of this object.
43+
* @readonly
44+
*/
45+
this.physicsType = Phaser.GROUP;
46+
4147
/**
4248
* @property {Phaser.Rectangle} area - The area of the emitter. Particles can be randomly generated from anywhere within this rectangle.
4349
* @default

src/tilemap/TilemapLayer.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,12 @@ Phaser.TilemapLayer = function (game, tilemap, index, width, height) {
9797
*/
9898
this.type = Phaser.TILEMAPLAYER;
9999

100+
/**
101+
* @property {number} physicsType - The const physics body type of this object.
102+
* @readonly
103+
*/
104+
this.physicsType = Phaser.TILEMAPLAYER;
105+
100106
/**
101107
* Settings that control standard (non-diagnostic) rendering.
102108
*

0 commit comments

Comments
 (0)