Mr Errorz
Member
working on a mobile project, I want a certain button to function if pressed by mouse_0 or mouse_1,
I wrote this piece of code, but there must be a better way of writing it without repeating it twice like I did.
help?
if point_in_rectangle(device_mouse_x(0),device_mouse_y(0),bbox_left,bbox_top,bbox_right,bbox_bottom)
{
if device_mouse_check_button_pressed(0,mb_left)
{
with oPlayer
{
// DO STUFF
}
}
}
else
if point_in_rectangle(device_mouse_x(1),device_mouse_y(1),bbox_left,bbox_top,bbox_right,bbox_bottom)
{
if device_mouse_check_button_pressed(1,mb_left)
{
with oPlayer
{
// DO STUFF
}
}
}
I wrote this piece of code, but there must be a better way of writing it without repeating it twice like I did.
help?
if point_in_rectangle(device_mouse_x(0),device_mouse_y(0),bbox_left,bbox_top,bbox_right,bbox_bottom)
{
if device_mouse_check_button_pressed(0,mb_left)
{
with oPlayer
{
// DO STUFF
}
}
}
else
if point_in_rectangle(device_mouse_x(1),device_mouse_y(1),bbox_left,bbox_top,bbox_right,bbox_bottom)
{
if device_mouse_check_button_pressed(1,mb_left)
{
with oPlayer
{
// DO STUFF
}
}
}