Search code examples
eventsdrawgame-maker-studio-2

GameMaker Studio 2 - Multiple Events - Draw if mouse_enter event


i'd like to draw something over my sprite when the mouse is on it. Something like that (in the draw event of my object) :

if(ev_mouse_enter)draw_text(x,y,hp);

But it's not working (i know why). I've been thinking about using some boolean to counter that. Is it my only option ?


Solution

  • Well, if you're doing something like starcraft, they were billions, etc. you may want to have a 'selected' variable for the last unit / building / etc to keep that information up for them.

    if (mouse_check_button_pressed(mb_left)) {
       if (place_meeting(mouse_x, mouse_y, oTarget)) {
          oGame.selectedUnit = other.id;
       }
    }