diff options
| author | troido <troido@protonmail.com> | 2019-09-18 12:07:58 +0200 |
|---|---|---|
| committer | troido <troido@protonmail.com> | 2019-09-18 12:07:58 +0200 |
| commit | b95a08c303c08d955142312a72f0e51a5edcffdf (patch) | |
| tree | 891e612690f6618f85b48dda30a6b89bfa23bf56 /asciifarm/client/display/health.py | |
| parent | e2ecd2b2c5b6bc2bc1dbce6f669c96707683313d (diff) | |
cleanup!
Diffstat (limited to 'asciifarm/client/display/health.py')
| -rw-r--r-- | asciifarm/client/display/health.py | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/asciifarm/client/display/health.py b/asciifarm/client/display/health.py deleted file mode 100644 index d42edbf..0000000 --- a/asciifarm/client/display/health.py +++ /dev/null @@ -1,27 +0,0 @@ - - -from .widimp import WidImp - -class Health(WidImp): - - def __init__(self, char=None, emptyChar=None): - self.char = char or ('@',7,0) - self.emptyChar = emptyChar or ('-',7,0) - self.changed = False - self.health = 0 - self.maxHealth = 0 - - def setHealth(self, health, maxHealth): - self.health = health or 0 - self.maxHealth = maxHealth or 0 - self.change() - - def update(self, win): - width, height = win.getSize() - width -= 1 - barEnd = round(self.health/self.maxHealth * width) if self.maxHealth > 0 else 0 - win.erase() - win.addLine((0,0),"Health: {}/{}".format(self.health, self.maxHealth)[:width]) - win.addLine((0, 1), self.char[0]*barEnd, self.char[1:]) - win.addLine((barEnd, 1), self.emptyChar[0]*(width-barEnd), self.emptyChar[1:]) - win.noutrefresh() |
