//=================================================================================================================================
//
#define HEARTS_MAX 24
#define HEARTS_PER_ROW 8
ENTITY* hud_ent_heart[HEARTS_MAX];
//
function heart_startup()
{ var h; for(h=0; h<HEARTS_MAX; h++) //only needs running ONCE bet game-boot
{ hud_ent_heart[h] = ent_createlayer("Herz.mdl", NULL, 1000);
var x_pos = 360-(cycle(h,0,HEARTS_PER_ROW)*35);
var y_pos = 280-(integer(h/HEARTS_PER_ROW)*50);
vec_set(hud_ent_heart[h].x, vector(700, x_pos, y_pos));
hud_ent_heart[h].tilt = 90; }
}
//
//
function heart_1()
{
var heart_num = integer(player.skill98 / 4);
var this_heart = fraction(player.skill98 / 4)*100;
var h; for(h=0; h<HEARTS_MAX; h++)
{ if(heart_num<h) //if lower health than this heart
{ ent_animate(hud_ent_heart[h], "heartp", 0, ANM_SKIP); }
else
{ if(heart_num>h) //if higher health than this heart
{ ent_animate(hud_ent_heart[h], "heartp", 100, ANM_SKIP); }
else //if ON this heart
{ ent_animate(hud_ent_heart[h], "heartp", this_heart, ANM_SKIP); }
}
//insert standard heartbeat animation here if you want to.
}
///// DE-Bugging ONLY - START
str_cpy(health, ""); str_cat_num(health, "health = %.0f", player.skill98);
str_cpy(v1,""); str_cat_num(v1,"heart = %.0f",heart_num);
str_cpy(v2,""); str_cat_num(v2,"percent = %.0f",fraction(player.skill98/4)*100);
///// DE-Bugging ONLY - END
}
//
//
//=================================================================================================================================