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.getObjectIndex issue #2242

Closed
fallenleavesguy opened this issue Dec 3, 2015 · 3 comments
Closed

tilemap.getObjectIndex issue #2242

fallenleavesguy opened this issue Dec 3, 2015 · 3 comments

Comments

@fallenleavesguy
Copy link

image

Phaser.Tilemap

I found tilemap.objects is an object and it has an array of my objects in tilemap.json file.
I have a look:

 getObjectIndex: function (name) {
        return this.getIndex(this.objects, name);
}

I think it should be

 getObjectIndex: function (name) {
        //getIndex need an array,but an object here
        return this.getIndex(this.objects.object, name);
}
@cchartr
Copy link

cchartr commented Dec 6, 2015

I second the issue raising, but not the solution.
tilemap.objects is really a JavaScript object which maps object groups (or object layers, or object arrays) using their names for keys. Therefore in your example, tilemap.objects has a member object only because that's the name you gave to your object group.
In fact, now that Tilemap.objects is an object and not an array, I'd suggest the method Tilemap.getObjectIndex() be stripped altogether. Or make it retrieve an object's index from within an object group, but that would require two arguments : the object name and the object group name. Anyway in the current state of things, that method is irrelevant.

@fallenleavesguy
Copy link
Author

@cchartr Thank you very much.

@photonstorm
Copy link
Collaborator

Agreed. Method removed.

photonstorm added a commit that referenced this issue Feb 3, 2016
…n most cases, and it's easier to just scan the Tilemap.objects object directly anyway (#2242)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants