

int i;
int hpwidth=200;
int hpheight=16;
erase(0,0,0,1);
//draw border
setpen(255,255,255,0,2);
moveto(8,8);lineto(208,8);
lineto(hpwidth+8,hpheight+8);lineto(8,hpheight+8);
lineto(8,8);
//draw hp
setpen(0,255,0,0,1);
for(i=0;i<16;i++)
{
moveto(8,8+i);
lineto(hp*(hpwidth+8)/maxhp,8+i);
}
int j=width; //desired meter length
int i=(player.health*j)/player.hpmax;
int k=10; //height of healthbar
int l=k*.5; //position of healthbar
erase(255, 0, 0, 1);
setpen(200, 0, 0, 0, k); //red
moveto(0, l);
lineto(j, l); //draw background color
setpen(0, 255, 0, 0, k); //green
moveto(0, l);
lineto(i, l); //draw current health
Users browsing this forum: No registered users and 1 guest