Skip to content

StageAPI

Meowlala edited this page Jul 1, 2017 · 6 revisions

StageAPI

This is the global variable that allows you to execute StageAPI functions.

Functions

GetStageConfig

StageObject StageAPI.GetStageConfig(name, rooms, bossRooms, isMultiStage)

Gets the StageObject for a new floor. If isMultiStage is true then the floor will have a stage 1 and a stage 2.

SetNextStage

StageAPI.SetNextStage(StageObject)

Next time Isaac travels through a trapdoor, they shall be sent to the specified stage.

ClearRoomLayout

StageAPI.ClearRoomLayout()

Clears the room of all entities and grid entities. Called automatically when entering a boss room, before ChangeRoomLayout is called to add entities and grid entities.

ChangeRoomLayout

entsSpawned, gridsSpawned StageAPI.ChangeRoomLayout(roomFile, Type)

Selects a random room from roomFile. If Type is specified, rooms selected are restricted to Type.

ChangeBackdrop

StageAPI.ChangeBackdrop(backdropData, backdropANM2)

backdropData is arranged as such:

{
    { -- Variant 1
        NFLOORS = {
            "nfloor1.png"
        },
        LFLOORS = {
            "lfloor1.png"
        },
        CORNERS = {
            "corner1.png"
        },
        WALLS = {
            "wall1_1.png",
            "wall1_2.png"
        }
    },
    { -- Variant 2
        NFLOORS = {
            "nfloor2.png"
        },
        LFLOORS = {
            "lfloor2.png"
        },
        CORNERS = {
            "corner2.png"
        },
        WALLS = {
            "wall2_1.png",
            "wall2_2.png"
        }
    }
}

BOSS = {} can also be specified, for special boss room walls. Variants and backdrops with multiple file names are chosen between with seeded randomization.

GetCurrentBackdrop

Sprite StageAPI.GetCurrentBackdrop()

Gets the current backdrop sprite. May not work.

ChangeDoors

StageAPI.ChangeDoors(DoorFileName, sprite)

sprite is an optional override. Changes door spritesheet out for specified file name.

ChangePits

StageAPI.ChangePits(PitFileName, BridgeFileName, sprite)

sprite is an optional override. Changes pit spritesheet out for specified file name.

ChangeRocks

StageAPI.ChangeRocks(RockFileName, sprite)

sprite is an optional override. Changes rock spritesheet out for specified file name.

ChangeGridEnts

StageAPI.ChangeGridEnts(rockFileName, pitFileName, decoData, pitSpriteOverride, rockSpriteOverride, decoSpriteOverride)

All are optional. Changes grid entity spritesheets out for specified file name.

AddOverlay

OverlayObject StageAPI.AddOverlay(anm2, velocity, offset, position)

All but anm2 are optional. Returns an OverlayObject that can be used to render overlays, and moves / renders based on velocity, offset, and position.

GetStagesCount

number StageAPI.GetStagesCount()

Returns number of stages.

PlayBossIntro

StageAPI.PlayBossIntro(portrait, name, bossspot)

Plays a boss intro. Will only work well if another boss intro is already playing.

GetCurrentStage

StageObject StageAPI.GetCurrentStage()

Returns current stage.

InNewStage

boolean StageAPI.InNewStage()

Returns true if the player is in catacombs or a new stage.