flyinian
Member
Out of curiosity, Is there a better way of doing this?
This is for a mouse hover highlight for a button.
I was trying to get my navigation system for my game to not execute the button highlighting per step.
This took me awhile to figure this out, a different version of this was executing the code per step. Didn't realize it until I added a debug message for testing.
Thank You.
This is for a mouse hover highlight for a button.
I was trying to get my navigation system for my game to not execute the button highlighting per step.
This took me awhile to figure this out, a different version of this was executing the code per step. Didn't realize it until I added a debug message for testing.
GML:
_SpriteBackgroundSubImage = 0: // no highlight
_SpriteBackgroundSubImage = 1: // highlight
if (position_meeting(mouse_x, mouse_y, _Object) && _SpriteBackgroundSubImage == 0) // If mouse is over menu button and isn't highlighted
{
_SpriteBackgroundSubImage = 1; // Sprite's border will be highlighted on mouse hover
show_debug_message("Menu Type 2 Button Mouse Over Highlight");
};
if (!position_meeting(mouse_x, mouse_y, _Object) && _SpriteBackgroundSubImage == 1) // If mouse is over menu button and is highlighted
{
_SpriteBackgroundSubImage = 0; // Sprite's border will not be highlighted on mouse hover
show_debug_message("Menu Type 2 Button Mouse Over no Highlight");
};