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

draw_text offset issues

S

Shariku Onikage

Guest
I've been dealing with an issue where draw_text is heavily offset from its object for some time now. Since it won't make it to the final game it's not much of an issue but i'm curious as to why it's happening.

In the image below player and enemy objects have draw_text in their 'Draw GUI' event (i've circled the object with their draw_text result). Although it does appear to move in the direction the enemy is moving, the draw_text appears to be extremely offset for no discernible reason.
upload_2016-8-24_14-27-43.png

In most case the code is simply

Code:
draw_text(x+10,y+10,value);

In the case of the player object, i notice the the draw_text moves the direction the player moves, but will travel across the screen a lot faster, very quickly overtaking it and ending up on the other side of the screen. The two screenshots below shows what happens to the draw_text belonging to the player when the object moves one screen width to the right.
upload_2016-8-24_14-41-50.png
upload_2016-8-24_14-43-2.png

draw_set_halign and draw_set_valign have been mentioned in the reference guide as affecting draw_text and i do use them elsewhere (mainly for a separate text engine) but changing these doesn't affect the issue.

I've tried changing the code as below wondering if it was possibly adding 10 each time (though the y axis is unaffected) but this had no effect:

Code:
draw_text(x,y,value);
The issue occurs with views turned off and on.

Does anyone have any idea what's causing this, and what i can do to prevent it? Thanks in advance.
 
Last edited by a moderator:

jo-thijs

Member
You are drawing the text in the draw GUI event.
Things drawn there don't scale nor move with views.
By default, drawing at position (x, y) in the draw GUI event, will draw at pixel (x, y) from the top left corner of the window.
You'll need to use the draw end event for this.
 
S

Shariku Onikage

Guest
Yup. That did it. All fixed.

I apparently just flat out learnt this wrong.

Thank you.
 
Top