aboutsummaryrefslogtreecommitdiffstats
path: root/src/client.rs
diff options
context:
space:
mode:
authorLibravatar Alexander Foremny <aforemny@posteo.de>2024-03-18 07:26:56 +0100
committerLibravatar Alexander Foremny <aforemny@posteo.de>2024-03-18 07:30:53 +0100
commitad9a34852a289a19e480fc8c20eb2fe22544fadc (patch)
tree706844838a7e5a75c557d4c8110bdd9f5f5d2a76 /src/client.rs
parentcc19e7c6a5d91abeb55e00e8ece986101c2293bd (diff)
feat: vary max health
Diffstat (limited to 'src/client.rs')
-rw-r--r--src/client.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/client.rs b/src/client.rs
index 277fc2c..bd2c448 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -482,11 +482,15 @@ fn player_champion(
const HEALTH_OFFSET: f32 = 4.;
-fn render_health(players: Query<(&Health, &PlayerPosition)>, mut gizmos: Gizmos) {
- for (health, position) in players.iter() {
+fn render_health(players: Query<(&Health, &PlayerPosition, &EffectiveStats)>, mut gizmos: Gizmos) {
+ for (health, position, effective_stats) in players.iter() {
let start = position.0 + Vec2::new(-PLAYER_RADIUS, PLAYER_RADIUS + HEALTH_OFFSET);
let end = position.0 + Vec2::new(PLAYER_RADIUS, PLAYER_RADIUS + HEALTH_OFFSET);
- gizmos.line_2d(start, start.lerp(end, health.0 / MAX_HEALTH), Color::RED);
+ gizmos.line_2d(
+ start,
+ start.lerp(end, health.0 / effective_stats.0.max_health),
+ Color::RED,
+ );
}
}