scripts/platformCharacterIs.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 platformCharacterIs, 21 lines of GML.
/*Returns whether a GENERAL trait about a character is true.Only the platform character should run this script. argument0 can be one of the following:ON_GROUNDIN_AIRON_LADDERExample of usage:Event: oCharacter collides with oGoombaAction: if platformCharacterIs(ON_GROUND) instance_destroy()*/if (argument0=ON_GROUND) and (state=RUNNING or state=STANDING or state=DUCKING or state=LOOKING_UP) return 1if (argument0=IN_AIR) and (state=JUMPING or state=FALLING) return 1if (argument0=ON_LADDER) and (state=CLIMBING) return 1return 0