Allright, so let me get this straight. You want to have a row of hearts on the screen and every time you pick up 4 powerups one heart is added to the row?
You could use a healtbar-style HUD element that has large enough intervals in the attribute that it only shows full hearts. In other words, if you increase the attribute with 1, the health bar will become larger and reveal a full heart (instead of half a heart, or one pixel of the next heart).
First off you need to have two different attributes:
Code: Select all
[heartpieces]
initial = 0
low = 0
high = 4
[hearts]
initial = 1
low = 0
high = 8
Then set up a simple script that will handle the 4 heart pieces becoming one heart:
Code: Select all
{
Spawn[ ()
{
LowLevel("setup");
} ]
setup[ ()
{
PawnRender(false); //Don't render the pawn
SetNoCollision(); //Don't collide
self.think = "run";
} ]
run[ ()
{
self.ThinkTime = 0.1; //execute every 0.1 seconds
if(GetAttribute("heartpieces","Player") = 4) // if enough powerups have been collected
{
SetAttribute("heartpieces",0,"Player"); // reset the number of the powerups
ModifyAttribute("hearts",1,"Player"); // add one full heart
}
} ]
}
Add a pawn with this script into the level. It will be invisible and doesn't collide with anything, so it shouldn't affect the game world in any way.
Next, you need to set up your HUD so that it shows the hearts. Now you should create a bitmap that has a row of hearts (either vertical or horizontal). I'll give an example of how to set up the HUD with a horizontal row of 8 hearts that are 32x32 pixels (So the image size for the HUD element is 256x32):
Code: Select all
[hearts]
type = horizontal
frame = XXX.bmp
framealpha = YYY.bmp
indicator = ZZZ.bmp
indicatoralpha = XYZ.bmp
framex = center
framey = 64
indicatoroffsetx = 0
indicatoroffsety = 0
indicatorwidth = 256
This should create the "health bar" in the top center of the screen.
I hope you get what I mean. I didn't test any of this so if you can't get it to work or get some weird errors feel free to ask questions.
***EDIT***
Oh, and welcome to the forums.

Pain is only psychological.