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)

This commit is contained in:
photonstorm 2015-04-13 12:38:41 +01:00
parent 78e7be5c96
commit f155ad452c
2 changed files with 13 additions and 9 deletions

View file

@ -253,6 +253,7 @@ Version 2.3.1 - "Katar" - in dev
* TypeScript definitions fixes and updates (thanks @clark-stevenson @isuda @ggarek)
* Added missing `resumed` method to Phaser.State class template.
* Color.webToColor and Color.updateColor now updates the `out.color` and `out.color32` properties (thanks @cuixiping #1728)
* 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)
### Bug Fixes

View file

@ -394,23 +394,26 @@ Phaser.Tilemap.prototype = {
for (var i = 0, len = this.objects[name].length; i < len; i++)
{
if (typeof this.objects[name][i].gid !== 'undefined' &&
typeof gid === 'number') {
if (this.objects[name][i].gid === gid) {
if (typeof this.objects[name][i].gid !== 'undefined' && typeof gid === 'number')
{
if (this.objects[name][i].gid === gid)
{
found = true;
}
}
if (typeof this.objects[name][i].id !== 'undefined' &&
typeof gid === 'number') {
if (this.objects[name][i].id === gid) {
if (typeof this.objects[name][i].id !== 'undefined' && typeof gid === 'number')
{
if (this.objects[name][i].id === gid)
{
found = true;
}
}
if (typeof this.objects[name][i].name !== 'undefined' &&
typeof gid === 'string') {
if (this.objects[name][i].name === gid) {
if (typeof this.objects[name][i].name !== 'undefined' && typeof gid === 'string')
{
if (this.objects[name][i].name === gid)
{
found = true;
}
}