stat bars
Simple library just for drawing stat bars above sprites to display their health or whatever.
Only goal is to be an easy to use crate that you can drop into any project and have stat bars in less than ten minutes.
- Targets Bevy 0.6
- Only supports 2D.
- Will never be super-customisable or fancy.
- Only centered, horizontal bars atm. Next release supports arbitrary orientations etc.
basic how-to
Add the StatBarsPlugin to your app, then you can spawn stat bars like so:
commands
.spawn_bundle;
and they should just work.
Notes
-
A stat bar is a single entity. It uses the bevy sprites renderer for drawing but doesn't create any intermediate sprite entities.
-
By default stat bars have a z_depth of 950, you can set it yourself with the StatBarZDepth component.
-
The bars automatically despawn when the subject is despawned.
-
Doesn't use the built in Parent-Child transform propagation as most of the time games don't want their indicator elements rotating or scaling with the sprite they are tracking.
-
Not optimised, doesn't use change detection etc or anything yet. Extremely unlikely to be a serious performance bottle neck though, unless you spawn 10,000 stat bars at once or something.
-
You can have more than one stat bar track an entity. Just not at the same relative position, or they will draw on top of each other.
There is a complete-ish working example in the /examples folder