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

SOLVED working with mouse_x , mouse_y (textbox)

F

FiftyFive

Guest
(sorry for my bad English) Hello , i just made a working textbox , when my charracter close to sign and press "space" textbox opens but i want to open textbox when mouse on the sign i tried something but din't work.
 

Attachments

Rob

Member
(sorry for my bad English) Hello , i just made a working textbox , when my charracter close to sign and press "space" textbox opens but i want to open textbox when mouse on the sign i tried something but din't work.
I think the problem is you're checking for only a single pixel collision.

You have 2 variables for the mouse coordinates, and check to see if "mouse_x == the sign_x" and the "mouse_y == the sign_y" when what you want to say is:

"Is the mouse colliding with any part of the sign?";

So you can do this instead:

GML:
if (position_meeting(mouse_x, mouse_y, id) == true){
   //The mouse is colliding with this object
}

I think that should work!
 
If your sign is an actual Game Maker object, you can use the "mouse enter" and "mouse leave" events for just that!
Although checking in the step event is a valid solution as it would work, you don't really have to do that check in the step event
 
  • Like
Reactions: Rob
Top