Class "Entity"⚓︎
Children Classes⚓︎
EntityBomb, EntityEffect, EntityFamiliar, EntityKnife, EntityLaser, EntityNPC, EntityPickup, EntityPlayer, EntityProjectile, EntityTear
Functions⚓︎
Add·Burn ()⚓︎
void AddBurn ( EntityRef Source, int Duration, float Damage )⚓︎
Adds a burn-effect to an enemy. Duration is in Number of Frames. Damage is the Damage taken per frame.
Duration infos
The Duration must be a minimum of 2 frames. Every consecutive damage tick is 20 frames apart.
1 2 3 4 |
|
Bug
Changing the Damage value doesnt seem to have an effect. It always deals the amount of damage of the player.
The Duration value seems to have an upper limit. For a PlayerEntity, its only lasting for the duration of one damage interval. For Entities its up to 6 damage-intervals.
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 1.
1 2 3 4 |
|
Add·Charmed ()⚓︎
void AddCharmed ( int Duration )⚓︎
Adds a charmed-effect to an enemy. Duration is in Number of Frames. Charmed enemies are friendly towards isaac and attack other enemies.
AddCharmed(-1)
makes the effect permanent and the enemy will follow you even to different rooms.
Example Code
This code charms every entity in the room for 1 second.
1 2 3 |
|
Add·Confusion ()⚓︎
void AddConfusion ( EntityRef Source, int Duration, boolean IgnoreBosses )⚓︎
Adds a confusion effect to an entity.
Duration infos
The Duration has a maximum of 5 seconds
Example Code
This code confuses every entity in the room for 1 second while ignoring bosses.
1 2 3 4 |
|
Add·Entity·Flags ()⚓︎
void AddEntityFlags ( int Flags )⚓︎
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 Code
This code adds slowing and confusion to the enetity.
1 2 3 4 |
|
Add·Fear ()⚓︎
void AddFear ( EntityRef Source, int Duration )⚓︎
Adds a fear-effect to an entity.
Duration infos
The Duration has a maximum of 5 seconds
Example Code
This code frightens every entity in the room for 1 second.
1 2 3 4 |
|
Add·Freeze ()⚓︎
void AddFreeze ( EntityRef Source, int Duration )⚓︎
Freezes an entity, making it unable to move and attack.
Duration infos
The Duration has a maximum of 5 seconds
Example Code
This code freezes every entity in the room for 1 second.
1 2 3 4 |
|
Add·Health ()⚓︎
void AddHealth ( float HitPoints )⚓︎
Heals an entity.
Add·Midas·Freeze ()⚓︎
void AddMidasFreeze ( EntityRef Source, int Duration )⚓︎
Turns the entity into a gold statue (can't move, can't attack, drops coins when killed)
Duration infos
The Duration has a maximum of 5 seconds
Bug
The golden color applied to the entity will stay for the full duration passed into the function, despite the freeze effect only lasting for a maximum of 5 seconds.
Example Code
This code turns every entity in the room into gold for 1 second.
1 2 3 4 |
|
Add·Poison ()⚓︎
void AddPoison ( EntityRef Source, int Duration, float Damage )⚓︎
Adds a poison effect to the entity.
Duration infos
The Duration must be a minimum of 2 frames. Every consecutive damage tick is 20 frames apart.
1 2 3 4 |
|
Bug
Changing the Damage value doesnt seem to have an effect. It always deals the amount of damage of the player.
The Duration value seems to have an upper limit. For a PlayerEntity, its only lasting for the duration of one damage interval. For Entities its up to 6 damage-intervals.
Example Code
This code applies a poison effect to every entity in the room for 1 second.
1 2 3 4 |
|
Add·Shrink ()⚓︎
void AddShrink ( EntityRef Source, int Duration )⚓︎
Adds a shrink effect to the entity.
Duration infos
The Duration has a maximum of 5 seconds
Example Code
This code shrinks every entity in the room for 1 second.
1 2 3 4 |
|
Add·Slowing ()⚓︎
void AddSlowing ( EntityRef Source, int Duration, float SlowValue, Color SlowColor )⚓︎
Makes the friction higher effectively slowing down the entity.
Example Code
This code slows every entity in the room for 1 second with 0.5 original speed and applying a red color to it.
1 2 3 4 5 |
|
Add·Velocity ()⚓︎
void AddVelocity ( Vector Velocity )⚓︎
Adds velocity to the entity. This can be used to move him in a certain direktion (for example as a result of collision)
Blood·Explode ()⚓︎
void BloodExplode ( )⚓︎
Explodes with gibs and blood.
Can·Shut·Doors ()⚓︎
boolean CanShutDoors ( )⚓︎
enemies keep the doors shut.
Clear·Entity·Flags ()⚓︎
void ClearEntityFlags ( int Flags )⚓︎
Removes all EntityFlags from the entity.
Collides·With·Grid ()⚓︎
boolean CollidesWithGrid ( )⚓︎
Returns true, if the entity is able to collide with the grid.
Die ()⚓︎
void Die ( )⚓︎
Kills the entity and trigger its death animation.
Exists ()⚓︎
boolean Exists ( )⚓︎
Returns true, if this entity still exists.
Get·Boss·ID ()⚓︎
BossId GetBossID ( )⚓︎
If the entity is a boss, it returns its specific boss id. If it isnt a boss it will return 0.
Get·Color ()⚓︎
const Color GetColor ( )⚓︎
Returns the Color object assosiated to this entity.
Get·Data ()⚓︎
table GetData ( )⚓︎
Returns a table that contains all data assosiated with the entity. This can be used to add custom data as well.
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 Code
This code adds custom data to an entity or prints it in the console if it exists.
1 2 3 4 5 |
|
Get·Drop·RNG ()⚓︎
RNG GetDropRNG ( )⚓︎
Returns the assigned RNG object for the entity. This RNG is used to determine the items that are dropped on the entities death.
Get·Entity·Flags ()⚓︎
int GetEntityFlags ( )⚓︎
Get the EntityFlagsof the entity. This will be a number which acts like a bitmask.
Example Code
This code prints something in the console, if the entity has a specific EntityFlags.
1 2 3 |
|
Get·Last·Child ()⚓︎
Entity GetLastChild ( )⚓︎
Returns the last entity spawned by this entity.
Return behavior
If no child is found, this function returns nil
.
Get·Last·Parent ()⚓︎
Entity GetLastParent ( )⚓︎
Returns the last parent of this entity.
Return behavior
If no parent is found, this function returns nil
.
Get·Sprite ()⚓︎
Sprite GetSprite ( )⚓︎
Return the sprite object of the entity.
Has·Common·Parent·With·Entity ()⚓︎
boolean HasCommonParentWithEntity ( Entity Other )⚓︎
Has·Entity·Flags ()⚓︎
boolean HasEntityFlags ( int Flags )⚓︎
Returns true, if the entity has all named EntityFlags set.
Example Code
This code prints something in the console, if the entity has a specific EntityFlags.
1 2 3 |
|
Has·Full·Health ()⚓︎
boolean HasFullHealth ( )⚓︎
Has·Mortal·Damage ()⚓︎
boolean HasMortalDamage ( )⚓︎
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.
Is·Active·Enemy ()⚓︎
boolean IsActiveEnemy ( boolean includeDead )⚓︎
return true for non background NPCs (ex: every enemy except fire and shopkeepers)
Is·Boss ()⚓︎
boolean IsBoss ( )⚓︎
bosses display health bar
Is·Dead ()⚓︎
boolean IsDead ( )⚓︎
Is·Enemy ()⚓︎
boolean IsEnemy ( )⚓︎
return true for NPCs that are not controlled by the player
Is·Flying ()⚓︎
boolean IsFlying ( )⚓︎
Is·Frame ()⚓︎
boolean IsFrame ( int Frame, int Offset )⚓︎
true every X frames
Is·Invincible ()⚓︎
boolean IsInvincible ( )⚓︎
Is·Visible ()⚓︎
boolean IsVisible ( )⚓︎
Is·Vulnerable·Enemy ()⚓︎
boolean IsVulnerableEnemy ( )⚓︎
return true for enemies that can be damaged
Kill ()⚓︎
void Kill ( )⚓︎
Kills the entity and makes a blood splat or gibs.
Multiply·Friction ()⚓︎
void MultiplyFriction ( float Value )⚓︎
Post·Render ()⚓︎
void PostRender ( )⚓︎
Remove ()⚓︎
void Remove ( )⚓︎
Remove the entity from the game instantly, without doing any additional effects/animations.
Remove·Status·Effects ()⚓︎
void RemoveStatusEffects ( )⚓︎
Removes all Status Effects from the entity.
Render ()⚓︎
void Render ( Vector Offset )⚓︎
Render the current sprite of the Entity at the current entity position + offset.
Render·Shadow·Layer ()⚓︎
boolean RenderShadowLayer ( Vector Offset )⚓︎
Render the shadow / shadow layer again.
Set·Color ()⚓︎
void SetColor ( Color Color, int Duration, int Priority, boolean Fadeout, boolean Share )⚓︎
Set the colormask for the entity. This can be used to tint the sprites in different colors.
Example Code
This code changes the color of the sprite to a fully white sprite for 15 frames.
1 |
|
Set·Size ()⚓︎
void SetSize ( float Size, Vector SizeMulti, int NumGridCollisionPoints )⚓︎
Set the size ofthe entity.
Set·Sprite·Frame ()⚓︎
void SetSpriteFrame ( string AnimationName, int FrameNum )⚓︎
Set·Sprite·Overlay·Frame ()⚓︎
void SetSpriteOverlayFrame ( string AnimationName, int FrameNum )⚓︎
Take·Damage ()⚓︎
boolean TakeDamage ( float Damage, int Flags, EntityRef Source, int DamageCountdown )⚓︎
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.
To·Bomb ()⚓︎
EntityBomb ToBomb ( )⚓︎
Used to cast an Entity object to an EntityBomb object.
Return behavior
If the conversion is not successful, this function returns nil
.
To·Effect ()⚓︎
EntityEffect ToEffect ( )⚓︎
Used to cast an Entity object to an EntityEffect object.
Return behavior
If the conversion is not successful, this function returns nil
.
To·Familiar ()⚓︎
EntityFamiliar ToFamiliar ( )⚓︎
Used to cast an Entity object to an EntityFamiliar object.
Return behavior
If the conversion is not successful, this function returns nil
.
To·Knife ()⚓︎
EntityKnife ToKnife ( )⚓︎
Used to cast an Entity object to an EntityKnife object.
Return behavior
If the conversion is not successful, this function returns nil
.
To·Laser ()⚓︎
EntityLaser ToLaser ( )⚓︎
Used to cast an Entity object to an EntityLaser object.
Return behavior
If the conversion is not successful, this function returns nil
.
To·NPC ()⚓︎
EntityNPC ToNPC ( )⚓︎
Used to cast an Entity object to an EntityNPC object.
Return behavior
If the conversion is not successful, this function returns nil
.
To·Pickup ()⚓︎
EntityPickup ToPickup ( )⚓︎
Used to cast an Entity object to an EntityPickup object.
Return behavior
If the conversion is not successful, this function returns nil
.
To·Player ()⚓︎
EntityPlayer ToPlayer ( )⚓︎
Used to cast an Entity object to an EntityPlayer object.
Return behavior
If the conversion is not successful, this function returns nil
.
To·Projectile ()⚓︎
EntityProjectile ToProjectile ( )⚓︎
Used to cast an Entity object to an EntityProjectile object.
Return behavior
If the conversion is not successful, this function returns nil
.
To·Tear ()⚓︎
EntityTear ToTear ( )⚓︎
Used to cast an Entity object to an EntityTear object.
Return behavior
If the conversion is not successful, this function returns nil
.
Update ()⚓︎
void Update ( )⚓︎
Variables⚓︎
Child⚓︎
Entity Child⚓︎
Collision·Damage⚓︎
float CollisionDamage⚓︎
Depth·Offset⚓︎
float DepthOffset⚓︎
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 Code
This code explains how this variable works.
1 2 3 4 5 6 7 |
|
Drop·Seed⚓︎
const int DropSeed⚓︎
Get the Seed of the Drop RNG.
Entity·Collision·Class⚓︎
EntityCollisionClass EntityCollisionClass⚓︎
FlipX⚓︎
boolean FlipX⚓︎
Frame·Count⚓︎
const int FrameCount⚓︎
Friction⚓︎
float Friction⚓︎
loaded from entity config
Grid·Collision·Class⚓︎
GridCollisionClass GridCollisionClass⚓︎
Hit·Points⚓︎
float HitPoints⚓︎
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⚓︎
const int Index⚓︎
Init·Seed⚓︎
const int InitSeed⚓︎
Mass⚓︎
float Mass⚓︎
Max·Hit·Points⚓︎
float MaxHitPoints⚓︎
Parent⚓︎
Entity Parent⚓︎
Position⚓︎
Vector Position⚓︎
Position·Offset⚓︎
const Vector PositionOffset⚓︎
Render·ZOffset⚓︎
int RenderZOffset⚓︎
Bugs
This variable doesnt seem to do anything useful. Use DepthOffset instead.
Size·Multi⚓︎
Vector SizeMulti⚓︎
Spawner·Entity⚓︎
Entity SpawnerEntity⚓︎
Spawner·Type⚓︎
EntityType SpawnerType⚓︎
Spawner·Variant⚓︎
int SpawnerVariant⚓︎
Spawn·Grid·Index⚓︎
const int SpawnGridIndex⚓︎
Splat·Color⚓︎
Color SplatColor⚓︎
Sprite·Offset⚓︎
Vector SpriteOffset⚓︎
Sprite·Rotation⚓︎
float SpriteRotation⚓︎
Sprite·Scale⚓︎
Vector SpriteScale⚓︎
Get/set the scale of the enemy sprite. This can be used to also Scale the shadow of the entity.
Sub·Type⚓︎
int SubType⚓︎
Target⚓︎
Entity Target⚓︎
Target·Position⚓︎
Vector TargetPosition⚓︎
Type⚓︎
const EntityType Type⚓︎
Variant⚓︎
int Variant⚓︎
Velocity⚓︎
Vector Velocity⚓︎
Visible⚓︎
boolean Visible⚓︎
Size⚓︎
float Size⚓︎
Returns the size of the hitbox on an entity.