A question from AUM 7:
F: Ich möchte das meine Zahlen im Panel rechtsbündig erscheinen wie im Bild:
0
10
100
A: Klicke hier um Alain Bregeon's Antwort zu laden.
And the answer:
A snipset for aum :
If you want a left align for display digit :
var font_width = 18;//your font width
var pos_left_digit = 150;//your pos x
var number_digit = 3;//your number digit
var indice;
var factor;
FONT panel_font, <bauhau20.bmp>, font_width, 30;
Panel test_panel
{
layer 3;
pos_x = pos_left_digit;
Pos_y = hier your y position
DIGITS 0,0,number_digit,panel_font,1,player.health;
FLAGS = visible,REFRESH,D3D;
}
--------
function align_left
{
test_panel.pos_x = pos_left_digit – (font_width*number_digit);
indice = 0;factor = 1;
while (indice < number_digit)
{
test_panel.pos_x += font_width *(player.health >= factor);
factor *= 10;
indice +=1;
}
}