Healthbar not properly falling players

L

Loserizer

Guest
My code is as follows:
on drawGUI event for the hpbar object: draw_healthbar(x, y, x+10, y+5, 50, c_black, c_red, c_lime, 0, true, true)
and step:
x = obj_player.x;
y = obj_player.y + 2;
upload_2016-8-29_23-3-3.png
as you can see it follows not above, but way off into the corner.
The intended effect is right above his head.
 

Roderick

Member
Not sure why it's going to the wrong spot, but remember that, when dealing with the y axis, + is down. I suspect you want obj_player.y - 2 instead.
 
L

Loserizer

Guest
Not sure why it's going to the wrong spot, but remember that, when dealing with the y axis, + is down. I suspect you want obj_player.y - 2 instead.
Thanks, fixed that part. Issue still present
 
L

Loserizer

Guest
In the draw GUI event the x,y coordinates are relative to the screen and not the room.

Figured it out actually. My screen is 1024x768 while my room is 256x176 so I just multiplied the coordinates by 4 to get the intended effect.
 

TheouAegis

Member
You still shouldn't be drawing it in the GUI. The health bar is following the player's position in the room, not his position in the window. What if someone else wants to play your game with a higher resolution monitor? That x4 would make the healthbar in the wrong spot again.
 
Top