SpelunkyFan wiki

objects/oBoulder/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.

oBoulder's step event, 88 lines of GML.

// ==== action 0: lib 1 id 604: action_inherited() ====// ==== action 1: lib 1 id 603: code ====if (true){    colLeft = false;    colRight = false;    moveTo(xVel, yVel)    //x += xVel;    //y += yVel;        if (yVel < 8)    {        yVel += myGrav;    }    if (x-17 <= 16 and xVel < 0)    {        x += 1;        xVel = -xVel;    }        if (x+17 >= 656 and xVel > 0)    {        x -= 1;        xVel = -xVel;    }        if (isCollisionTop(1) and yVel < 0)    {        yVel = -yVel * 0.8;    }        if (isCollisionBottom(1))    {        // bounce        if (yVel > 3) yVel = -yVel * 0.3;        else yVel = 0;                // friction        if (abs(xVel) != 0) xVel *= 0.99;                if (not bounced and xVel == 0)        {            if (oPlayer1.x < x)            {                xVel = -4.5;            }            else            {                xVel = 4.5;            }            bounced = true;        }                if (abs(xVel) < 0.5) xVel = 0;    }        if (not collision_point(x, y+16, oSolid, 0, 0))    {        colLeft = collision_rectangle(x-16, y-16, x-8, y+16, oSolid, false, true);        colRight = collision_rectangle(x+8, y-16, x+16, y+16, oSolid, false, true);        if (colLeft and not colRight) x += 1;        else if (colRight and not colLeft) x -= 1;    }        image_speed = abs(xVel) / 5;        if (xVel < 0)    {        sprite_index = sBoulderRotateL;    }    else if (xVel > 0)    {        sprite_index = sBoulderRotateR;    }    else    {        sprite_index = sBoulder;    }    /*    if (xVel == 0 and yVel == 0)    {        instance_create(x, y, oBoulderStatic);        instance_destroy();    }    */}