GMS 2 Healthbar not drawing...

So, what I'm trying to do is create a "healthbar" that goes across the top of the screen when the player holds the esc button, and when the bar goes all the way across, the game closes.

However, when I test it, there is no healthbar until the game actually closes, when it's full.

Here's my code:
Code:
    draw_healthbar(5, 5, camera_get_view_width(view_camera[0]) - 5, 40, xit, $00FFFFFF &  FFFFFF, $FF13C11F & $FFFFFF, $FF0000E5 & $FFFFFF, 0, false, false);

    
    if (keyboard_check(vk_escape))
    {
        xit += 2;
    }

    else
    {
        xit -= 2;
    }

    if(xit == 100)
    {
        game_end();
    }

    if(xit == 0)
    {
        
    }
(xit is a variable declared in Variable Definitions, and this is in the 'begin step' event)
 
T

Taddio

Guest
Did you used draw_self(); in the draw event?
You basically have to if you take control of the draw event.
 

TheouAegis

Member
It's just a healthbar, use the Draw GUI event.

your drying your health bar to coordinates relative to the room, not relative to the view, so it is probably being drawn outside of the camera view and that is why you cannot see it.
 
Top