objects/oButtonHighscore/step.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.
oButtonHighscore's step event, 33 lines of GML.
if (collision_rectangle(x+2, y+11, x+13, y+15, oSolid, 0, 0)){ if (not pushed) { counter = 20; playSound(global.sndClick); } pushed = true;}else pushed = false;if (pushed){ if (counter > 0) counter -= 1; if (counter == 1) { scrResetHighscores(); global.shake = 60; playSound(global.sndThump); } with oTrophy { instance_destroy(); } with oXSun { instance_destroy(); } with oXMoon { instance_destroy(); } with oXStars { instance_destroy(); } with oXChange { instance_destroy(); } sprite_index = sButtonPushed; oHighscores.tMoney = 0; oHighscores.tTime = 0; oHighscores.tKills = 0; oHighscores.tSaves = 0;}else sprite_index = sButton;