Posted By: PrenceOfDarkness
creating and modifying panels - 11/25/08 08:55
I'm trying to create healthbars for everything in my game. Here is the basic code below and it's simply not working. I added the malloc line because I wasn't sure if I needed to allocate memory for the panel. It didn't help the problem so I'm guessing the answer is no.
I just thinking having health bars over every monster will look cool and it's killing me that I can't get this to work. Anyone have any ideas what's going on? The formula for the player health is right because when I define a panel in SED everything works right. Obviously I can't define 1000 health bars for every single possible monster, And I don't feel like just making 20 and having them all share. As a last resort I'll do that.
Code:
var pHealthBar1 = 50;
PANEL* myHPpanel = malloc(sizeof(HPpanel));
myHPpanel = pan_create("flags = VISIBLE;window (0, 0, 100, 10, healthbar_bmp, pHealthBar1, 0);",4);
// pan_setvar(myHPpanel,5,1.0,&pHealthBar1);
pHealthBar1 = (100*(player.hplvl-pHealth)/player.hplvl);
I just thinking having health bars over every monster will look cool and it's killing me that I can't get this to work. Anyone have any ideas what's going on? The formula for the player health is right because when I define a panel in SED everything works right. Obviously I can't define 1000 health bars for every single possible monster, And I don't feel like just making 20 and having them all share. As a last resort I'll do that.