Skip to content
Discussion options

You must be logged in to vote

Make each sprite its own entity so each can have their ColorMaterial and so on. But have a root entity holding everything together by making each sprite a child of the parent entity.

Later you can access each child sprite with a query when you know the entity. I sometimes use marker components for each child or like in the example below a component holding the Entity handles to each sprite in the composition.

Example:

let left_arm = commands.spawn_bundle(...).id();
let right_arm = commands.spawn_bundle(...).id();
let head = commands.spawn_bundle(...).id();

// root entity and component holding everything together
// struct Body { left_arm: Entity, right_arm: Entity, head: Entity };
comman…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@gmoller
Comment options

@gmoller
Comment options

@payload
Comment options

Answer selected by gmoller
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants