R
RealsLife
Guest
So I tried asking this yesterday but maybe I wasn't efficiënt in explaining it.
This is what I want to achieve (please don't look at the if condition because it doesn't matter
What the code looks like and doesn't work:
How the script will be triggered:
Both key and gamepad_key trigger different if statemens and switch cases... I also don't want the script to be written twice like in the first example I just want 1piece of code where I can change the KEY_KIND into KEY or GAMEPAD_KEY.
I hope someone can help me with it.
Code:
///scr_rectangle_position(key_kind,position);
position = argument1;
if(mouse_check_button_pressed(mb_left) && point_in_rectangle(mouse_x,mouse_y,x_pos+first_line-(button_size/2),y_pos*position-(button_size/2),x_pos+first_line+(button_size/2),y_pos*position+(button_size/2)))
{
key = position;
inside_region = true;
}
if(mouse_check_button_pressed(mb_left) && point_in_rectangle(mouse_x,mouse_y,x_pos+first_line-(button_size/2),y_pos*position-(button_size/2),x_pos+first_line+(button_size/2),y_pos*position+(button_size/2)))
{
gamepad_key = position;
inside_region = true;
}
What the code looks like and doesn't work:
Code:
///scr_rectangle_position(key_kind,position);
key_kind = argument0;
position = argument1;
if(mouse_check_button_pressed(mb_left) && point_in_rectangle(mouse_x,mouse_y,x_pos+first_line-(button_size/2),y_pos*position-(button_size/2),x_pos+first_line+(button_size/2),y_pos*position+(button_size/2)))
{
key_kind = position;
inside_region = true;
}
Both key and gamepad_key trigger different if statemens and switch cases... I also don't want the script to be written twice like in the first example I just want 1piece of code where I can change the KEY_KIND into KEY or GAMEPAD_KEY.
I hope someone can help me with it.