• 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 Clickable button

E

Expy

Guest
Hello I'am a newbie in a world of programing and I have a question - Is there a easyer way to create a clickable button in gm ?
if (mouse_x > 432)
{
if (mouse_y > 243)
{
if (mouse_x < 592)
{
if (mouse_y < 333)
{
if (mouse_check_button_pressed (mb_left))
{
script_execute (scr_start);
}
}
}
}
}
 
A

amusudan

Guest
if(mouse_x > bbox_left && mouse_x < bbox_right && mouse_y > bbox_top && mouse_y < bbox_bottom)
{
if (mouse_check_button_pressed (mb_left))
{
script_execute (scr_start);
}
}
 
W

Wraithious

Guest
If you have an object that you use for the cursor like this:
Code:
//create event:
window_set_cursor(cr_cross);
//or use your own sprite: window_set_cursor(cr_none);cursor_sprite=spr_pen;

//step event:
x=mouse_x;y=mouse_y;
you can just put in the mouse pressed event:
Code:
if (place_meeting(x,y,button_object))
{
script_execute (scr_start);
}
 
Top