Skip to content

Class "Game"⚓︎

Constructors⚓︎

Game ()⚓︎

Game Game ( )⚓︎

Returns a Game object.

Example Code

Example usage:

1
2
Game():IsPaused()
--returns true if the game is paused


Functions⚓︎

Add·Devil·Room·Deal ()⚓︎

void AddDevilRoomDeal ( )⚓︎


Add·Encountered·Boss ()⚓︎

void AddEncounteredBoss ( EntityType Boss, int Variant )⚓︎


Add·Pixelation ()⚓︎

void AddPixelation ( int Duration )⚓︎

Triggers the effect of the "retro vision" pill.


Add·Stage·Without·Damage ()⚓︎

void AddStageWithoutDamage ( )⚓︎

Increases the ingame counter, that keeps track of the stages you cleared without taking damage. (useful for Devil deal manipulations)


Add·Stage·Without·Hearts·Picked ()⚓︎

void AddStageWithoutHeartsPicked ( )⚓︎

Increases the ingame counter, that keeps track of stages you cleared without picking up hearts.


Add·Treasure·Rooms·Visited ()⚓︎

void AddTreasureRoomsVisited ( )⚓︎


Bomb·Damage ()⚓︎

void BombDamage ( Vector Position, float Damage, float Radius, boolean LineCheck = true, Entity Source = nil, TearFlags TearFlags = TearFlags.TEAR_NORMAL, int DamageFlags = DamageFlags.DAMAGE_EXPLOSION, boolean DamageSource = false )⚓︎


Bomb·Explosion·Effects ()⚓︎

void BombExplosionEffects ( Vector Position, float Damage, TearFlags TearFlags = TearFlags.TEAR_NORMAL, Color Color = Color.Default, Entity Source = nil, float RadiusMult = 1, boolean LineCheck = true, boolean DamageSource = false, int DamageFlags = DamageFlags.DAMAGE_EXPLOSION )⚓︎

The complete bomb explosion package: Do damage, spawn boomgraphics, and apply tearflag-based effects.


Bomb·Tearflag·Effects ()⚓︎

void BombTearflagEffects ( Vector Position, float Radius, TearFlags TearFlags, Entity Source = nil, float RadiusMult = 1)⚓︎

Does bomb-exclusive special effects.


Butter·Bean·Fart ()⚓︎

void ButterBeanFart ( Vector Position, float Radius, Entity Source, boolean ShowEffect, boolean DoSuperKnockback )⚓︎


Change·Room ()⚓︎

void ChangeRoom ( int RoomIndex, int Dimension = -1 )⚓︎

This function should be used over Level.ChangeRoom because that function will not update the fxlayers properly.

Dimension Info

Dimension: ID of the dimension to get the room from

1
2
3
4
* -1: Current dimension
* 0: Main dimension
* 1: Secondary dimension, used by Downpour mirror dimension and Mines escape sequence
* 2: Death Certificate dimension

Charm·Fart ()⚓︎

void CharmFart ( Vector Position, float Radius, Entity Source )⚓︎


Clear·Donation·Mod·Angel ()⚓︎

void ClearDonationModAngel ( )⚓︎


Clear·Donation·Mod·Greed ()⚓︎

void ClearDonationModGreed ( )⚓︎


Clear·Stages·Without·Damage ()⚓︎

void ClearStagesWithoutDamage ( )⚓︎

Sets the counter for stages cleared without damage to 0.


Clear·Stages·Without·Hearts·Picked ()⚓︎

void ClearStagesWithoutHeartsPicked ( )⚓︎

Sets the counter for stages cleared without picking up hearts to 0.


Darken ()⚓︎

void Darken ( float Darkness, int Timeout )⚓︎

Darkens the room. This is the function that is called internally during The Lamb fight or when Dice Rooms are activated.


Donate·Angel ()⚓︎

void DonateAngel ( int Donate )⚓︎


Donate·Greed ()⚓︎

void DonateGreed ( int Donate )⚓︎


End ()⚓︎

void End ( Ending Ending )⚓︎

Ending notes

1: Game over "Dear Diary" (exit/restart)

2: Mom / Epilogue (movie)

3: Mom's Heart / End 1/2/3/4/5/6/7/8/9/10/11 (movie) or just Credits depending on context

4: Satan / End 12 (movie)

5: Isaac / End 13 (movie)

6: The Lamb / End 15 (movie)

7: ??? / End 14 (movie)

8: Mega Satan / End 16 (movie)

9: Greed / End 18 (movie)

10: Hush / End 17 (movie)

11: Delirium / End 20 (movie)

12: Greedier / End 19 (movie)

13: Mother / End 21 (movie)

14: The Beast / Final (movie)

Successful endings increment your win streak. If you pass a bad number like 0 then you can artificially increase your win streak as much as you want.


Fadein ()⚓︎

void Fadein ( float Speed )⚓︎


Fadeout ()⚓︎

void Fadeout ( float Speed, FadeoutTarget Target )⚓︎

Notes

FadeoutTarget types:

0: File Select Menu

1: File Selected Menu (New run, Start game, etc.)

2: Title

3: New Game (Starts a new run)

4: Victory lap


Fart ()⚓︎

void Fart ( Vector Position, float Radius = 85, Entity Source = nil, float FartScale = 1, int FartSubType = 0, Color FartColor = Color.Default )⚓︎


Finish·Challenge ()⚓︎

void FinishChallenge ( )⚓︎


Get·Ambush ()⚓︎

Ambush GetAmbush ( )⚓︎

Bug

Since it returns UserData, this function is unusable and therefore broken.


Get·Darkness·Modifier ()⚓︎

float GetDarknessModifier ( )⚓︎


Get·Devil·Room·Deals ()⚓︎

int GetDevilRoomDeals ( )⚓︎


Get·Donation·Mod·Angel ()⚓︎

int GetDonationModAngel ( )⚓︎

Get the value that indicates the angel-counter of a shop-donation maschine. This Stat increases everytime you donate to a shop. A higher number grants a few advantages.


Get·Donation·Mod·Greed ()⚓︎

int GetDonationModGreed ( )⚓︎


Get·Font ()⚓︎

Font GetFont ( )⚓︎


Get·Frame·Count ()⚓︎

int GetFrameCount ( )⚓︎

Returns the number of frames the gameplay is actively running. Pauses are therefore not included! 1 second equals 30 frames. This function therefore works drastically different than Isaac.GetFrameCount()

Example Code

This code returns hours, minutes, seconds, and milliseconds of the game running actively:

1
2
3
4
5
local curTime = Game():GetFrameCount()
local msecs= curTime%30 * (10/3) -- turns the millisecond value range from [0 to 30] to [0 to 100]
local secs= math.floor(curTime/30)%60
local mins= math.floor(curTime/30/60)%60
local hours= math.floor(curTime/30/60/60)%60


Get·Greed·Boss·Wave·Num ()⚓︎

int GetGreedBossWaveNum ( )⚓︎


Get·Greed·Waves·Num ()⚓︎

int GetGreedWavesNum ( )⚓︎


Get·HUD ()⚓︎

HUD GetHUD ( )⚓︎


Get·Item·Overlay ()⚓︎

ItemOverlay GetItemOverlay ( )⚓︎

Bug

Since it returns UserData, this function is unusable and therefore broken.


Get·Item·Pool ()⚓︎

ItemPool GetItemPool ( )⚓︎


Get·Last·Devil·Room·Stage ()⚓︎

LevelStage GetLastDevilRoomStage ( )⚓︎

Bug

Since it returns UserData, this function is unusable and therefore broken.


Get·Last·Level·With·Damage ()⚓︎

LevelStage GetLastLevelWithDamage ( )⚓︎

Bug

Since it returns UserData, this function is unusable and therefore broken.


Get·Last·Level·Without·Half·Hp ()⚓︎

LevelStage GetLastLevelWithoutHalfHp ( )⚓︎

Bug

Since it returns UserData, this function is unusable and therefore broken.


Get·Level ()⚓︎

Level GetLevel ( )⚓︎


Get·Nearest·Player ()⚓︎

EntityPlayer GetNearestPlayer ( Vector Pos )⚓︎


Get·Num·Encountered·Bosses ()⚓︎

int GetNumEncounteredBosses ( )⚓︎


Get·Num·Players ()⚓︎

int GetNumPlayers ( )⚓︎


Get·Player ()⚓︎

EntityPlayer GetPlayer ( int Index )⚓︎

Returns the EntityPlayer with the given index. This function can return nil if the function is called before any player is initialized. If an index is given, that is not used, it will return the last player in the list.

This function is the same as Isaac.GetPlayer().


Get·Random·Player ()⚓︎

EntityPlayer GetRandomPlayer ( Vector Pos, float Radius )⚓︎


Get·Room ()⚓︎

Room GetRoom ( )⚓︎


Get·Screen·Shake·Countdown ()⚓︎

int GetScreenShakeCountdown ( )⚓︎


Get·Seeds ()⚓︎

Seeds GetSeeds ( )⚓︎


Get·Stages·Without·Damage ()⚓︎

int GetStagesWithoutDamage ( )⚓︎


Get·Stages·Without·Hearts·Picked ()⚓︎

int GetStagesWithoutHeartsPicked ( )⚓︎


Get·State·Flag ()⚓︎

boolean GetStateFlag ( GameStateFlag GameStateFlag )⚓︎


Get·Target·Darkness ()⚓︎

float GetTargetDarkness ( )⚓︎


Get·Treasure·Room·Visit·Count ()⚓︎

int GetTreasureRoomVisitCount ( )⚓︎


Get·Victory·Lap ()⚓︎

int GetVictoryLap ( )⚓︎


Has·Encountered·Boss ()⚓︎

boolean HasEncounteredBoss ( EntityType Boss, int Variant )⚓︎


Has·Hallucination ()⚓︎

boolean HasHallucination ( )⚓︎

Returns true if the Delirium animation (Static noise intersected with past gameplay fotage) is playing right now.


Is·Greed·Mode ()⚓︎

boolean IsGreedMode ( )⚓︎

Returns true if the current gamemode is set to Greed or Greedier mode.

To differentiate between Greed and Greedier mode, you need to use the Game().Difficulty attribute.


Is·Paused ()⚓︎

boolean IsPaused ( )⚓︎

Returns true, if the game is in a state, where the player is unable to input any thing or the game logic is paused. This includes having the pause menu opened, being in room transitions/cutscenes or while displaying a "big book" animation.


Make·Shockwave ()⚓︎

void MakeShockwave ( Vector Position, float Amplitude, float Speed, int Duration )⚓︎


Move·To·Random·Room ()⚓︎

void MoveToRandomRoom ( boolean IAmErrorRoom, int Seed, EntityPlayer Player )⚓︎


Next·Victory·Lap ()⚓︎

void NextVictoryLap ( )⚓︎


Render ()⚓︎

void Render ( )⚓︎


Reroll·Enemy ()⚓︎

boolean RerollEnemy ( Entity e )⚓︎


Reroll·Level·Collectibles ()⚓︎

void RerollLevelCollectibles ( )⚓︎


Reroll·Level·Pickups ()⚓︎

void RerollLevelPickups ( int Seed )⚓︎


Set·Last·Devil·Room·Stage ()⚓︎

void SetLastDevilRoomStage ( LevelStage Stage )⚓︎


Set·Last·Level·With·Damage ()⚓︎

void SetLastLevelWithDamage ( LevelStage Stage )⚓︎


Set·Last·Level·Without·Half·Hp ()⚓︎

void SetLastLevelWithoutHalfHp ( LevelStage Stage )⚓︎


Set·State·Flag ()⚓︎

void SetStateFlag ( GameStateFlag GameStateFlag, boolean Val )⚓︎


Shake·Screen ()⚓︎

void ShakeScreen ( int Timeout )⚓︎


Show·Fortune ()⚓︎

void ShowFortune ( )⚓︎


Show·Hallucination ()⚓︎

void ShowHallucination ( int FrameCount, BackdropType Backdrop = BackdropType.NUM_BACKDROPS )⚓︎

Plays the Delirium animation (Static noise intersected with past gameplay fotage), which will also change the background of the current room.

Workaround Code for AB+ mods

This function was broken in AB+, so there was this implementation in order to recreate the effect.

This code emulated the effect of this function by hijacking the Delirious item effect

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
local usagetime = -1 -- stores the last time the effect was called.

-- call this function to play the Hallucination effect
function playHallucination()
    local player = Isaac.GetPlayer()
    usagetime = Game().TimeCounter
    player:UseActiveItem(510, false, false, false, false) -- use the delirious item without applying the costume
    player:GetEffects():RemoveCollectibleEffect(510) -- remove any unwanted side effects of the item usage
end

-- Removes all spawned NPC entities when activating the function
function mod:onFriendlyInit(npc)
    if Game().TimeCounter-usagetime == 0 then -- only remove enemies that spawned when the effect was called!
        npc:Remove()
    end
end
mod:AddCallback(ModCallbacks.MC_POST_NPC_INIT, mod.onFriendlyInit)

Show·Rule ()⚓︎

void ShowRule ( )⚓︎


Spawn ()⚓︎

Entity Spawn ( EntityType Type, int Variant, Vector Position, Vector Velocity, Entity Spawner, int SubType, int Seed )⚓︎

The game has two spawn functions, Game():Spawn() (this one) and Isaac.Spawn(). If you need to spawn something with a specific seed, then you use Game():Spawn(). If you need to spawn something with a randomly generated seed, then use Isaac.Spawn(). Most of the time, you will probably want to use Isaac.Spawn().

Example Code

This code spawns a Leech with specific seed.

1
2
3
4
5
6
7
8
9
Game():Spawn(
  EntityType.ENTITY_LEECH, -- Type
  0, -- Variant
  Game():GetRoom():GetCenterPos(), -- Position
  Vector(0, 0), -- Velocity
  nil, -- Parent
  0, -- SubType
  Game():GetRoom():GetSpawnSeed() -- Seed (the "GetSpawnSeed()" function gets a reproducible seed based on the room, e.g. "2496979501")
)


Spawn·Entity·Desc ()⚓︎

EntityNPC SpawnEntityDesc ( EntityDesc desc, Vector Position, Entity Spawner )⚓︎


Spawn·Particles ()⚓︎

void SpawnParticles ( Vector Pos, EffectVariant ParticleType, int NumParticles, float Speed, Color Color = Color.Default, float Height = 100000, int SubType = 0 )⚓︎


Start·Room·Transition ()⚓︎

void StartRoomTransition ( int RoomIndex, Direction Direction, RoomTransitionAnim Animation = RoomTransitionAnim.WALK, EntityPlayer Player = nil, int Dimension = -1 )⚓︎

Note that if you use RoomTransitionAnim.PIXELATION (2), you must not interrupt the effect (e.g. with another room transition or room change) once it starts playing. Otherwise, after around 11 interuptions, the "log.txt" will start to become spammed with "[ASSERT] - PushRenderTarget: stack overflow!". This is because internally, the game uses a finite buffer to store information about the effect, and if it is interrupted, the buffer will never be cleared.

Dimension Info

Dimension: ID of the dimension to get the room from

1
2
3
4
* -1: Current dimension
* 0: Main dimension
* 1: Secondary dimension, used by Downpour mirror dimension and Mines escape sequence
* 2: Death Certificate dimension
Notes

The boss vs screen overrides all of these transitions, however, using RoomTransitionAnim.DEATH_CERTIFICATE will make it so the player appears lying down after the vs screen and the game will be paused while they get up.

Bugs

The Direction variable is completely ignored at all times, with the game instead calculating the direction between the two rooms itself for the animation. The two rooms are the current room and the room of the RoomIndex. It has no impact on the doors either.


Start·Stage·Transition ()⚓︎

void StartStageTransition ( boolean SameStage, StageTransition::Animation Animation, EntityPlayer Player )⚓︎

Starts a transition animation, like the ones used when entering a trapdoor or light beam to reach the next stage.

The value of Animation seemingly has no actual effect on the transition. (If you have more info, submit a pull request.)

Bug

Contrary to previous beliefs, this function will crash when not provided with an EntityPlayer. It is worth noting however, that the function, even when used correctly, is inconsistent and seems to sometimes crash for no reason.


Update ()⚓︎

void Update ( )⚓︎


Update·Strange·Attractor ()⚓︎

void UpdateStrangeAttractor ( Vector Position, float Force = 10, float Radius = 250 )⚓︎


Variables⚓︎

Blue·Womb·Par·Time⚓︎

int BlueWombParTime⚓︎


Boss·Rush·Par·Time⚓︎

int BossRushParTime⚓︎

Number of frames of game time.


Challenge⚓︎

Challenge Challenge⚓︎


Difficulty⚓︎

const Difficulty Difficulty⚓︎


Screen·Shake·Offset⚓︎

const Vector ScreenShakeOffset⚓︎


Time·Counter⚓︎

int TimeCounter⚓︎

same as FrameCounter but can be modified, mostly used for timed events (bossrush, daily, ...) and not for timestepping



Last update: March 4, 2023