Skip to content

Commit b0cb949

Browse files
authored
Merge pull request phaserjs#2564 from gotenxds/dev
Added some data to image object types.
2 parents bc224c5 + 91987ef commit b0cb949

1 file changed

Lines changed: 35 additions & 2 deletions

File tree

src/tilemap/TilemapParser.js

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,33 @@ Phaser.TilemapParser = {
2525
*/
2626
INSERT_NULL: false,
2727

28+
/**
29+
* A tiled flag that resides within the 32 bit of the object gid and
30+
* indicates whether the tiled/object is flipped horizontally.
31+
*
32+
* @constant
33+
* @type {number}
34+
*/
35+
FLIPPED_HORIZONTALLY_FLAG: 0x80000000,
36+
37+
/**
38+
* A tiled flag that resides within the 31 bit of the object gid and
39+
* indicates whether the tiled/object is flipped vertically.
40+
*
41+
* @constant
42+
* @type {number}
43+
*/
44+
FLIPPED_VERTICALLY_FLAG: 0x40000000,
45+
46+
/**
47+
* A tiled flag that resides within the 30 bit of the object gid and
48+
* indicates whether the tiled/object is flipped diagonally.
49+
*
50+
* @constant
51+
* @type {number}
52+
*/
53+
FLIPPED_DIAGONALLY_FLAG: 0x20000000,
54+
2855
/**
2956
* Parse tilemap data from the cache and creates a Tilemap object.
3057
*
@@ -505,16 +532,22 @@ Phaser.TilemapParser = {
505532
// Object Tiles
506533
if (curo.objects[v].gid)
507534
{
535+
var self = this;
536+
508537
var object = {
509538

510539
gid: curo.objects[v].gid,
511540
name: curo.objects[v].name,
512541
type: curo.objects[v].hasOwnProperty("type") ? curo.objects[v].type : "",
513542
x: curo.objects[v].x,
514543
y: curo.objects[v].y,
544+
width: curo.objects[v].width,
545+
height: curo.objects[v].height,
515546
visible: curo.objects[v].visible,
516-
properties: curo.objects[v].properties
517-
547+
properties: curo.objects[v].properties,
548+
horizontallyFlipped: curo.objects[v].gid & self.FLIPPED_HORIZONTALLY_FLAG,
549+
verticallyFlipped: curo.objects[v].gid & self.FLIPPED_VERTICALLY_FLAG,
550+
diagonallyFlipped: curo.objects[v].gid & self.FLIPPED_DIAGONALLY_FLAG
518551
};
519552

520553
if (curo.objects[v].rotation)

0 commit comments

Comments
 (0)