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

Draw text when mouse is over object

E

Elson

Guest
Hi! I am new to GML and I need help with this:

I want to show a text when mouse is over an object, but I don't know why it isn't working...

Edit: I tried with draw_set_color(c_black) too
 

Attachments

Simon Gust

Member
It works as I expect it to in GM:S 1.4
1605797474341.png
But that obviously isn't the result you're looking for.
And I'm pretty sure the keyword "self" has been changed somewhat in GM:S 2

I think it's best to leave it alone and utilise a different code.
Code:
if (point_in_rectangle(mouse_x, mouse_y, bbox_left, bbox_top, bbox_right, bbox_bottom)) 
{
    draw_text_transformed(x, y, "hovering", 1, 1, 0);
}
1605797637655.png
Now it will correctly show only on the instance I'm actually hovering over.

The rest of your code shouldn't cause any trouble.
 
Top