Mapping Tiled custom properties to Bevy components #5
Replies: 4 comments 6 replies
-
I've had a brief look and it looks really cool. Regarding the colliders, I think it would be good to provide a way to specify which shapes should have colliders added and which ones should be treated differently. That goes for object layers as well as tiles. Just because tile shapes are called collision shapes in Tiled doesn't mean we can't use them for other things. Unifying the way we handle these seems like a good idea. Btw getting the collider shapes working correctly was a nightmare because of the different co-ordinate systems. Bevy has positive Y pointing up while Tiled points down. But I think you were referring to changing where/how that logic gets invoked, not changing the actual construction of colliders, if I understood correctly. Automatically mapping custom properties to components seems like a good idea. And the macro makes that easy to use. Just a suggestion with the macro. Have a look at the We will need to restructure the repo to put the macro and main crate side by side. It could be a cargo workspace if that helps. How do you feel about being a co-maintainer? |
Beta Was this translation helpful? Give feedback.
-
I finished what I wanted to do in terms of code and achieved to get something usable! :) I did not open a PR yet because it still need some polish and a proper documentation (with associated examples) and I won't have time to do that now. It will have to wait next week. What I did
What remains to do / What I'm not sure about
|
Beta Was this translation helpful? Give feedback.
-
No problem, take your time :) Another idea: I was thinking about a new interface for the user to be notified for every tile added, even those without custom properties. The idea would be to be able to attach new "generic" components on our tiles that do not depend on the tile kind. I'll try to open a PR regarding this topic after the "custom properties" one. |
Beta Was this translation helpful? Give feedback.
-
Closing this discussion since I openned a PR for these changes (see #10) |
Beta Was this translation helpful? Give feedback.
-
Hey,
As discussed in my last PR, I started to implement mapping from Tiled custom properties to Bevy components.
The system is heavilly inspired from bevy_ecs_ldtk and bevy_entitiles (which I am using in my game right now).
The idea is to let the user define Tiled custom properties and corresponding Bevy components / bundles. When loading the map, the crate will automatically spawn said components on corresponding tile entities / object entity.
Here is my dev branch:
main...adrien-bon:bevy_ecs_tiled:wip/user_properties
It currently only work for tiles, not for objects (I did not want to mess with your colliders implementation) eventhough nearly everything is there. It seems to work with my basic example but I did not test it in depth.
I wanted to quickly code something so we can exchange about the way we want to handle this.
For instance, I believe we could use this to handle colliders instead of the list we currently have. See here
Sooo, let me know what you think about this so we can move forward :)
Beta Was this translation helpful? Give feedback.
All reactions