D
Diveyoc
Guest
Please help if you can offer some advice.
I can't figure out a way to do this. Maybe using the (switch) command ??
The display_mouse_get commands work fine, I tested them with some hover code. So there's no issue in using the point_in_rectangle code.
I have 4 buttons in total. Each button has an index of 0 (gray) and 1 (green).
All buttons could start off gray and only turn green if Mouse Left clicked.
However, I only want 1 button green at any time because I need to write code for this on/off action.
Therefore, if 1 button is on, the other 3 need to be off.
I need it so that later I can write other commands like:
if tier1_button = 1
{
// Code //
}
I can't figure out a way to do this. Maybe using the (switch) command ??
The display_mouse_get commands work fine, I tested them with some hover code. So there's no issue in using the point_in_rectangle code.
I have 4 buttons in total. Each button has an index of 0 (gray) and 1 (green).
All buttons could start off gray and only turn green if Mouse Left clicked.
However, I only want 1 button green at any time because I need to write code for this on/off action.
Therefore, if 1 button is on, the other 3 need to be off.
I need it so that later I can write other commands like:
if tier1_button = 1
{
// Code //
}
Code:
//==== TIER BUTTON CONTROL ====\\
tier1_button = 0; // 0 is OFF
tier2_button = 0; // 0 is OFF
draw_sprite(spr_tier1_button,0,1412,12);
if point_in_rectangle(display_mouse_get_x(), display_mouse_get_y(),1404,32,1473,60)
&& mouse_check_button_pressed(mb_left)
{
draw_sprite(spr_tier1_button,1,1412,12);
tier1_button = 1;
}
draw_sprite(spr_tier2_button,0,1500,12);
if point_in_rectangle(display_mouse_get_x(), display_mouse_get_y(),1492,32,1560,60)
&& mouse_check_button_pressed(mb_left)
{
draw_sprite(spr_tier2_button,1,1500,12);
tier2_button = 1;
}