Class "Entity"

Functions

AddBurn () {: aria-label='Functions' }

{: .abp .tooltip .badge }

void AddBurn ( EntityRef Source, int Duration, float Damage ) {: .copyable aria-label='Functions' }

Adds a burn-effect to an enemy. Duration is in Number of Frames. Damage is the Damage taken per frame.

???- example "Example Code" This code damages every entity in the room for 1 second with the damagesource set to the player. The total damage dealt is 30.

    local player =Isaac.GetPlayer(0)
    for i, entity in ipairs(Isaac.GetRoomEntities()) do
        entity:AddBurn(player,30,1)
    end

AddCharmed () {: aria-label='Functions' }

{: .abp .tooltip .badge }

void AddCharmed ( int Duration ) {: .copyable aria-label='Functions' }

Adds a charmed-effect to an enemy. Duration is in Number of Frames. Charmed enemies are friendly towards isaac and attack other enemies.

:::lua AddCharmed(-1) makes the effect permanent and the enemy will follow you even to different rooms.

???- example "Example Code" This code charms every entity in the room for 1 second.

    for i, entity in ipairs(Isaac.GetRoomEntities()) do
        entity:AddCharmed(30)
    end

AddConfusion () {: aria-label='Functions' }

{: .abp .tooltip .badge }

void AddConfusion ( EntityRef Source, int Duration, boolean IgnoreBosses ) {: .copyable aria-label='Functions' }

Adds a confusion effect to an entity.

???- example "Example Code" This code confuses every entity in the room for 1 second while ignoring bosses.

    local player =Isaac.GetPlayer(0) 
    for i, entity in ipairs(Isaac.GetRoomEntities()) do
        entity:AddConfusion(player,30,true)
    end

AddEntityFlags () {: aria-label='Functions' }

{: .abp .tooltip .badge }

void AddEntityFlags ( int Flags ) {: .copyable aria-label='Functions' }

Add EntityFlags to the entity. Flags are used to add specific effects like poisoning or freeze. You can add multiple flags at the same time by bitwise-concatenating them.

???- example "Example Code" This code adds slowing and confusion to the enetity.

    local player =Isaac.GetPlayer(0) 
    for i, entity in ipairs(Isaac.GetRoomEntities()) do
        entity:AddEntityFlags(EntityFlag.FLAG_SLOW | EntityFlag.FLAG_CONFUSION)
    end

AddFear () {: aria-label='Functions' }

{: .abp .tooltip .badge }

void AddFear ( EntityRef Source, int Duration ) {: .copyable aria-label='Functions' }

Adds a fear-effect to an entity.

???- example "Example Code" This code frightens every entity in the room for 1 second.

    local player =Isaac.GetPlayer(0) 
    for i, entity in ipairs(Isaac.GetRoomEntities()) do
        entity:AddFear(player, 30)
    end

AddFreeze () {: aria-label='Functions' }

{: .abp .tooltip .badge }

void AddFreeze ( EntityRef Source, int Duration ) {: .copyable aria-label='Functions' }

Freezes an entity, making it unable to move and attack.

???- example "Example Code" This code freezes every entity in the room for half a second.

    local player =Isaac.GetPlayer(0) 
    for i, entity in ipairs(Isaac.GetRoomEntities()) do
        entity:AddFreeze(player, 30)
    end

AddHealth () {: aria-label='Functions' }

{: .abp .tooltip .badge }

void AddHealth ( float HitPoints ) {: .copyable aria-label='Functions' }

Heals an entity.

AddMidasFreeze () {: aria-label='Functions' }

{: .abp .tooltip .badge }

void AddMidasFreeze ( EntityRef Source, int Duration ) {: .copyable aria-label='Functions' }

Turns the entity into a gold statue (can't move, can't attack, drops coins when killed)

AddPoison () {: aria-label='Functions' }

{: .abp .tooltip .badge }

void AddPoison ( EntityRef Source, int Duration, float Damage ) {: .copyable aria-label='Functions' }

Adds a poison effect to the entity.

AddShrink () {: aria-label='Functions' }

{: .abp .tooltip .badge }

void AddShrink ( EntityRef Source, int Duration ) {: .copyable aria-label='Functions' }

Adds a shrink effect to the entity.

AddSlowing () {: aria-label='Functions' }

{: .abp .tooltip .badge }

void AddSlowing ( EntityRef Source, int Duration, float SlowValue, Color SlowColor ) {: .copyable aria-label='Functions' }

Makes the friction higher.

AddVelocity () {: aria-label='Functions' }

{: .abp .tooltip .badge }

void AddVelocity ( Vector Velocity ) {: .copyable aria-label='Functions' }

Adds velocity to the entity. This can be used to move him in a certain direktion (for example as a result of collision)

BloodExplode () {: aria-label='Functions' }

{: .abp .tooltip .badge }

void BloodExplode ( ) {: .copyable aria-label='Functions' }

Explodes with gibs and blood.

CanShutDoors () {: aria-label='Functions' }

{: .abp .tooltip .badge }

boolean CanShutDoors ( ) {: .copyable aria-label='Functions' }

enemies keep the doors shut.

ClearEntityFlags () {: aria-label='Functions' }

{: .abp .tooltip .badge }

void ClearEntityFlags ( int Flags ) {: .copyable aria-label='Functions' }

Removes all EntityFlags from the entity.

CollidesWithGrid () {: aria-label='Functions' }

{: .abp .tooltip .badge }

boolean CollidesWithGrid ( ) {: .copyable aria-label='Functions' }

Returns true, if the entity is able to collide with the grid.

Die () {: aria-label='Functions' }

{: .abp .tooltip .badge }

void Die ( ) {: .copyable aria-label='Functions' }

Kills the entity and trigger its death animation.

Exists () {: aria-label='Functions' }

{: .abp .tooltip .badge }

boolean Exists ( ) {: .copyable aria-label='Functions' }

Returns true, if this entity still exists.

GetBossID () {: aria-label='Functions' }

{: .abp .tooltip .badge }

BossId GetBossID ( ) {: .copyable aria-label='Functions' }

If the entity is a boss, it returns its specific boss id. If it isnt a boss it will return 0.

GetColor () {: aria-label='Functions' }

{: .abp .tooltip .badge }

Color GetColor ( ) {: .copyable aria-label='Functions' }

Returns the Color object assosiated to this entity.

GetData () {: aria-label='Functions' }

{: .abp .tooltip .badge }

table GetData ( ) {: .copyable aria-label='Functions' }

Returns a table that contains all data assosiated with the entity. This can be used to add custom data as well.

???- note "Notes" Data associated with an entity does only persists in between rooms, when the entity is a player, familiar or the entity has the "EntityFlag.FLAG_PERSISTENT" Flag active. Data does not persists in between exiting the game to a menu, or when restarting/finishing a run.

???- example "Example Code" This code adds custom data to an entity or prints it in the console if it exists.

    if type(entity:GetData()["MyValue"]) == type(nil) then -- checks, if the Data does exist already
    entity:GetData()["MyValue"] = "Cool" -- assign a value to the data
    else 
    print(entity:GetData()["MyValue"])  -- this will print "Cool" in the console
    end

GetDropRNG () {: aria-label='Functions' }

{: .abp .tooltip .badge }

RNG GetDropRNG ( ) {: .copyable aria-label='Functions' }

Returns the assigned RNG object for the entity. This RNG is used to determine the items that are dropped on the entities death.

GetEntityFlags () {: aria-label='Functions' }

{: .abp .tooltip .badge }

int GetEntityFlags ( ) {: .copyable aria-label='Functions' }

Get the EntityFlagsof the entity. This will be a number which acts like a bitmask.

???- example "Example Code" This code prints something in the console, if the entity has a specific EntityFlags.

    if entity:GetEntityFlags() & EntityFlag.FLAG_CONFUSION == EntityFlag.FLAG_CONFUSION then
    print("This entity is confused!")
    end

GetLastChild () {: aria-label='Functions' }

{: .abp .tooltip .badge }

Entity GetLastChild ( ) {: .copyable aria-label='Functions' }

Returns the last entity spawned by this entity.

GetLastParent () {: aria-label='Functions' }

{: .abp .tooltip .badge }

Entity GetLastParent ( ) {: .copyable aria-label='Functions' }

Returns the last parent of this entity.

GetSprite () {: aria-label='Functions' }

{: .abp .tooltip .badge }

Sprite GetSprite ( ) {: .copyable aria-label='Functions' }

Return the sprite object of the entity.

HasCommonParentWithEntity () {: aria-label='Functions' }

{: .abp .tooltip .badge }

boolean HasCommonParentWithEntity ( Entity Other ) {: .copyable aria-label='Functions' }

HasEntityFlags () {: aria-label='Functions' }

{: .abp .tooltip .badge }

boolean HasEntityFlags ( int Flags ) {: .copyable aria-label='Functions' }

Returns true, if the entity has all named EntityFlags set.

???- example "Example Code" This code prints something in the console, if the entity has a specific EntityFlags.

    if entity:HasEntityFlags(EntityFlag.FLAG_CONFUSION) then
    print("This entity is confused!")
    end

HasFullHealth () {: aria-label='Functions' }

{: .abp .tooltip .badge }

boolean HasFullHealth ( ) {: .copyable aria-label='Functions' }

HasMortalDamage () {: aria-label='Functions' }

{: .abp .tooltip .badge }

boolean HasMortalDamage ( ) {: .copyable aria-label='Functions' }

???- note "Notes" The game adds taken damage to a damage buffer, which gets applied in the next frame. HasMortalDamage() returns true if the buffered damage is enough to kill the entity. HasMortalDamage() will be updated additionally after TakeDamage() is called.

IsActiveEnemy () {: aria-label='Functions' }

{: .abp .tooltip .badge }

boolean IsActiveEnemy ( boolean includeDead ) {: .copyable aria-label='Functions' }

return true for non background NPCs (ex: every enemy except fire and shopkeepers)

IsBoss () {: aria-label='Functions' }

{: .abp .tooltip .badge }

boolean IsBoss ( ) {: .copyable aria-label='Functions' }

bosses display health bar

IsDead () {: aria-label='Functions' }

{: .abp .tooltip .badge }

boolean IsDead ( ) {: .copyable aria-label='Functions' }

IsEnemy () {: aria-label='Functions' }

{: .abp .tooltip .badge }

boolean IsEnemy ( ) {: .copyable aria-label='Functions' }

return true for NPCs that are not controlled by the player

IsFlying () {: aria-label='Functions' }

{: .abp .tooltip .badge }

boolean IsFlying ( ) {: .copyable aria-label='Functions' }

IsFrame () {: aria-label='Functions' }

{: .abp .tooltip .badge }

boolean IsFrame ( int Frame, int Offset ) {: .copyable aria-label='Functions' }

true every X frames

IsInvincible () {: aria-label='Functions' }

{: .abp .tooltip .badge }

boolean IsInvincible ( ) {: .copyable aria-label='Functions' }

IsVisible () {: aria-label='Functions' }

{: .abp .tooltip .badge }

boolean IsVisible ( ) {: .copyable aria-label='Functions' }

IsVulnerableEnemy () {: aria-label='Functions' }

{: .abp .tooltip .badge }

boolean IsVulnerableEnemy ( ) {: .copyable aria-label='Functions' }

return true for enemies that can be damaged

Kill () {: aria-label='Functions' }

{: .abp .tooltip .badge }

void Kill ( ) {: .copyable aria-label='Functions' }

Kills the entity and makes a blood splat or gibs.

MultiplyFriction () {: aria-label='Functions' }

{: .abp .tooltip .badge }

void MultiplyFriction ( float Value ) {: .copyable aria-label='Functions' }

PostRender () {: aria-label='Functions' }

{: .abp .tooltip .badge }

void PostRender ( ) {: .copyable aria-label='Functions' }

Remove () {: aria-label='Functions' }

{: .abp .tooltip .badge }

void Remove ( ) {: .copyable aria-label='Functions' }

Remove the entity from the game instantly, without doing any additional effects/animations.

RemoveStatusEffects () {: aria-label='Functions' }

{: .abp .tooltip .badge }

void RemoveStatusEffects ( ) {: .copyable aria-label='Functions' }

Removes all Status Effects from the entity.

Render () {: aria-label='Functions' }

{: .abp .tooltip .badge }

void Render ( Vector Offset ) {: .copyable aria-label='Functions' }

Render the current sprite of the Entity at the current entity position + offset.

RenderShadowLayer () {: aria-label='Functions' }

{: .abp .tooltip .badge }

boolean RenderShadowLayer ( Vector Offset ) {: .copyable aria-label='Functions' }

Render the shadow / shadow layer again.

SetColor () {: aria-label='Functions' }

{: .abp .tooltip .badge }

void SetColor ( Color Color, int Duration, int Priority, boolean Fadeout, boolean Share ) {: .copyable aria-label='Functions' }

Set the colormask for the entity. This can be used to tint the sprites in different colors.

???- example "Example Code" This code changes the color of the sprite to a fully white sprite for 15 frames.

    entity:SetColor(Color(1,1,1,1,255,255,255),15,1,false,false)

SetSize () {: aria-label='Functions' }

{: .abp .tooltip .badge }

void SetSize ( float Size, Vector SizeMulti, int NumGridCollisionPoints ) {: .copyable aria-label='Functions' }

Set the size ofthe entity.

SetSpriteFrame () {: aria-label='Functions' }

{: .abp .tooltip .badge }

void SetSpriteFrame ( string AnimationName, int FrameNum ) {: .copyable aria-label='Functions' }

SetSpriteOverlayFrame () {: aria-label='Functions' }

{: .abp .tooltip .badge }

void SetSpriteOverlayFrame ( string AnimationName, int FrameNum ) {: .copyable aria-label='Functions' }

TakeDamage () {: aria-label='Functions' }

{: .abp .tooltip .badge }

boolean TakeDamage ( float Damage, int Flags, EntityRef Source, int DamageCountdown ) {: .copyable aria-label='Functions' }

???- note "Notes" The game adds taken damage to a damage buffer, which gets applied in the next frame. Therefore, TakeDamage() will not decremented the entities HP immediately upon calling the function. Rather, it is only updated on the frame afterwards.

ToBomb () {: aria-label='Functions' }

{: .abp .tooltip .badge }

EntityBomb ToBomb ( ) {: .copyable aria-label='Functions' }

ToEffect () {: aria-label='Functions' }

{: .abp .tooltip .badge }

EntityEffect ToEffect ( ) {: .copyable aria-label='Functions' }

ToFamiliar () {: aria-label='Functions' }

{: .abp .tooltip .badge }

EntityFamiliar ToFamiliar ( ) {: .copyable aria-label='Functions' }

ToKnife () {: aria-label='Functions' }

{: .abp .tooltip .badge }

EntityKnife ToKnife ( ) {: .copyable aria-label='Functions' }

ToLaser () {: aria-label='Functions' }

{: .abp .tooltip .badge }

EntityLaser ToLaser ( ) {: .copyable aria-label='Functions' }

ToNPC () {: aria-label='Functions' }

{: .abp .tooltip .badge }

EntityNPC ToNPC ( ) {: .copyable aria-label='Functions' }

ToPickup () {: aria-label='Functions' }

{: .abp .tooltip .badge }

EntityPickup ToPickup ( ) {: .copyable aria-label='Functions' }

ToPlayer () {: aria-label='Functions' }

{: .abp .tooltip .badge }

EntityPlayer ToPlayer ( ) {: .copyable aria-label='Functions' }

ToProjectile () {: aria-label='Functions' }

{: .abp .tooltip .badge }

EntityProjectile ToProjectile ( ) {: .copyable aria-label='Functions' }

ToTear () {: aria-label='Functions' }

{: .abp .tooltip .badge }

EntityTear ToTear ( ) {: .copyable aria-label='Functions' }

Update () {: aria-label='Functions' }

{: .abp .tooltip .badge }

void Update ( ) {: .copyable aria-label='Functions' }

Child () {: aria-label='Functions' }

{: .abp .tooltip .badge }

Entity Child {: .copyable aria-label='Functions' }

Variables

CollisionDamage {: aria-label='Variables' }

{: .abp .tooltip .badge }

float CollisionDamage {: .copyable aria-label='Variables' }

DepthOffset {: aria-label='Variables' }

{: .abp .tooltip .badge }

float DepthOffset {: .copyable aria-label='Variables' }

Get/Set the depth-offset of the entity. This value is added to the Y Position of the entity, which is then used to determine the rendering order of each entity. Default value is 0 for all entities.

???- example "Example Code" This code explains how this variable works.

    entity1.Position.Y -- => 50
    entity2.Position.Y -- => 45
    -- Entity1 is rendered in front of Entity2

    entity1.DepthOffset = -10
    -- new Entity1 renderYPosition => 40
    -- Entity2 is rendered in front of Entity1

DropSeed {: aria-label='Variables' }

{: .abp .tooltip .badge }

int DropSeed {: .copyable aria-label='Variables' }

Get/set the Seed of the Drop RNG.

EntityCollisionClass {: aria-label='Variables' }

{: .abp .tooltip .badge }

EntityCollisionClass EntityCollisionClass {: .copyable aria-label='Variables' }

FlipX {: aria-label='Variables' }

{: .abp .tooltip .badge }

boolean FlipX {: .copyable aria-label='Variables' }

FrameCount {: aria-label='Variables' }

{: .abp .tooltip .badge }

int FrameCount {: .copyable aria-label='Variables' }

Friction {: aria-label='Variables' }

{: .abp .tooltip .badge }

float Friction {: .copyable aria-label='Variables' }

loaded from entity config

GridCollisionClass {: aria-label='Variables' }

{: .abp .tooltip .badge }

GridCollisionClass GridCollisionClass {: .copyable aria-label='Variables' }

HitPoints {: aria-label='Variables' }

{: .abp .tooltip .badge }

float HitPoints {: .copyable aria-label='Variables' }

???- note "Notes" The HitPoints value is not decremented immediately upon taking damage like you would expect. Rather, it is only updated on the frame after the entity takes damage.

Index {: aria-label='Variables' }

{: .abp .tooltip .badge }

int Index {: .copyable aria-label='Variables' }

InitSeed {: aria-label='Variables' }

{: .abp .tooltip .badge }

int InitSeed {: .copyable aria-label='Variables' }

Mass {: aria-label='Variables' }

{: .abp .tooltip .badge }

float Mass {: .copyable aria-label='Variables' }

MaxHitPoints {: aria-label='Variables' }

{: .abp .tooltip .badge }

float MaxHitPoints {: .copyable aria-label='Variables' }

Parent {: aria-label='Variables' }

{: .abp .tooltip .badge }

Entity Parent {: .copyable aria-label='Variables' }

Position {: aria-label='Variables' }

{: .abp .tooltip .badge }

Vector Position {: .copyable aria-label='Variables' }

PositionOffset {: aria-label='Variables' }

{: .abp .tooltip .badge }

Vector PositionOffset {: .copyable aria-label='Variables' }

RenderZOffset {: aria-label='Variables' }

{: .abp .tooltip .badge }

int RenderZOffset {: .copyable aria-label='Variables' }

???+ bug "Bugs" This variable doesnt seem to do anything useful. Use DepthOffset instead.

SizeMulti {: aria-label='Variables' }

{: .abp .tooltip .badge }

Vector SizeMulti {: .copyable aria-label='Variables' }

SpawnerEntity {: aria-label='Variables' }

{: .abp .tooltip .badge }

Entity SpawnerEntity {: .copyable aria-label='Variables' }

SpawnerType {: aria-label='Variables' }

{: .abp .tooltip .badge }

EntityType SpawnerType {: .copyable aria-label='Variables' }

SpawnerVariant {: aria-label='Variables' }

{: .abp .tooltip .badge }

int SpawnerVariant {: .copyable aria-label='Variables' }

SpawnGridIndex {: aria-label='Variables' }

{: .abp .tooltip .badge }

int SpawnGridIndex {: .copyable aria-label='Variables' }

SplatColor {: aria-label='Variables' }

{: .abp .tooltip .badge }

Color SplatColor {: .copyable aria-label='Variables' }

SpriteOffset {: aria-label='Variables' }

{: .abp .tooltip .badge }

Vector SpriteOffset {: .copyable aria-label='Variables' }

SpriteRotation {: aria-label='Variables' }

{: .abp .tooltip .badge }

float SpriteRotation {: .copyable aria-label='Variables' }

SpriteScale {: aria-label='Variables' }

{: .abp .tooltip .badge }

Vector SpriteScale {: .copyable aria-label='Variables' }

SubType {: aria-label='Variables' }

{: .abp .tooltip .badge }

int SubType {: .copyable aria-label='Variables' }

Target {: aria-label='Variables' }

{: .abp .tooltip .badge }

Entity Target {: .copyable aria-label='Variables' }

TargetPosition {: aria-label='Variables' }

{: .abp .tooltip .badge }

Vector TargetPosition {: .copyable aria-label='Variables' }

Type {: aria-label='Variables' }

{: .abp .tooltip .badge }

EntityType Type {: .copyable aria-label='Variables' }

Variant {: aria-label='Variables' }

{: .abp .tooltip .badge }

int Variant {: .copyable aria-label='Variables' }

Velocity {: aria-label='Variables' }

{: .abp .tooltip .badge }

Vector Velocity {: .copyable aria-label='Variables' }

Visible {: aria-label='Variables' }

{: .abp .tooltip .badge }

boolean Visible {: .copyable aria-label='Variables' }

Size {: aria-label='Variables' }

{: .abp .tooltip .badge }

float Size {: .copyable aria-label='Variables' }

Returns the size of the hitbox on an entity.

Last updated