skofrant
Member
Hi,
I would like the HUD bar to scale to the size of the window. Currently, when I start the game in the window, the HUD bar is the same size as in the full game screen
The HUD bar is located in the upper left corner of the screen.
there are lots of sprites and text in the hud bar. I don't know if to use the function here
something will help ... because it's not just one sprite and one text on the strip
can I use the surface function? but I do not know what it would look like in its final form
once the HUD bar only had a sprite of energy nothing more and it scaled , now it's quite extensive and I don't want to scale anymore
even here I have used such values before
thank you for any help ..
global_controler
draw_gui
I would like the HUD bar to scale to the size of the window. Currently, when I start the game in the window, the HUD bar is the same size as in the full game screen
The HUD bar is located in the upper left corner of the screen.
there are lots of sprites and text in the hud bar. I don't know if to use the function here
GML:
display_get_gui_width
can I use the surface function? but I do not know what it would look like in its final form
once the HUD bar only had a sprite of energy nothing more and it scaled , now it's quite extensive and I don't want to scale anymore
even here I have used such values before
GML:
var __guiW = display_get_gui_width(), __guiH = display_get_gui_height();
thank you for any help ..
global_controler
draw_gui
GML:
///HUD
var __guiW = display_get_gui_width(), __guiH = display_get_gui_height();
draw_sprite(spr_hp_bar,0,x+25,70);
draw_sprite_ext( spr_HUD, 0, x+145, y-10, 1, 1, 0, -1, 0.5 );
//life
draw_set_color(c_white);
draw_set_valign(fa_middle);
draw_set_halign(fa_center);
draw_set_font(font_hud);
draw_sprite(spr_life,1,340,70);
draw_text(340,105,string("x" + string(global.life)));
draw_text(340, 25,"lives");
//points
draw_set_color(c_white);
draw_set_valign(fa_middle);
draw_set_halign(fa_center);
draw_set_font(font_hud);
draw_sprite(spr_score,1,410,70);
draw_text(410, 105, ""+string(global.scores));
draw_text(410, 25,"scores");
//coins
draw_set_color(c_white);
draw_set_valign(fa_middle);
draw_set_halign(fa_center);
draw_set_font(font_hud);
draw_sprite(spr_coins,1,480,70);
draw_text(480, 105,string("$" + string(global.coins)));
draw_text(480, 25,"coins");
// 5 types of hero weapons to choose from .... displayed in one sprite
draw_set_color(c_white);
draw_set_valign(fa_middle);
draw_set_halign(fa_center);
draw_set_font(font_hud);
draw_sprite(spr_weapons,current_weapon,560,70); // draw a sprite of weapons
draw_set_color(c_white);
draw_set_valign(fa_middle);
draw_set_halign(fa_center);
draw_set_font(font_hud);
var i = current_weapon;
{
if !(i = 0)
draw_text(560,105,""+string(global.wep[i,e_wep.ammo])); // the number of ammunition
draw_text(560,25,""+string(global.wep[i,e_wep.name])); // drawing the name of the weapon
}
draw_set_color(c_white);
draw_set_valign(fa_middle);
draw_set_halign(fa_center);
draw_set_font(font_hud);
draw_text(190, 25,"hp bar");
//HP HUD
if instance_exists(par_player) {
hpHUD=global.hp;
maxHpHUD = par_player.maxHp;
//HUD Powerup
with obj_player {
var _offset;
_offset = 0;
draw_set_font(fnt_pwrup);
draw_set_valign(fa_bottom);
draw_set_halign(fa_center);
draw_set_color(c_white);
draw_texture_flush();
if pwrupSpd > 0 {
draw_sprite_ext(spr_pwrup_speed,0,__guiW-26,29+35*_offset,1,1,0,c_gray,.5);
draw_text(__guiW-26,29+35*_offset,string(ceil(pwrupSpd/room_speed)));
_offset++;
}
if pwrupStr > 0 {
draw_sprite_ext(spr_pwrup_strength,0,__guiW-26,35+35*_offset,1,1,0,c_gray,.5);
draw_text(__guiW-26,35+35*_offset,string(ceil(pwrupStr/room_speed)));
_offset++;
}
if pwrupJmp > 0 {
draw_sprite_ext(spr_pwrup_jump,0,__guiW-26,28+35*_offset,1,1,0,c_gray,.5);
draw_text(__guiW-26,28+35*_offset,string(ceil(pwrupJmp/room_speed)));
_offset++;
}
}
} else {
hpHUD = lerp(hpHUD,0,.5);
}
//HUD life
draw_sprite_part(spr_hp_bar,1,1,0,225/maxHpHUD*hpHUD,130,88,48);
draw_set_color(c_white);
draw_set_valign(fa_middle);
draw_set_halign(fa_center);
draw_set_font(font_hud);
draw_sprite(spr_head,1,60,70);