S
skaiiwalker
Guest
I'm going to have a lot of text based menus in the game I'm making, and I'm trying to make it so that when I mouse over clickable text it highlights in a different color. I have an object that draws text to the screen and is supposed to highlight when you mouse over it. I also have another object that builds an array of text objects and maps them to the screen.
This is the interesting part: For some reason, right now, when I mouse over a piece of text, it highlights the next piece of text.
So, for example, I mouse over "Play game", and it highlights "Settings". I mouse over "Settings", and it highlights "Quit". I don't know why.
Here's the code for my text objects:
Create Event:
Draw Event:
Here's the code for my builder object:
Create Event:
Any help would be appreciated!
This is the interesting part: For some reason, right now, when I mouse over a piece of text, it highlights the next piece of text.
So, for example, I mouse over "Play game", and it highlights "Settings". I mouse over "Settings", and it highlights "Quit". I don't know why.
Here's the code for my text objects:
Create Event:
GML:
optionText = "click me";
GML:
draw_set_font(fnt_menus);
draw_text(x, y, optionText);
if point_in_rectangle(mouse_x, mouse_y, x, y, x + string_width(optionText), y + string_height(optionText))
draw_set_color(c_red);
else
draw_set_color(c_white);
Create Event:
GML:
menuOptions = 3;
for (var i = menuOptions - 1; i >= 0; i--)
{
menuOptions[i] = instance_create_layer(x, y + (i * 50), "layer_menu", obj_menuOption);
}
menuOptions[0].optionText = "Play game";
menuOptions[1].optionText = "Settings";
menuOptions[2].optionText = "Quit";