1. Hello Guest! It's with a heavy heart that we must announce the removal of the Legacy GMC Archive. If you wish to save anything from it, now's the time! Please see this topic for more information.
    Dismiss Notice

Draw Event

Discussion in 'Programming' started by HandsomeKT, Aug 27, 2019.

  1. HandsomeKT

    HandsomeKT Member

    Joined:
    Nov 17, 2018
    Posts:
    2
    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.
     
  2. Simon Gust

    Simon Gust Member

    Joined:
    Nov 15, 2016
    Posts:
    3,221
    Can you show the code you were using?
     
  3. FrostyCat

    FrostyCat Member

    Joined:
    Jun 26, 2016
    Posts:
    4,712
    And what's wrong with doing this in the Draw event?
    Code:
    if (keyboard_check(ord("A"))) {
      draw_text(x, y, "A");
    }
    
     
  4. HandsomeKT

    HandsomeKT Member

    Joined:
    Nov 17, 2018
    Posts:
    2
    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") + "");
     
  5. TheouAegis

    TheouAegis Member

    Joined:
    Jul 3, 2016
    Posts:
    7,145
    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.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice