View Full Version : A project-igi healthbar in UT (help)

11th Oct 2001, 04:23 PM
OK, i want to make a health-bar in UT that looks like the one in
project-igi (http://www.watch.impress.co.jp/game/docs/20010312/igi10.jpg).

Now, i've thought about making a vertical healthbar with a
texture that repeats itself until it reaches the desired height. But
look at this picture:

Look at the left example. This is what i would end up with if i
didnt do anything about the part of the lines that is outside the
green guy. But then i i make another layer on top of all this i
could hide the lines using that (as in the right example). BUT, I
want to make a transparent HUD. This would mean everything
on the hud will get a bit transparent, and then, the lines will
show through that blue layer.

So then i came up with this idea:
I make a image of the health inside the guy:

Nice, now i want to make this work using a draw-space with a transparent background that i can
resize. And as the area to show the picture in gets smaller, the
pic gotta have some part thats outside the draw-space (this will
be invisible). Somehting like this:

Now, my question is:
Is it possible to make one of these drawingspaces? And if so,
how? I would be gratful for replies.


11th Oct 2001, 06:24 PM
Look at DrawTextureSegment in UWindowWindow - basically just set the clip of the Canvas (it defaults to the Screen resolution), draw your texture, let the canvas clip the top portion that you don't want, then reset the clip on Canvas and draw the rest of the HUD normally. Something like:

local Canvas C;
local int yOffset;

yOffset = 100 - Player.Health;
C.SetOrigin(0, 0 + yOffset);
C.SetClip(TexWidth, 0 + TexHeight - yOffset);

SetOrigin to set the upper left corner, which would equate to the top of our desired clipping bounds, and then set the clip region (bottom right) to the remainder of the texture height.

Hope that helps...

12th Oct 2001, 05:30 AM
how about DrawTile?

something like this:

Canvas.SetPos (DollX,DollY+(healt/100)*DollHeight);
Canvas.DrawTile( texture'mymod.doll', DollWidth, DollHeight-((healt/100)*DollHeight) , 0, (healt/100)*PictureHeight, PictureWidth, PictureHeight-(healt/100)*PictureHeight );

12th Oct 2001, 04:29 PM
Thanx guys!

I will test this soon :)

12th Oct 2001, 11:57 PM
Yeah, that'd work too. :)