Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// @description gamepad_assign();
- show_debug_message("Event = " + async_load[? "event_type"]); // Debug code so you can see which event has been
- show_debug_message("Pad = " + string(async_load[? "pad_index"])); // triggered and the pad associated with it.
- switch(async_load[? "event_type"]) // Parse the async_load map to see which event has been triggered
- {
- case "gamepad discovered": // A game pad has been discovered
- var pad = async_load[? "pad_index"]; // Get the pad index value from the async_load map
- if global.PadIndex == -4
- {
- gamepad_set_axis_deadzone(pad, 0.6); // Set the "deadzone" for the axis
- gamepad_set_button_threshold(pad, 0.1); // Set the "threshold" for the triggers
- global.PadIndex = pad;
- show_debug_message("Pad assigned to Player: " + string(global.PadIndex));
- }
- break;
- case "gamepad lost": // Gamepad has been removed or otherwise disabled
- var pad = async_load[? "pad_index"]; // Get the pad index
- show_debug_message("Pad lost for Player: " + string(pad));
- global.PadIndex = -4;
- break;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement