Draw Event

HandsomeKT

Member
Whenever I draw in a non-draw event, it doesn’t draw, so I put if statements in draw events to try to get that to work, but it still doesn’t work, is there anyway I could do something like, when key A pressed, Draw A.
 

FrostyCat

Member
And what's wrong with doing this in the Draw event?
Code:
if (keyboard_check(ord("A"))) {
  draw_text(x, y, "A");
}
 

HandsomeKT

Member
Well, I do use drag and drop because that is how I was taught, I wanted to learn GML but I didn't so this is what Gamemaker converted my drag and drop into GML



Code:
var l27403AB7_0;
l27403AB7_0 = mouse_check_button_pressed(mb_left);
if (l27403AB7_0)
{

}

var l7043AB64_0;
l7043AB64_0 = keyboard_check_pressed(ord("A"));
if (l7043AB64_0)
{

}

draw_self();

draw_set_colour($FF000000 & $ffffff);
var l5960A712_0=($FF000000 >> 24);
draw_set_alpha(l5960A712_0 / $ff);

draw_set_font(loginfont);

draw_text(737, 634, string("A") + "");
 

TheouAegis

Member
Your code is drawing A all the time because it is not inside the brackets.

In DnD, when you place a IF action, the next action you put must go to the RIGHT in order for it to be performed as a result.
 
Top