SpelunkyFan wiki

scripts/checkJoyButton.gml

From spelunky.gmk, Spelunky Classic 1.1's source, © 2008, 2009 Derek Yu and Mossmouth, LLC, shown whole under the Spelunky User License v1.1b. Extracted by spelunky.ai's tools, an unofficial fan project, one file per script or event; the // ==== lines are the extractor's, naming each action of the event. Some scripts are others' work that Derek Yu credits in the source's readme.txt: Martin Piecyk's platform engine, ChevyRay's view scaling scripts and tsg1zzn's Super Sound System.

The script checkJoyButton, 23 lines of GML.

if (joystick_check_button(joyid,1)) return 1;else if (joystick_check_button(joyid,2)) return 2;else if (joystick_check_button(joyid,3)) return 3;else if (joystick_check_button(joyid,4)) return 4;else if (joystick_check_button(joyid,5)) return 5;else if (joystick_check_button(joyid,6)) return 6;else if (joystick_check_button(joyid,7)) return 7;else if (joystick_check_button(joyid,8)) return 8;else if (joystick_check_button(joyid,9)) return 9;else if (joystick_check_button(joyid,10)) return 10;else if (joystick_check_button(joyid,11)) return 11;else if (joystick_check_button(joyid,12)) return 12;else if (joystick_check_button(joyid,13)) return 13;else if (joystick_check_button(joyid,14)) return 14;else if (joystick_check_button(joyid,15)) return 15;else if (joystick_check_button(joyid,16)) return 16;else if (joystick_check_button(joyid,17)) return 17;else if (joystick_check_button(joyid,18)) return 18;else if (joystick_check_button(joyid,19)) return 19;else if (joystick_check_button(joyid,20)) return 20;else if (joystick_zpos(joyid) > 0.1) return -1; // 360 Left Triggerelse if (joystick_zpos(joyid) < -0.1) return -2; // 360 Right Triggerelse return 0;