Whats the width and height of your health.png?
window(22,4,png_width_in_pixels,png_height_in_pixels,"health.png",health,0);
this is for a horizontaly bar.
If you decrease now the health variable, the bar should become shorter.
Only that in your code I don't have a bitmap that is being moved inside window. I kinda need to cut it instead. Unfortunately your code won't do the trick.
/-/
float win_width = (85*health)/100; //Calculate the number of pixels which corresponds to health value
var win_height = 15;
/-/
//Inside panel is this:
window(22,4,win_width,win_height,"health.png",0,0);
/-/
These are the numbers for bmap's width and height
(Changed win_width to float too now). I calculate width according to health's fill number. Basically when I have 100 health my picture (or window in that case) is 85 pixels, if I have 50 health picture will be then 42,5 pixels. But I guess here's the catch!
The window() doesn't accept demical numbers in it (I have tested). Even if I replace the
demical value with a
real value and keep the
win_height in, I still get an error but this time for
win_height. It won't accept variables in it too or I have defined somehow wrong?
When I change manually these values (without variables and in real values) it's fine - working.
It's interesting to know what I'm doing wrong here :P.