• 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!

Text being redrawn in wrong place on return to level select room

MikeR

Member
Hi everyone,

I was wondering if anyone could help me fix this bug that I've been struggling to fix for weeks.

I have a level select screen which draws "Level 1, Level 2" etc. text under the level icons, along with "Title" and "Select a Level". When I first open this room the text is drawn in the correct place, however after playing a level and clicking the button to quit back to the level select screen, the text is then drawn in the wrong place for all text.

Does anyone have any idea what is causing this and how to fix it? I thought it was something to do with draw_set_halign but deleting this code from all text in the game hasn't solved the issue.

This is the code I'm using on my Draw_GUI event:

draw_set_font(font_default);
draw_text_shadow(x-30, y+68, "LEVEL 1", font_default, 1, c_black, c_black);
draw_text_shadow(x-30, y+66, "LEVEL 1", font_default, 1, c_black, c_white);

Many thanks,
Mike
 

MikeR

Member
Solved! There was still a draw_set_halign hidden in one of my objects which was messing up the position of the level select screen text, deleting this fixed the text location!

Thanks Ctrl+Shift F function!
 
Each time you have the game draw any text to the screen, you should be setting ALL the values, such as valign, halign, font, colour, etc. This removes the possibility of the incorrect value being inherited from previous text drawings.
 

MikeR

Member
Each time you have the game draw any text to the screen, you should be setting ALL the values, such as valign, halign, font, colour, etc. This removes the possibility of the incorrect value being inherited from previous text drawings.
Thanks! I've set all the text to halign, font, colour and it's all working fine now! Will add valign to it all too just to make sure, thanks for the explanation!
 
Top