hm
This commit is contained in:
parent
4d3fc2cd47
commit
c9dd7182aa
35 changed files with 478 additions and 288 deletions
|
|
@ -581,11 +581,13 @@
|
|||
|
||||
const hpActive = (this.hpBarTimer || 0) > 0;
|
||||
const stressActive = (this.stressBarTimer || 0) > 0;
|
||||
if ((hpActive || stressActive) && (showDecor || this.world.selected === this || this.hurtTimer > 0.04)) {
|
||||
if (hpActive || stressActive) {
|
||||
const bw = Math.max(28, this.radius * 2.35);
|
||||
const bh = 5;
|
||||
const x = this.x - bw / 2;
|
||||
const baseY = this.y - drawH * 0.55 - 16;
|
||||
const stressY = hpActive ? baseY + 7 : baseY;
|
||||
const hpY = stressActive ? baseY - 7 : baseY;
|
||||
const drawMeter = (y, pct, fill, alpha) => {
|
||||
ctx.save();
|
||||
ctx.globalAlpha = alpha;
|
||||
|
|
@ -607,11 +609,11 @@
|
|||
};
|
||||
if (stressActive) {
|
||||
const pct = clamp((this.stress || 0) / 130, 0, 1);
|
||||
drawMeter(baseY, pct, pct > 0.72 ? "rgba(178,74,110,0.92)" : "rgba(212,126,84,0.90)", clamp((this.stressBarTimer || 0) / 0.7, 0.35, 1));
|
||||
drawMeter(stressY, pct, pct > 0.72 ? "rgba(178,74,110,0.92)" : "rgba(212,126,84,0.90)", clamp((this.stressBarTimer || 0) / 0.7, 0.35, 1));
|
||||
}
|
||||
if (hpActive) {
|
||||
const pct = typeof tarinaiEnergyRatio === "function" ? tarinaiEnergyRatio(this) : clamp(this.energy / Math.max(1, this.maxEnergy || 100), 0, 1);
|
||||
drawMeter(baseY - (stressActive ? 11 : 0), pct, pct > 0.45 ? "rgba(118,190,80,0.88)" : (pct > 0.20 ? "rgba(232,172,68,0.90)" : "rgba(218,82,70,0.92)"), clamp((this.hpBarTimer || 0) / 0.7, 0.35, 1));
|
||||
drawMeter(hpY, pct, pct > 0.45 ? "rgba(118,190,80,0.88)" : (pct > 0.20 ? "rgba(232,172,68,0.90)" : "rgba(218,82,70,0.92)"), clamp((this.hpBarTimer || 0) / 0.7, 0.35, 1));
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue