Very easy, but good looking health example

Posted by glory_in_death on July 27, 2006, 11:43 p.m.

ok, this is a very simple healthbar example, but I thought it looked pretty sweet. I was just screwin around and I came up with this, sorry if its been seen before but I never saw it.

//create event
healthvar = 100;
c1 = c_green;
c2 = c_green;

//step event
if healthvar <= 90 && healthvar >= 50
 {c1 = c_yellow; c2 = c_yellow;}
if healthvar <= 50 && healthvar >= 0
 {c1 = c_red; c2 = c_red;}

//draw event
draw_line_color(x,y,x+healthvar,y,c1,c2;

and then if you want the bar to shrink/grow from both sides, modify

draw_line_color(x,y,x+healthvar,y,c1,c2;

to

draw_line_color(x-healthvar,y,x+healthvar,y,c1,c2;

Heres another one that looks pretty cool, using draw_button and draw_rectangle_color

its shrink/grows from both sides

draw_button(x-health-6,y-5,x+health+6,y+10,1);
draw_rectangle_color(x-health+3,y-2,x+health-2,y+8,c1,c1,c1,c1,false);
draw_text(x,y,health)

like I said, very basic, but I though I'd share anyway. If you like it, please comment on it. Or comment anyway, I don't care :-P

Comments

ultim8p00 18 years, 3 months ago

Man your font is so small. I can barely read.

yeah, simple things are always great.Like the DS!