From 91987eff56ac93443b19e0c609175156aea4549f Mon Sep 17 00:00:00 2001 From: gotenxds Date: Wed, 15 Jun 2016 13:09:47 +0300 Subject: [PATCH] Added some data to image object types. --- src/tilemap/TilemapParser.js | 37 ++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/src/tilemap/TilemapParser.js b/src/tilemap/TilemapParser.js index 8381b8e42..a74b487a2 100644 --- a/src/tilemap/TilemapParser.js +++ b/src/tilemap/TilemapParser.js @@ -25,6 +25,33 @@ Phaser.TilemapParser = { */ INSERT_NULL: false, + /** + * A tiled flag that resides within the 32 bit of the object gid and + * indicates whether the tiled/object is flipped horizontally. + * + * @constant + * @type {number} + */ + FLIPPED_HORIZONTALLY_FLAG: 0x80000000, + + /** + * A tiled flag that resides within the 31 bit of the object gid and + * indicates whether the tiled/object is flipped vertically. + * + * @constant + * @type {number} + */ + FLIPPED_VERTICALLY_FLAG: 0x40000000, + + /** + * A tiled flag that resides within the 30 bit of the object gid and + * indicates whether the tiled/object is flipped diagonally. + * + * @constant + * @type {number} + */ + FLIPPED_DIAGONALLY_FLAG: 0x20000000, + /** * Parse tilemap data from the cache and creates a Tilemap object. * @@ -505,6 +532,8 @@ Phaser.TilemapParser = { // Object Tiles if (curo.objects[v].gid) { + var self = this; + var object = { gid: curo.objects[v].gid, @@ -512,9 +541,13 @@ Phaser.TilemapParser = { type: curo.objects[v].hasOwnProperty("type") ? curo.objects[v].type : "", x: curo.objects[v].x, y: curo.objects[v].y, + width: curo.objects[v].width, + height: curo.objects[v].height, visible: curo.objects[v].visible, - properties: curo.objects[v].properties - + properties: curo.objects[v].properties, + horizontallyFlipped: curo.objects[v].gid & self.FLIPPED_HORIZONTALLY_FLAG, + verticallyFlipped: curo.objects[v].gid & self.FLIPPED_VERTICALLY_FLAG, + diagonallyFlipped: curo.objects[v].gid & self.FLIPPED_DIAGONALLY_FLAG }; if (curo.objects[v].rotation)