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

Printing on a sprite that is the background of a room.

GML:
depth = -1;

draw_set_halign(fa_center);
draw_set_valign(fa_middle);
draw_set_font(font_game);

var camera = view_get_camera(view_current);
var cx = camera_get_view_x(camera);
var cy = camera_get_view_y(camera);
var cw = camera_get_view_width(camera)

draw_text(cx + cw div 2, cy + 24, string(global.highscore));
This is in an object with no sprite, it is called obj_0
controlsMenu. It runs every step of the game.
For some reason it doesn't draw the text.

Note: global.highscore IS defined correctly.
 

BenRK

Member
I'm going to guess then that is has to do with the camera stuff. You don't need that or changing depth if you use the Draw Gui event.
 

BenRK

Member
If it were me, I'd only put the draw_text function in the draw GUI event. I assume this is text that will always be on screen, which this event is pretty much made for. So just put in the x and y coordinates you want and it will draw there on the screen independent and on top of everything else.
 
Here's what I put in the draw gui event, it doesn't work.
GML:
draw_set_halign(fa_center);
draw_set_valign(fa_middle);
draw_set_font(font_game);

draw_text(683, 484, string(global.highscore));
 

BenRK

Member
You don't want to draw the room coordinates, but the screen coordinates. So instead use something like

draw_text(200,24,string(global.highscore));

Adjust those to where you need them on the screen it self, not where in the room.
 

BenRK

Member
It entirely depends on where you want it to appear on the screen. So if your room is your screen and you want it to appear at the top center of the screen, you would use something like x 683 and y 24. That would draw the text at the top center of the screen in this case.
 
Top