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

Mac OSX Trying to Draw GUI Text on Enemy Death

M

myemanisbob

Guest
As the Title suggests, I'm trying to draw text on the screen whenever an enemy dies. My dead enemy is a separate object, so I'm writing all of this code on his create event, so that it triggers the second he dies. The game is not crashing, but no text is appearing. What am I doing wrong? All I want is the letter F to appear on the top left of the screen when an enemy dies.
Code:
gui_width = display_get_gui_width();
gui_height = display_get_gui_height();
gui_margin = 32;
text_x = gui_width + 200;
text_y = gui_height + gui_margin;
text_itemheight = font_get_size(fnt_menu);
draw_set_font(fnt_menu);
draw_set_halign(fa_left);
draw_set_valign(fa_top);
var txt = "F"
var xx = text_x;
var yy = text_y - (text_itemheight * 1.5);
draw_set_color(c_black);
draw_text(xx,yy,txt);
 

Tony Brice

Member
First question. What colour is your background in the game? I ask this because you're setting the text colour to black.
 
M

myemanisbob

Guest
You can only use draw commands in the draw/gui events. Also, the create event only fires once, so even if you could do it there, it would only exist for 1 frame (which is presumably 1/60th of a second). Try moving it to a gui draw event and seeing if it works then.

It might be worth reviewing the manual on what events do and what order they go in as well: https://docs2.yoyogames.com/source/_build/2_interface/1_editors/events/index.html
No change in the Draw GUI event. Also the background is grey so the black should show up.
 
Top