Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TileMap.createFromObjects - Allow specifying all objects #3817

Closed
georgzoeller opened this issue Jul 6, 2018 · 1 comment
Closed

TileMap.createFromObjects - Allow specifying all objects #3817

georgzoeller opened this issue Jul 6, 2018 · 1 comment

Comments

@georgzoeller
Copy link

georgzoeller commented Jul 6, 2018

Currently TileMap.createFromObjects only works when specifying either a gid, a name or an idea, but it does not allow for the usecase of just converting all objects in a layer into sprites.

if (obj.gid !== undefined && typeof id === 'number' && obj.gid === id ||
obj.id !== undefined && typeof id === 'number' && obj.id === id ||
obj.name !== undefined && typeof id === 'string' && obj.name === id)
{
found = true;
}

proposed fix:

If no ID is specified, do not filter, allowing all objects in the layer to be converted.

if (id == null || obj.gid !== undefined && typeof id === 'number' && obj.gid === id ||
obj.id !== undefined && typeof id === 'number' && obj.id === id ||
obj.name !== undefined && typeof id === 'string' && obj.name === id)
{
found = true;
}

Furthermore the code block seems somewhat problematic with it's imprecision (can't turn off the name or id matching, so even if a gid does not exist, it will return true because and id exists).


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@photonstorm
Copy link
Collaborator

Thank you for submitting this feature request. We have implemented this and the feature has been pushed to the master branch. It will be part of the next release. If you get time to build and test it for yourself we would appreciate that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants