Stupid Question about dynamicaly sizing panels

Posted By: Metal_Thrasher

Stupid Question about dynamicaly sizing panels - 04/21/09 01:38

I keep really to give my panel a variable for the size. But when the engine compiles my script it tells me it's looking for a number and not a var. So how else am i supposed to make my health bar??

Sorry this is a lame question, but i've rarely done anything with panels.
Posted By: Spirit

Re: Stupid Question about dynamicaly sizing panels - 04/21/09 01:43

my_panel.size_x = new_size?
Posted By: Metal_Thrasher

Re: Stupid Question about dynamicaly sizing panels - 04/21/09 01:52

I don't know.

Here's what I have, it won't work.
Code:
bmap bmap_background = <healthbar.bmp>;
panel panel_editor{
	pos_x = 0;
	pos_y = 0;
	layer = 1;
	size_x = playerhealth;
window(10,50,122,7,bmap_background,0,0);

	flags = visible, transparent;
}

Posted By: delinkx

Re: Stupid Question about dynamicaly sizing panels - 04/21/09 05:03

on defining the panel, u cannot put a variable assigned to the size. But on run time u do can change that. here is an example:

Code:
BMAP* bmap_background = "healthbar.bmp";

PANEL* panel_editor =
{
  pos_x = 0; 
  pos_y = 0;
  layer = 1;
  size_x = 1;
  bmap = bmap_background;
  flags =  SHOW;
}

funtion main()
{
  ...
  ...
  panel_editor->size_x += healthgained;
  panel_editor->size_x -= healthlost;
  ....
}



this way on runtime u can modify the size.
Posted By: Metal_Thrasher

Re: Stupid Question about dynamicaly sizing panels - 04/23/09 08:22

Okay, I don't why, but why the hell do my post keep getting moved to the lite-c forum?! Did the person that moved this maybe consider that I posted it in C-scipt because that's what kind of code it is? I don't what to confuse people.

Anyway, sorry, the code you wrote me is lite-c, but I think i can convert it.

But I may have been wrong all along. i think I want to change the x-size of the window part and not the panel blush
Posted By: Metal_Thrasher

Re: Stupid Question about dynamicaly sizing panels - 04/24/09 18:40

This isn't working my panel is staying the same size no matter what??
Posted By: EvilSOB

Re: Stupid Question about dynamicaly sizing panels - 04/24/09 21:32

Have you tried simply
panel_editor.size_x += healthgained;
panel_editor.size_x -= healthlost;


If that doesnt help, try putting a wait(1); in after any size change.

If even THAT doesnt help, try (both lines together))
reset(panel_editor,SHOW);
set(panel_editor,SHOW);

Posted By: Metal_Thrasher

Re: Stupid Question about dynamicaly sizing panels - 04/27/09 02:37

Originally Posted By: EvilSOB
Have you tried simply
panel_editor.size_x += healthgained;
panel_editor.size_x -= healthlost;


If that doesnt help, try putting a wait(1); in after any size change.

If even THAT doesnt help, try (both lines together))
reset(panel_editor,SHOW);
set(panel_editor,SHOW);


Never mind i got it, your suggestion worked, thanks a lot dude.
Posted By: EvilSOB

Re: Stupid Question about dynamicaly sizing panels - 04/27/09 02:44

Not a problem.
© 2024 lite-C Forums