Skip to content

Separate data on TextureAtlasSprite to multiple components #1618

Closed
@DarkMara

Description

@DarkMara

What problem does this solve or what need does it fill?

The data that is on TextureAtlasSprite makes it difficult to use. It currently has index, color, and flipping information. The only data that makes sense is index, because that determines the sprite from the atlas that is drawn.

Normally when you change the color of a sprite, you want to change all of the sprites that are drawn by the entity. You don't need different colors for every sprite. Currently, if you want to change the color, you have to change it individually for every sprite. It's the same with flipping. There isn't a reason you'd want to have different flipping for individual sprites. You'd want to flip all or none at a time.

What solution would you like?

There should be a new component. I'm not sure of exact naming, but something like SpriteDrawParams that contains Color and flipping.

What alternative(s) have you considered?

The only alternative if you want to change the color of sprites that are drawn, is to change the color on the current sprite and update it every time it changes. It's the same with flipping, you have to update the flipping every time you change a sprite.

Additional context

Most of the above also applies to Sprite. It looks like it uses a material for color though. I think whatever solution is implemented should also apply to Sprite. I only didn't mention it because I have only used TextureAtlasSprite so far. I do think entities should be able to set their own color that gets multiplied with the material color. That's how it's done in Unity.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-RenderingDrawing game state to the screenC-UsabilityA targeted quality-of-life change that makes Bevy easier to use

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions