GM: Mouse Enter and Leave events

From GMpedia.org Wiki

Jump to: navigation, search

[edit] Mouse Enter Event

This event occurs only when the mouse collides with an object (when the mouse is over it). This object needs to have a sprite to be able to collide with the mouse.

[edit] Mouse Leave Event

This event occurs only when the mouse stops collision with an object (when the mouse is no longer over it).

Example:

You have a button object that needs to change its sprite when the mouse is over it. Then you can use the following code:

Mouse Enter event:

sprite_index=spr_highlighted;

Mouse Leave event:

sprite_index=spr_normal;

[edit] See Also

Personal tools