• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

[SOLVED] Need help with views and HUD

V

Vincent

Guest
So I'm making a game and I wanted a heart-based life system. The only problem I have is that I don't know how to place the object so it is visible when the view changes. Like to "tie" that object to the view's corner so it doesen't disappear when the player moves. I'm using gml, but I can't find a way to solve this.
Thanks for your time!
 
Last edited by a moderator:

RangerX

Member
You need to draw your hud according the view position.
You have variables to figure out what offset is needed , the calculate the position of your hud:

https://docs.yoyogames.com/source/dadiospice/002_reference/windows and views/views/index.html

So positioning your hud element will sound like this:
draw_sprite_ext(spr_Hearts,0,view_xview+22,view_yview+22,1,1,0,c_white,image_alpha);


You can also draw it in GUI layer, Its always there regardless the view you're using.
 
V

Vincent

Guest
You need to draw your hud according the view position.
You have variables to figure out what offset is needed , the calculate the position of your hud:

https://docs.yoyogames.com/source/dadiospice/002_reference/windows and views/views/index.html

So positioning your hud element will sound like this:
draw_sprite_ext(spr_Hearts,0,view_xview+22,view_yview+22,1,1,0,c_white,image_alpha);


You can also draw it in GUI layer, Its always there regardless the view you're using.
So in what event do I have to write this? Thanks!
 
A

Adhiesc

Guest
You can always make Draw GUI Event to make HUD exactly based on screen.
like ...
Code:
draw_sprite(heart, 0, 16, 16)
you don't even need to worry about views if you draw it as GUI.
 
V

Vincent

Guest
You can always make Draw GUI Event to make HUD exactly based on screen.
like ...
Code:
draw_sprite(heart, 0, 16, 16)
you don't even need to worry about views if you draw it as GUI.
Yes, now it works! Thanks!!
 
Top