objects/oGoldIdol/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.
oGoldIdol's step event, 34 lines of GML.
// ==== action 0: lib 1 id 604: action_inherited() ====// ==== action 1: lib 1 id 603: code ====if ((x > view_xview[0]-8 and x < view_xview[0] + view_wview[0]+8 and y > view_yview[0]-8 and y < view_yview[0] + view_hview[0]+8)){// get money for idols at shopsif (isLevel()){ if (not held and collision_point(x, y+4, oBrickSmooth, 0, 0) and instance_exists(oShopkeeper) and global.thiefLevel == 0 and not global.murderer) { if (oShopkeeper.status == 0 and abs(x - oShopkeeper.x) < 80) { global.collect += value*(global.levelType+1); global.collectCounter += 20; if (global.collectCounter > 100) global.collectCounter = 100; global.idols += 1; playSound(global.sndCoin); instance_create(x, y-8, oBigCollect); global.message = "PLEASURE DOING BUSINESS!"; global.message2 = ""; global.messageTimer = 100; instance_destroy(); } }}if (not colBot and trigger){ trigger = false; global.idolsGrabbed += 1;}}