Now the backwards compatibility is not broken

As implementation is leaning on 0.11.0 feature of Tiled, I made sure the earlier Tiled files that might be used are not going to break from this. Defaulting to empty string if the .type property is not defined by Tiled (for Tiled < 0.11.0), otherwise we use the provided value.
This commit is contained in:
Mika Turunen 2015-02-10 14:54:14 +02:00
parent 8a197b6023
commit be3edd8437

View file

@ -448,7 +448,7 @@ Phaser.TilemapParser = {
gid: json.layers[i].objects[v].gid,
name: json.layers[i].objects[v].name,
type: json.layers[i].objects[v].type,
type: json.layers[i].objects[v].hasOwnProperty("type") ? json.layers[i].objects[v].type : "",
x: json.layers[i].objects[v].x,
y: json.layers[i].objects[v].y,
visible: json.layers[i].objects[v].visible,