Skip to content

Commit f155ad4

Browse files
committed
Tilemap.createFromObjects has been updated for Tiled 0.11 and can now look-up object layers based on id, uid or name. It will also now copy over Sprite scaling properties if set (thanks @mandarinx phaserjs#1738)
1 parent 78e7be5 commit f155ad4

2 files changed

Lines changed: 13 additions & 9 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ Version 2.3.1 - "Katar" - in dev
253253
* TypeScript definitions fixes and updates (thanks @clark-stevenson @isuda @ggarek)
254254
* Added missing `resumed` method to Phaser.State class template.
255255
* Color.webToColor and Color.updateColor now updates the `out.color` and `out.color32` properties (thanks @cuixiping #1728)
256+
* Tilemap.createFromObjects has been updated for Tiled 0.11 and can now look-up object layers based on id, uid or name. It will also now copy over Sprite scaling properties if set (thanks @mandarinx #1738)
256257

257258
### Bug Fixes
258259

src/tilemap/Tilemap.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -394,23 +394,26 @@ Phaser.Tilemap.prototype = {
394394

395395
for (var i = 0, len = this.objects[name].length; i < len; i++)
396396
{
397-
if (typeof this.objects[name][i].gid !== 'undefined' &&
398-
typeof gid === 'number') {
399-
if (this.objects[name][i].gid === gid) {
397+
if (typeof this.objects[name][i].gid !== 'undefined' && typeof gid === 'number')
398+
{
399+
if (this.objects[name][i].gid === gid)
400+
{
400401
found = true;
401402
}
402403
}
403404

404-
if (typeof this.objects[name][i].id !== 'undefined' &&
405-
typeof gid === 'number') {
406-
if (this.objects[name][i].id === gid) {
405+
if (typeof this.objects[name][i].id !== 'undefined' && typeof gid === 'number')
406+
{
407+
if (this.objects[name][i].id === gid)
408+
{
407409
found = true;
408410
}
409411
}
410412

411-
if (typeof this.objects[name][i].name !== 'undefined' &&
412-
typeof gid === 'string') {
413-
if (this.objects[name][i].name === gid) {
413+
if (typeof this.objects[name][i].name !== 'undefined' && typeof gid === 'string')
414+
{
415+
if (this.objects[name][i].name === gid)
416+
{
414417
found = true;
415418
}
416419
}

0 commit comments

Comments
 (0)