Skip to content

Instantly share code, notes, and snippets.

@PoppyWorks
Last active Aug 22, 2018
Embed
What would you like to do?
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