pixeltroid
Member
So I have a working HUD that displays my health and remaining ammo and keys.
Here's a screenshot of what it looks like:
This works fine and does what it's supposed to do.
HOWEVER, when I load a saved game from the main menu,,, the text shifts upwards by a few pixels, as seen in this screenshot:
As you can see, the text and numbers have shifted up by a few pixels. Does anybody know what is causing this glitch?
Here are my codes. Can someone please look into this and tell me what I can do to resolve this problem?
for obj_hud (that controls the dispay of hud)
Can someone please help me with this? Thanks!
Here's a screenshot of what it looks like:
This works fine and does what it's supposed to do.
HOWEVER, when I load a saved game from the main menu,,, the text shifts upwards by a few pixels, as seen in this screenshot:
As you can see, the text and numbers have shifted up by a few pixels. Does anybody know what is causing this glitch?
Here are my codes. Can someone please look into this and tell me what I can do to resolve this problem?
for obj_hud (that controls the dispay of hud)
script "scr_savegame" that saves game//draw healthbar
draw_sprite_ext(spr_health_fill, 1 ,view_xview[0] + 14, view_yview[0] + 15, obj_player.health/100,1,0, c_white, 1);
draw_sprite(spr_health_border, 1 , view_xview[0] + 14, view_yview[0] + 15)
///draw fps
draw_set_halign(fa_left);
draw_set_color(c_red);
draw_set_font(fnt_small);
draw_text(view_xview[0]+160, view_yview[0]+15,fps);
///draw bombs
draw_sprite(spr_HUDbomb, 1 , view_xview[0] + 15, view_yview[0] + 30)
draw_set_halign(fa_left);
draw_set_color(c_black);
draw_set_font(fnt_small);
draw_text(view_xview[0] + 31, view_yview[0] + 29, + string(global.bombs));
draw_set_halign(fa_left);
draw_set_color(c_white);
draw_set_font(fnt_small);
draw_text(view_xview[0] + 32, view_yview[0] + 30, + string(global.bombs));
///draw shot
draw_sprite(spr_HUDshot, 1 , view_xview[0] + 15, view_yview[0] + 42)
draw_set_halign(fa_left);
draw_set_color(c_black);
draw_set_font(fnt_small);
draw_text(view_xview[0] + 31, view_yview[0] + 41, + string(global.shot));
draw_set_halign(fa_left);
draw_set_color(c_white);
draw_set_font(fnt_small);
draw_text(view_xview[0] + 32, view_yview[0] + 42, + string(global.shot));
///draw flames
draw_sprite(spr_HUDflame, 1 , view_xview[0] + 15, view_yview[0] + 54)
draw_set_halign(fa_left);
draw_set_color(c_black);
draw_set_font(fnt_small);
draw_text(view_xview[0] + 31, view_yview[0] + 53, + string(global.flame));
draw_set_halign(fa_left);
draw_set_color(c_white);
draw_set_font(fnt_small);
draw_text(view_xview[0] + 32, view_yview[0] + 54, + string(global.flame));
///draw keys
draw_sprite(spr_HUDkey, 1 , view_xview[0] + 15, view_yview[0] + 66)
draw_set_halign(fa_left);
draw_set_color(c_black);
draw_set_font(fnt_small);
draw_text(view_xview[0] + 31, view_yview[0] + 65, + string(global.keys));
draw_set_halign(fa_left);
draw_set_color(c_red);
draw_set_font(fnt_small);
draw_text(view_xview[0] + 32, view_yview[0] + 66, + string(global.keys));
script "scr_loadgame" that loads game:with (argument0){
ini_open("save.ini");
roomAlias = "1A" //default room
if (room=room1A) roomAlias = "1A"
if (room=room1B) roomAlias = "1B"
if (room=room2A) roomAlias = "2A" //and so on
//ini_write_real("SaveFile1", "LoadedRoom",roomAlias);
ini_write_string("SaveFile1", "LoadedRoom",roomAlias);//save it as ini file
ini_write_real("SaveFile1", "playerx",x);
ini_write_real("SaveFile1", "playery",y);
ini_write_real("SaveFile1", "lock_killed1",global.lock_killed[1]);
ini_write_real("SaveFile1", "keyboss_killed1",global.keyboss_killed[1]);
ini_write_real("SaveFile1", "door_opened0",global.door_opened[0]);
ini_write_real("SaveFile1", "keys",global.keys);
ini_close();
}
I dont know what is causing this. Is it an issue with the code in the object that controls the HUD, or the script that loads the game?if file_exists("save.ini")
{
ini_open("save.ini");
LoadedRoom=room1A; //default room
roomAlias=ini_read_string("SaveFile1", "LoadedRoom", "1A");
if (roomAlias=="1A") LoadedRoom = room1A
if (roomAlias=="1B") LoadedRoom = room1B
playerx=ini_read_real("SaveFile1", "playerx", 10);
playery=ini_read_real("SaveFile1", "playery", 10);
global.lock_killed[1] = ini_read_real("SaveFile1", "lock_killed1", 0);
global.keyboss_killed[1] = ini_read_real("SaveFile1", "keyboss_killed1", 0);
global.door_opened[0] = ini_read_real("SaveFile1", "door_opened0", 0);
global.keys=ini_read_real("SaveFile1", "keys", 0);
ini_close();
instance_create(playerx, playery-200, obj_player);
room_goto(LoadedRoom);
}
else
{
//do nothing
}
Can someone please help me with this? Thanks!