r/gamemaker • u/AverageArtistReddit • 1d ago
Help! Draw_Set_align resetting issues?
So, I'm following tutorials and have a recurring issue with setting text. So, it's an encouraged practise when you change text alignment to "reset" it to the defaults at the end of the event, right?
I have this code:
draw_self();
draw_set_font(ft_hud);
draw_set_valign(fa_middle);
draw_text(x + 60, y - 40, value_to_draw);
draw_set_valign(fa_top);
Where the number in the screenshot should be set to fa_middle/in line with the sprite, but seems to be set at fa-top instead? Don't know if there's something else I might have made a mistake with?
The sprite is 71x71 and takes up most of the sprite editor box if that information is helpful at all.
I can't seem to find anyone else having this issue.
7
u/Monscawiz 1d ago
Where's the sprite's origin? What you're doing is taking a position that's +60 on the x axis and -40 on the y axis from the sprite's ORIGIN, and drawing the number so that the middle of the number is at that point.
1
u/TheGreenSocks 1d ago edited 1d ago
Hard to tell without seeing the rest of your code, but this seems to be doing exactly what you're telling it to: vertical align to the middle and draw it 40 pixels above the instance.
Where did you get the magic numbers? You probably want to valign to middle, and add half your sprite_height instead of subtracting it?