SpelunkyFan wiki

objects/oLoadLevel/keypress_anykey.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.

oLoadLevel's keypress anykey event, 25 lines of GML.

if (status == GET_FILE_NAME){    if (keyboard_key == vk_escape)    {        global.gameStart = false;        global.titleStart = 2;        room_goto(rTitle);    }    else if (keyboard_key == vk_enter)    {        global.firstCustomLevel = levelName;        scrLoadLevel();    }    else if (keyboard_key == vk_backspace or keyboard_key == vk_delete)    {        //levelName += "DEL";        levelName = string_delete(levelName, string_length(levelName), 1);        with oMenuSel { sprite_index = sMenuSelOff; }    }    else    {        levelName += scrGetChar(keyboard_key);        with oMenuSel { sprite_index = sMenuSelOff; }    }}