-
Notifications
You must be signed in to change notification settings - Fork 40
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
Updated APIs for objectgroup and get tiled objects via Map #58
base: main
Are you sure you want to change the base?
Conversation
I am not sure if I understand the use cases for users that want I am trying to imagine scenarios where that is desirable, and this may just me a lack of imagination, but not coming up with much. In my case, a workflow like
Seems a bit roundabout. I'm currently doing something like
But for half of my objects or so, I don't think I would want auto-spawning to happen at all, and then I'd have two totally different methods of setting up objects. I think that my ideal API might be something like being able to provide a closure that gets called to spawn objects for a particular layer, or a particular Would love to hear from anyone else using Objects. |
I do have some objects though that ideally would have graphics from the tileset associated with them, and it's sort of a pain to deal with if Is it possible to, outside of |
One of the missing bits from your example is that I listen for object creation and then attach markers depending on the object's properties. I find myself not knowing the "user wants to spawn objects themselves" use case well enough, so we're even :) I did figure it should be possible to call object.spawn().add(MarkerComponent) one or more times for any object in the map, and I'd like to build that API relatively soon. Another consideration is - do we want to, on load, create texture atlases for all the tiles in the map? I noticed that there is missing a "Tile" API though there remain Layer, ObjectGroup, and Map analogues in bevy_tiled, so we could store texture handles in a similar field for Tile and have a Map.get_atlas(Object) for the spawning you mention. Perhaps the tiles and objects could be spawned as entities by default but without any graphical objects attached, and the library user could provide an "attach_sprite()" method or user could instead query for the object (now with a texture handle) and spawn it manually if they need? My goal will be sensible defaults that someone can just drop in a Tiled map and it will do something usable. For special use cases, we can build out the API -- this might mean that the "sensible defaults" is a plugin that you include if you want the map to automagically spawn visible objects -- though I still wonder if we should always spawn object entities even if they aren't renderable.... |
Ah, I see. I was completely ignorant of I have some objects that end up getting set up as All three options sound pretty workable, really. Option 1If broken up like Option 2This seems somewhat clunky but efficient. Option 3This is pretty convenient, but maybe somewhat inelegant? |
Considering a couple new APIs for #56
We're cloning objects to include use as entities, so I have been hesitant to just clone the contents of the rs-tiled structs, but maybe it doesn't matter that much. There are two examples here for consideration:
I'm less worried about cloning object groups, especially shallow-cloned, but I figure there might be orders of magnitude more objects if we improve our spawning API. So, I think both these are mergeable, but @rparrett and others -- lmk what you think about the changes and also about how to proceed: