Skip to content

Commit

Permalink
Merge pull request #682 from f0rdP3rf3ct/master
Browse files Browse the repository at this point in the history
Respect tiled properties as an array
  • Loading branch information
samme authored Feb 18, 2021
2 parents 6a2c2d8 + de3fb1e commit f666100
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/tilemap/Tilemap.js
Original file line number Diff line number Diff line change
Expand Up @@ -461,9 +461,22 @@ Phaser.Tilemap.prototype = {

group.add(sprite);

for (var property in obj.properties)
// Set properties the class may have, or setData those it doesn't
if (Array.isArray(obj.properties))
{
group.set(sprite, property, obj.properties[property], false, false, 0, true);
// Tiled objects custom properties format
obj.properties.forEach(function (propData)
{
var key = propData.name;
sprite[key] = propData.value;
});
}
else
{
for (var property in obj.properties)
{
group.set(sprite, property, obj.properties[property], false, false, 0, true);
}
}
}
}
Expand Down

0 comments on commit f666100

Please sign in to comment.