HealthBar Library
Diff: HealthBar.cpp
- Revision:
- 0:aa460a91bd33
- Child:
- 1:9f2d307b3b99
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HealthBar.cpp Wed May 03 15:51:20 2017 +0000 @@ -0,0 +1,70 @@ +#include "HealthBar.h" + +HealthBar::HealthBar() +{ + +} + +HealthBar::~HealthBar() +{ + +} + + + +void HealthBar::init(int HP) +{ + _HP = HP; + +} + +void HealthBar::MinusHP1(int HPLost1) +{ + _HPLost1 = HPLost1; + } + +void HealthBar::MinusHP2(int HPLost2) +{ + _HPLost2 = HPLost2; + } + +void HealthBar::draw(N5110 &lcd) +{ //printf("%d hp \n", _HP); //working + //printf("%d hplost1 \n", _HPLost1); //Working + printf("%d hplost2 \n", _HPLost2); + TotalHP = _HP + _HPLost1 + _HPLost2; + //printf("%d TotalHP \n", TotalHP); + if(TotalHP == 8){ + lcd.drawLine(0,47,84,47,1); //Working + } + if(TotalHP == 7){ + lcd.drawLine(0,47,70,47,1); //Working + } + if(TotalHP == 6){ + lcd.drawLine(0,47,60,47,1); //Working + } + if(TotalHP == 5){ + lcd.drawLine(0,47,50,47,1); //Working + } + if(TotalHP == 4){ + lcd.drawLine(0,47,40,47,1); //Working + } + if(TotalHP == 3){ + lcd.drawLine(0,47,30,47,1); //Working + } + if(TotalHP == 2){ + lcd.drawLine(0,47,20,47,1); //Working + } + if(TotalHP == 1){ + lcd.drawLine(0,47,10,47,1); //Working + } + if(TotalHP == 0){ + } + + +} + +void HealthBar::update() +{ + } + \ No newline at end of file