Making the healthbar stick to my cameraview? [SOLVED]

J

Jacceb99

Guest
This is a pretty simple one, i simply want my healthbar to stick to the upper-left corner of my camera view, this is my code for the healthbar:

STEP EVENT:
x=camera_get_view_x(view_camera[0]);
y=camera_get_view_y(view_camera[0]);

What happens is that it simply places it in the corner once when it's created, It's like i've written it in the create event. Maybe the "get" commands doesen't work like this?

Thanks in advance
 
M

maratae

Guest
This is a pretty simple one, i simply want my healthbar to stick to the upper-left corner of my camera view, this is my code for the healthbar:

STEP EVENT:
x=camera_get_view_x(view_camera[0]);
y=camera_get_view_y(view_camera[0]);

What happens is that it simply places it in the corner once when it's created, It's like i've written it in the create event. Maybe the "get" commands doesen't work like this?

Thanks in advance
Just use the Draw GUI event, and draw with absolute coords, why not?
 
O

orSQUADstra

Guest
Pro tip: Use the Draw GUI event for that. It's like a surface. Draw the healthbar in the Draw GUI event at the 0,0 position. 0,0 is always the top left corner of your view.

Cheers!

Edit: Aww, you beat me, Ninja Maratae :p
Just use the Draw GUI event, and draw with absolute coords, why not?
 
J

Jacceb99

Guest
Just use the Draw GUI event, and draw with absolute coords, why not?
Yes obviously thanks!

Pro tip: Use the Draw GUI event for that. It's like a surface. Draw the healthbar in the Draw GUI event at the 0,0 position. 0,0 is always the top left corner of your view.

Cheers!

Edit: Aww, you beat me, Ninja Maratae :p
A for effort:)

Just use the Draw GUI event, and draw with absolute coords, why not?
For some reason when i just use "draw_self();" on any sprite what so ever in the draw gui event, they become super small. Really have no idea what would be causing this.
Found a post about the same issue but no solution https://forum.yoyogames.com/index.php?threads/sprites-drawing-in-different-sizes-on-gui.24663/

Nvm i realize how GUI's work now, cheers
 
Last edited by a moderator:
Top