GML "Draw Sprite" on click

Discussion in 'Programming' started by Ellys, Aug 13, 2019.

  1. Ellys

    Ellys Member

    Aug 11, 2019
    Hey coders,

    I want to draw a sprite on click and have it stay there until I click again.
    This is what i have so far.

    if mouse_check_button_released(mb_left) && position_meeting(mouse_x, mouse_y, oStats)
    draw_sprite(sStatBG, 0, 400, 400);

    I understand the draw function is usually in the draw event but that draws the sprite immediately instead of on click. So this code is currently in my step (evidently doesn't work)

    Any help would be appreciated, thank you.
  2. curato

    curato Member

    Jun 30, 2016
    If I were doing it I would make the object and use a variable to store the true false of if it is clicked or not then override the standard draw even with an if statement of if clicked is true then call draw_self to get the sprite assigned to the object.

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