{"id":21985571,"url":"https://github.com/ickshonpe/bevy_simple_stat_bars","last_synced_at":"2026-02-27T22:11:06.982Z","repository":{"id":53843059,"uuid":"469155602","full_name":"ickshonpe/bevy_simple_stat_bars","owner":"ickshonpe","description":"library for drawing health bars etc above sprites","archived":false,"fork":false,"pushed_at":"2023-01-24T15:35:23.000Z","size":21,"stargazers_count":6,"open_issues_count":2,"forks_count":7,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-30T07:53:39.089Z","etag":null,"topics":["2d","bevy","game-development","graphics","sprites"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ickshonpe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-03-12T17:40:29.000Z","updated_at":"2024-11-07T07:30:39.000Z","dependencies_parsed_at":"2023-02-13T23:00:39.045Z","dependency_job_id":null,"html_url":"https://github.com/ickshonpe/bevy_simple_stat_bars","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ickshonpe%2Fbevy_simple_stat_bars","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ickshonpe%2Fbevy_simple_stat_bars/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ickshonpe%2Fbevy_simple_stat_bars/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ickshonpe%2Fbevy_simple_stat_bars/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ickshonpe","download_url":"https://codeload.github.com/ickshonpe/bevy_simple_stat_bars/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251666246,"owners_count":21624292,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["2d","bevy","game-development","graphics","sprites"],"created_at":"2024-11-29T18:14:04.152Z","updated_at":"2026-02-27T22:11:01.963Z","avatar_url":"https://github.com/ickshonpe.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# stat bars\n\nSimple library just for drawing stat bars \nabove sprites to display their health\nor whatever.\n\nOnly goal is to be an easy to use crate that\nyou can drop into any project and have stat bars \nin less than ten minutes.\n\n* Targets Bevy 0.8\n* Only supports 2D.\n* Will never be super-customisable or fancy.\n* Only centered, horizontal bars atm. \nNext release supports arbitrary orientations etc.\n\n# basic how-to\n\nAdd the StatBarsPlugin to your app,\nthen you can spawn stat bars like so:\n\n```rust\ncommands\n.spawn_bundle((\n    // color of the statbar (required)\n    StatBarColor(Color::GREEN), \n\n    // color of the empty part of the statbar (optional)\n    StatBarEmptyColor(Color::BLACK),\n\n    // color and thickness of the border (optional)\n    StatBarBorder { color: Color::DARK_GRAY, thickness: 3.0 },\n\n    // initial value (0.0 is empty, 1.0 is full) (required) \n    StatBarValue(1.0),\n\n    // length and thickness of the bar (required)\n    StatBarSize { full_length: 50.0, thickness: 6.0 },\n\n    // entity the statbar tracks (required)\n    StatBarSubject(player_entity),\n\n    // position relative to the subject entity (40 units above in this case) (optional)\n    StatBarPosition(40.0 * Vec2::Y),\n\n    // takes a |\u0026Component| -\u003e f32 closure, which is called each tick with the\n    //      respective component of the subject entity.\n    //      returned f32 value is used to update StatBarValue\n    // (optional, can leave out and just update StatBarValue manually)\n    component_observer(|hp: \u0026Hp| hp.current as f32 / hp.max as f32)\n));   \n```\nand they should just work.\n\n## Notes\n\n* A stat bar is a single entity. It uses the bevy \nsprites renderer for drawing but doesn't create any\nintermediate sprite entities. \n\n* By default stat bars have a z_depth of 950, you \ncan set it yourself with the StatBarZDepth component.\n\n* The bars automatically despawn when the subject is despawned. \n\n* Doesn't use the built in Parent-Child transform propagation as\nmost of the time games don't want their indicator elements rotating \nor scaling with the sprite they are tracking.\n\n* Not optimised, doesn't use change detection etc or anything yet.\nExtremely unlikely to be a serious performance bottle neck though, unless you spawn\n10,000 stat bars at once or something.\n\n* You can have more than one stat bar track a subject entity. Just make sure each has a different ```StatBarPosition```, so they don't all draw on top of each other.\n\n* The ComponentObserver implementation is relatively slow, if you have a lot of status bars you might want to update StatusBarValue directly.\nThe advantage of the component observer is seperation. You shouldn't need to make any changes to your existing entities and systems to use them.\n\nThere is a complete-ish working example in the /examples folder.\n\nAny feedback / improvement suggestions / code submissions will be super appreciated.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fickshonpe%2Fbevy_simple_stat_bars","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fickshonpe%2Fbevy_simple_stat_bars","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fickshonpe%2Fbevy_simple_stat_bars/lists"}