Skip to content

Instantly share code, notes, and snippets.

@PoppyWorks
Last active August 22, 2018 18:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PoppyWorks/9e9179f95b4d37a7c36aa5662b72fa82 to your computer and use it in GitHub Desktop.
Save PoppyWorks/9e9179f95b4d37a7c36aa5662b72fa82 to your computer and use it in GitHub Desktop.
GML Script. Should be run on an object that you wish to have the player click. Create an obj_cursor for console users and move it around via the gamepad to have this script work for both gamepad. mouse, and touchscreen users.
///button_ui_held(device number, button)
var me = id;
return position_meeting(mouse_x,mouse_y,me) && mouse_check_button(mb_left) || place_meeting(x,y,obj_cursor) && gamepad_button_check(argument0,argument1)
///button_ui_pressed(device number, button)
var me = id;
return position_meeting(mouse_x,mouse_y,me) && mouse_check_button_pressed(mb_left) || place_meeting(x,y,obj_cursor) && gamepad_button_check_pressed(argument0,argument1)
///button_ui_released(device number, button)
var me = id;
return position_meeting(mouse_x,mouse_y,me) && mouse_check_button_released(mb_left) || place_meeting(x,y,obj_cursor) && gamepad_button_check_released(argument0,argument1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment