Skip to content

Commit 5e76eb4

Browse files
committed
Added support for Tiled object's type field
1 parent 6fd51e2 commit 5e76eb4

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/tilemap/TilemapParser.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,7 @@ Phaser.TilemapParser = {
388388
var object = {
389389

390390
name: json.layers[i].objects[v].name,
391+
type: json.layers[i].objects[v].type,
391392
x: json.layers[i].objects[v].x,
392393
y: json.layers[i].objects[v].y,
393394
width: json.layers[i].objects[v].width,
@@ -411,7 +412,7 @@ Phaser.TilemapParser = {
411412
else if (json.layers[i].objects[v].polygon)
412413
{
413414
var object = slice(json.layers[i].objects[v],
414-
["name", "x", "y", "visible", "properties" ]);
415+
["name", "type", "x", "y", "visible", "properties" ]);
415416

416417
// Parse the polygon into an array
417418
object.polygon = [];
@@ -426,14 +427,14 @@ Phaser.TilemapParser = {
426427
else if (json.layers[i].objects[v].ellipse)
427428
{
428429
var object = slice(json.layers[i].objects[v],
429-
["name", "ellipse", "x", "y", "width", "height", "visible", "properties" ]);
430+
["name", "type", "ellipse", "x", "y", "width", "height", "visible", "properties" ]);
430431
objects[json.layers[i].name].push(object);
431432
}
432433
// otherwise it's a rectangle
433434
else
434435
{
435436
var object = slice(json.layers[i].objects[v],
436-
["name", "x", "y", "width", "height", "visible", "properties" ]);
437+
["name", "type", "x", "y", "width", "height", "visible", "properties" ]);
437438
object.rectangle = true;
438439
objects[json.layers[i].name].push(object);
439440
}

0 commit comments

Comments
 (0)