diff options
| author | troido <troido@hotmail.com> | 2017-11-10 21:13:29 +0100 |
|---|---|---|
| committer | troido <troido@hotmail.com> | 2017-11-10 21:13:29 +0100 |
| commit | e1786cfdaf3ac96c0ea4be4e18ea678fbb135d97 (patch) | |
| tree | 87ce8a032b0571cc222d784143420efeb6776d40 /asciifarm/client/display/healthpad.py | |
| parent | 6bf3afa02bc58facb5038dd6c05f615efab47a60 (diff) | |
added force option to pads. not usd it yet
Diffstat (limited to 'asciifarm/client/display/healthpad.py')
| -rw-r--r-- | asciifarm/client/display/healthpad.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/asciifarm/client/display/healthpad.py b/asciifarm/client/display/healthpad.py index d4ee3f8..502559a 100644 --- a/asciifarm/client/display/healthpad.py +++ b/asciifarm/client/display/healthpad.py @@ -15,6 +15,10 @@ class HealthPad: self.maxHealth = 0 def setHealth(self, health, maxHealth): + self.health = health + self.maxHealth = maxHealth + + self.pad.erase() barEnd = round(health/maxHealth * self.width) self.pad.addstr(0,0,"Health: {}/{}".format(health, maxHealth)[:self.width]) @@ -30,8 +34,8 @@ class HealthPad: def getHeight(self): return 2 - def update(self, screen, x, y, xmax, ymax): - if not self.changed and (x, y, xmax, ymax) == self.lastView or xmax <= x or ymax <= y: + def update(self, screen, x, y, xmax, ymax, force=False): + if not self.changed and (x, y, xmax, ymax) == self.lastView or xmax <= x or ymax <= y and not force: return self.lastView = (x, y, xmax, ymax) self.changed = False |
