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

Group does not have x,y position #38

Closed
jessefreeman opened this issue May 25, 2013 · 4 comments
Closed

Group does not have x,y position #38

jessefreeman opened this issue May 25, 2013 · 4 comments

Comments

@jessefreeman
Copy link

In Flixel you could set a group's x,y position. In Phaser Group extends Basic which doesn't have x,y position.

Not sure if group needs things but it would be a nice to have especially when you want to bulk move a group of Sprites into place at the start of a level.

@photonstorm
Copy link
Collaborator

While it's true Group had x/y properties in flixel, they didn't actually update the children at all. Was just an inheritance left over, which is why I made a LinkedGroup for it. I'll have a think about it - it's not as trivial as it sounds because all of a sudden the children have to swap from being positioned at world coordinates to being at local coordinates instead, which could get nicely confusing. I guess it could be treated as more of an 'offset' applied to the children's x/y but the thought of propagating that down the chain, and to any other nested groups which could have their own x/y offset makes me wonder about the impact it could have.

@jessefreeman
Copy link
Author

I agree it adds complexity. I don't really see the point in groups as a visual element if they don't allow you to modify values of their children. I guess I tend to use them to simplify collision among similar types and iterating through them. Perhaps Group shouldn't be a display element and instead a construct to allow you to better organize objects for other activities such as looping through children to perform actions or collision?

Impact had the notion of being able to get all Entities of a type, I find groups a better alternative since you can manually create these collections. It would be interesting if the Group class had a utility to get all of the Sprites of a type or something similar as well?

@photonstorm
Copy link
Collaborator

Well technically Group extends Basic right now, which isn't a display element. In fact I just checked the code and Group doesn't have x/y properties at all :)

Group has a couple of methods already that allows you to specify object class (recycle, getFirstAvailable) but those could be extended further.

@jessefreeman
Copy link
Author

Forgot about the object pooling in Groups which is really useful and I do use. Let's drop the x,y conversation as groups currently perform fine and don't need to match up to Flixel as you pointed out since x,y was a by product of extension in Flixel.

I can make a different ticket down the line for ways to enhance the Group class.

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

2 participants