Open rdelfin opened 1 month ago
+1 here, also interested. Or would be curious to hear if this is the wrong approach entirely and what would be a better way! I suppose the reasoning for why this isn't possible/apparent are generally covered by https://github.com/Trouv/bevy_ecs_ldtk/issues/258
Yeah, that's a fair point! Maybe it's easier to have my own custom bundles and logic for doing that in game instead
Yeah, that's a fair point! Maybe it's easier to have my own custom bundles and logic for doing that in game instead
Since my comment I did actually manage to make this "work". I'll PR some example code someday but basically I have my bundles for each entity that I treat as templates, spawn them in at startup and then turn their visibility to hidden. Then when I want to spawn them in code, I query for a unique component marker that I've inserted into the template entities, and clone each of the components that I want to the new entity.
Sorry if this is something that's mentioned elsewhere but I couldn't find any issues.
Is there currently a way of manually spawning a new entity based off an entity type in LDtk? To give an example, I have a game where entities spawn based on a specific event from specific spots on the map (the spawn points are themselves entities). What I'd like to do is use the "entity" objects in LDtk as a template to spawn a new entity. That way I can use the spritesheet as loaded in LDtk. Is this possible?