Draw text when mouse is over object

Elson

Member
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