Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /// @description  gamepad_assign();
  2.  
  3. show_debug_message("Event = " + async_load[? "event_type"]);        // Debug code so you can see which event has been
  4. show_debug_message("Pad = " + string(async_load[? "pad_index"]));   // triggered and the pad associated with it.
  5.  
  6. switch(async_load[? "event_type"])             // Parse the async_load map to see which event has been triggered
  7. {
  8. case "gamepad discovered":                     // A game pad has been discovered
  9.     var pad = async_load[? "pad_index"];       // Get the pad index value from the async_load map
  10.     if global.PadIndex == -4
  11.         {
  12.         gamepad_set_axis_deadzone(pad, 0.6);       // Set the "deadzone" for the axis
  13.         gamepad_set_button_threshold(pad, 0.1);    // Set the "threshold" for the triggers
  14.         global.PadIndex = pad;
  15.         show_debug_message("Pad assigned to Player: " + string(global.PadIndex));
  16.         }
  17.     break;
  18. case "gamepad lost":                           // Gamepad has been removed or otherwise disabled
  19.     var pad = async_load[? "pad_index"];       // Get the pad index
  20.     show_debug_message("Pad lost for Player: " + string(pad));
  21.     global.PadIndex = -4;
  22.     break;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement