Turkish Coffee
Member
Hey,
I'm trying to get buttons with the code below but it doesn't work, I really can't see what is the problem.
Draw Event
Step Event
I've checked if theres something special about the function in manual but no..
I'm trying to get buttons with the code below but it doesn't work, I really can't see what is the problem.
Draw Event
Code:
draw_rectangle(x-sprite_width/2,y,x+sprite_width/2,y-sprite_height,true);
if (drawTheShop == true)
{
//code here...
}
draw_circle(mouse_x,mouse_y,6,true);
Code:
if (point_in_rectangle(mouse_x,mouse_y,x-sprite_width/2,y,x+sprite_width/2,y-sprite_height))
{
if (mouse_check_button_pressed(mb_left))
{
drawTheShop = true;
image_index++;
if (FoundryLevel < 3)
{
FoundryLevel++;
} else {FoundryLevel = 1;}
}
}
I've checked if theres something special about the function in manual but no..
When using this function, you define a rectangular area and GameMaker Studio 2 will work out whether the given point falls within its bounds or not. If the point falls within the defined rectangle the function will return true otherwise the function will return false.