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

Legacy GM Help with selecting buttons freezing

S

Seerfree

Guest
EDIT: NEVER MIND, I fixed it myself, sorry for the trouble!

Sorry for the vague title, but I wasn't sure how to phrase my issue. So, what I'm trying to do is create a menu system with a bar at the top with buttons, and when you press them it switches to the correct page and a highlight box appears over the button you're on. I have it set up so you can select them using point_in_rectangle and checking for the mouse keys, and I have the spacing set up right, but whenever I click on one of the buttons, it gets stuck on it; so, when I try clicking on the other ones it doesn't switch.
Here's my code:
Step event:
Code:
/// Pick Window
// Inventory
if (point_in_rectangle(mouse_x, mouse_y, 4, 4*scale, 48 , 49*scale)
and mouse_check_button_pressed(mb_left)) {

show_inventory = true;
show_villagers = false;
show_animals = false;
show_stats = false;
show_skills = false;
show_options = false;

}
// Villagers
if (point_in_rectangle(mouse_x, mouse_y, 50, 4*scale, 95 , 49*scale)
and mouse_check_button_pressed(mb_left)) {

show_villagers = true;
show_animals = false;
show_stats = false;
show_skills = false;
show_options = false;
show_inventory = false;

}
// Animals
if (point_in_rectangle(mouse_x, mouse_y, 96, 4*scale, 141 , 49*scale)
and mouse_check_button_pressed(mb_left)) {

show_villagers = false;
show_animals = true;
show_stats = false;
show_skills = false;
show_options = false;
show_inventory = false;

}
// Stats
if (point_in_rectangle(mouse_x, mouse_y, 142, 4*scale, 187 , 49*scale)
and mouse_check_button_pressed(mb_left)) {

show_villagers = false;
show_animals = false;
show_stats = true;
show_skills = false;
show_options = false;
show_inventory = false;

}
// Skills
if (point_in_rectangle(mouse_x, mouse_y, 188, 4*scale, 233 , 49*scale)
and mouse_check_button_pressed(mb_left)) {

show_villagers = false;
show_animals = false;
show_stats = false;
show_skills = true;
show_options = false;
show_inventory = false;

}
// Options
if (point_in_rectangle(mouse_x, mouse_y, 234, 4*scale, 279 , 49*scale)
and mouse_check_button_pressed(mb_left)) {

show_villagers = false;
show_animals = false;
show_stats = false;
show_skills = false;
show_options = true;
show_inventory = false;

}
Draw GUI:
Code:
//===================================
// Draw Highlights
//===================================
if (show_inventory == true) {
        draw_sprite_ext(spr_Menu_Button_Highlight, 0, 3*scale, 3*scale, scale, scale, 0, c_white, 1);
}
if (show_villagers == true) {
        draw_sprite_ext(spr_Menu_Button_Highlight, 0, 50*scale, 3*scale, scale, scale, 0, c_white, 1);
}
if (show_animals == true) {
        draw_sprite_ext(spr_Menu_Button_Highlight, 0, 97*scale, 3*scale, scale, scale, 0, c_white, 1);
}
if (show_stats == true) {
        draw_sprite_ext(spr_Menu_Button_Highlight, 0, 144*scale, 3*scale, scale, scale, 0, c_white, 1);
}
if (show_skills == true) {
        draw_sprite_ext(spr_Menu_Button_Highlight, 0, 191*scale, 3*scale, scale, scale, 0, c_white, 1);
}
if (show_options == true) {
        draw_sprite_ext(spr_Menu_Button_Highlight, 0, 238*scale, 3*scale, scale, scale, 0, c_white, 1);
}
Can anyone tell what's the issue here? Thanks for any help :)
 
Last edited by a moderator:
Top