Skip to content

Commit 9f687b4

Browse files
committed
Adding Type support for collision checks.
1 parent 79dc356 commit 9f687b4

13 files changed

Lines changed: 683 additions & 207 deletions

File tree

Phaser.sublime-workspace

Lines changed: 626 additions & 206 deletions
Large diffs are not rendered by default.

src/Phaser.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,20 @@ var Phaser = Phaser || {
77
GAMES: [],
88
AUTO: 0,
99
CANVAS: 1,
10-
WEBGL: 2
10+
WEBGL: 2,
11+
12+
SPRITE: 0,
13+
BUTTON: 1,
14+
BULLET: 2,
15+
GRAPHICS: 3,
16+
TEXT: 4,
17+
TILESPRITE: 5,
18+
BITMAPTEXT: 6,
19+
GROUP: 7,
20+
RENDERTEXTURE: 8,
21+
TILEMAP: 9,
22+
TILEMAPLAYER: 10,
23+
EMITTER: 11
1124

1225
};
1326

src/core/Group.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ Phaser.Group = function (game, parent, name, useStage) {
3636
}
3737
}
3838

39+
this.type = Phaser.GROUP;
40+
3941
this.exists = true;
4042

4143
/**

src/gameobjects/Button.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ Phaser.Button = function (game, x, y, key, callback, callbackContext, overFrame,
2121

2222
Phaser.Sprite.call(this, game, x, y, key, outFrame);
2323

24+
this.type = Phaser.BUTTON;
25+
2426
this._onOverFrameName = null;
2527
this._onOutFrameName = null;
2628
this._onDownFrameName = null;

src/gameobjects/Graphics.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ Phaser.Graphics = function (game, x, y) {
1414

1515
PIXI.DisplayObjectContainer.call(this);
1616

17+
this.type = Phaser.GRAPHICS;
18+
1719
this.position.x = x;
1820
this.position.y = y;
1921

src/gameobjects/RenderTexture.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Phaser.RenderTexture = function (game, key, width, height) {
1313

1414
this.frame = new PIXI.Rectangle(0, 0, this.width, this.height);
1515

16+
this.type = Phaser.RENDERTEXTURE;
17+
1618
if (PIXI.gl)
1719
{
1820
this.initWebGL();

src/gameobjects/Sprite.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ Phaser.Sprite = function (game, x, y, key, frame) {
1717

1818
this.name = '';
1919

20+
this.type = Phaser.SPRITE;
21+
2022
this.renderOrderID = -1;
2123

2224
// If you would like the Sprite to have a lifespan once 'born' you can set this to a positive value. Handy for particles, bullets, etc.

src/gameobjects/Text.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ Phaser.Text = function (game, x, y, text, style) {
1414

1515
Phaser.Sprite.call(this, game, x, y, canvasID);
1616

17+
this.type = Phaser.TEXT;
18+
1719
this.setText(text);
1820
this.setStyle(style);
1921

src/gameobjects/TileSprite.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Phaser.TileSprite = function (game, x, y, width, height, key, frame) {
1313

1414
PIXI.TilingSprite.call(this, this.texture, width, height);
1515

16+
this.type = Phaser.TILESPRITE;
17+
1618
/**
1719
* The scaling of the image that is being tiled
1820
*

src/particles/arcade/Emitter.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ Phaser.Particles.Arcade.Emitter = function (game, x, y, maxParticles) {
1414

1515
this.name = 'emitter' + this.game.particles.ID++;
1616

17+
this.type = Phaser.EMITTER;
18+
1719
/**
1820
* The X position of the top left corner of the emitter in world space.
1921
*/

0 commit comments

Comments
 (0)