Skip to content

Class "GridEntity"⚓︎

Info

You can get this class by using the following function:

Example Code

Game():GetRoom():GetGridEntity(25)

Class Diagram⚓︎

    classDiagram
    class GridEntity:::diagramCurrentPage
    class GridEntityDoor
    class GridEntityPit
    class GridEntityPoop
    class GridEntityPressurePlate
    class GridEntityRock
    class GridEntitySpikes
    class GridEntityTNT
    GridEntity <|-- GridEntityDoor
    GridEntity <|-- GridEntityPit
    GridEntity <|-- GridEntityPoop
    GridEntity <|-- GridEntityPressurePlate
    GridEntity <|-- GridEntityRock
    GridEntity <|-- GridEntitySpikes
    GridEntity <|-- GridEntityTNT
    link GridEntity "GridEntity.html" "Go to page for 'GridEntity' class"
    link GridEntityDoor "GridEntityDoor.html" "Go to page for 'GridEntityDoor' class"
    link GridEntityPit "GridEntityPit.html" "Go to page for 'GridEntityPit' class"
    link GridEntityPoop "GridEntityPoop.html" "Go to page for 'GridEntityPoop' class"
    link GridEntityPressurePlate "GridEntityPressurePlate.html" "Go to page for 'GridEntityPressurePlate' class"
    link GridEntityRock "GridEntityRock.html" "Go to page for 'GridEntityRock' class"
    link GridEntitySpikes "GridEntitySpikes.html" "Go to page for 'GridEntitySpikes' class"
    link GridEntityTNT "GridEntityTNT.html" "Go to page for 'GridEntityTNT' class"

Functions⚓︎

Destroy ()⚓︎

boolean Destroy ( boolean Immediate )⚓︎


Get·Grid·Index ()⚓︎

int GetGridIndex ( )⚓︎


Get·RNG ()⚓︎

RNG GetRNG ( )⚓︎

Warning

This RNG is initialized with the same seed for all grid entities in the whole run. Instead, it's advised to create a custom data structure or use either the SpawnSeed or VariableSeed fields from the GridEntityDesc object.


Get·Save·State ()⚓︎

GridEntityDesc GetSaveState ( )⚓︎

Info

Both the Desc property and the GetSaveState() method return the exact same GridEntityDesc object. The game devs advise to use GetSaveState() instead of Desc.


Get·Sprite ()⚓︎

Sprite GetSprite ( )⚓︎


Get·Type ()⚓︎

GridEntityType GetType ( )⚓︎


Get·Variant ()⚓︎

int GetVariant ( )⚓︎


Hurt ()⚓︎

boolean Hurt ( int Damage )⚓︎


Init ()⚓︎

void Init ( int Seed )⚓︎


Post·Init ()⚓︎

void PostInit ( )⚓︎


Render ()⚓︎

void Render ( Vector Offset )⚓︎


Set·Type ()⚓︎

void SetType ( GridEntityType Type )⚓︎


Set·Variant ()⚓︎

void SetVariant ( int Variant )⚓︎


To·Door ()⚓︎

GridEntityDoor ToDoor ( )⚓︎

Return behavior

If the conversion is not successful, this function returns nil.


To·Pit ()⚓︎

GridEntityPit ToPit ( )⚓︎

Return behavior

If the conversion is not successful, this function returns nil.


To·Poop ()⚓︎

GridEntityPoop ToPoop ( )⚓︎

Return behavior

If the conversion is not successful, this function returns nil.


To·Pressure·Plate ()⚓︎

GridEntityPressurePlate ToPressurePlate ( )⚓︎

Return behavior

If the conversion is not successful, this function returns nil.


To·Rock ()⚓︎

GridEntityRock ToRock ( )⚓︎

Return behavior

If the conversion is not successful, this function returns nil.


To·Spikes ()⚓︎

GridEntitySpikes ToSpikes ( )⚓︎

Return behavior

If the conversion is not successful, this function returns nil.


To·TNT ()⚓︎

GridEntityTNT ToTNT ( )⚓︎

Return behavior

If the conversion is not successful, this function returns nil.


Update ()⚓︎

void Update ( )⚓︎


Variables⚓︎

Collision·Class⚓︎

GridCollisionClass CollisionClass⚓︎


Desc⚓︎

GridEntityDesc Desc⚓︎

Info

Both the Desc property and the GetSaveState() method return the exact same GridEntityDesc object. The game devs advise to use GetSaveState() instead of Desc.


Position⚓︎

const Vector Position⚓︎

Returns the position of the grid cell's center point


State⚓︎

int State⚓︎

Used for various different usecases.

Example States
1
Rocks with state = 2 are destroyed rocks (The rubble is the rock basically)

Var·Data⚓︎

int VarData⚓︎

A Variable that stores some entity-specific data. The content can have completely different effects for different GridEntities.

Example Code

This code spawns a functioning Void Portal into the center of the room. This will teleport you to the floor "The Void" and will have the same appearance as the vanilla portal:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
-- From: https://github.com/IsaacScript/isaac-typescript-definitions/blob/main/typings/unofficial/enumsGridEntityVariants.d.ts
local TrapdoorVariant = {
  NORMAL = 0,
  VOID_PORTAL = 1,
}

local game = Game();
local room = game:GetRoom()
local centerPos = room:GetCenterPos()

-- By default, this will spawn a normal trapdoor, even though we specify the Void Portal variant
local voidPortal = Isaac.GridSpawn(GridEntityType.GRID_TRAPDOOR, TrapdoorVariant.VOID_PORTAL, centerPos, true)

-- Set the destination to The Void and apply the pulse effect shader
voidPortal.VarData = 1

-- Replace the spritesheet to make it look like a Void Portal
local sprite = portalEntity:GetSprite()
sprite:Load("gfx/grid/voidtrapdoor.anm2", true)



Last update: April 26, 2024