Skip to content

Class "GridEntity"⚓︎

Info

You can get this class by using the following function:

Example Code

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

Class Diagram⚓︎

Content Overview

Return valueFunction
booleanDestroy ( boolean Immediate )⚓︎
booleanDestroyWithSource ( boolean Immediate, EntityRef Source )⚓︎
intGetGridIndex ( )⚓︎
RNGGetRNG ( )⚓︎
GridEntityDescGetSaveState ( )⚓︎
SpriteGetSprite ( )⚓︎
GridEntityTypeGetType ( )⚓︎
intGetVariant ( )⚓︎
booleanHurt ( int Damage )⚓︎
booleanHurtWithSource ( int Damage, EntityRef Source )⚓︎
voidInit ( int Seed )⚓︎
voidPostInit ( )⚓︎
voidRender ( Vector Offset )⚓︎
voidSetType ( GridEntityType Type )⚓︎
voidSetVariant ( int Variant )⚓︎
GridEntityDoorToDoor ( )⚓︎
GridEntityPitToPit ( )⚓︎
GridEntityPoopToPoop ( )⚓︎
GridEntityPressurePlateToPressurePlate ( )⚓︎
GridEntityRockToRock ( )⚓︎
GridEntitySpikesToSpikes ( )⚓︎
GridEntityTNTToTNT ( )⚓︎
voidUpdate ( )⚓︎
GridCollisionClassCollisionClass⚓︎
GridEntityDescDesc⚓︎
const VectorPosition⚓︎
intState⚓︎
intVarData⚓︎

Functions⚓︎

Destroy ()⚓︎

boolean Destroy ( boolean Immediate )⚓︎


DestroyWithSource ()⚓︎

boolean DestroyWithSource ( boolean Immediate, EntityRef Source )⚓︎


GetGridIndex ()⚓︎

int GetGridIndex ( )⚓︎


GetRNG ()⚓︎

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.


GetSaveState ()⚓︎

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.


GetSprite ()⚓︎

Sprite GetSprite ( )⚓︎


GetType ()⚓︎

GridEntityType GetType ( )⚓︎


GetVariant ()⚓︎

int GetVariant ( )⚓︎


Hurt ()⚓︎

boolean Hurt ( int Damage )⚓︎


HurtWithSource ()⚓︎

boolean HurtWithSource ( int Damage, EntityRef Source )⚓︎


Init ()⚓︎

void Init ( int Seed )⚓︎


PostInit ()⚓︎

void PostInit ( )⚓︎


Render ()⚓︎

void Render ( Vector Offset )⚓︎


SetType ()⚓︎

void SetType ( GridEntityType Type )⚓︎


SetVariant ()⚓︎

void SetVariant ( int Variant )⚓︎


ToDoor ()⚓︎

GridEntityDoor ToDoor ( )⚓︎

Return behavior

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


ToPit ()⚓︎

GridEntityPit ToPit ( )⚓︎

Return behavior

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


ToPoop ()⚓︎

GridEntityPoop ToPoop ( )⚓︎

Return behavior

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


ToPressurePlate ()⚓︎

GridEntityPressurePlate ToPressurePlate ( )⚓︎

Return behavior

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


ToRock ()⚓︎

GridEntityRock ToRock ( )⚓︎

Return behavior

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


ToSpikes ()⚓︎

GridEntitySpikes ToSpikes ( )⚓︎

Return behavior

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


ToTNT ()⚓︎

GridEntityTNT ToTNT ( )⚓︎

Return behavior

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


Update ()⚓︎

void Update ( )⚓︎


Variables⚓︎

CollisionClass⚓︎

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)

VarData⚓︎

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: March 20, 2025