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, Entity Source, int TearFlags, int DamageFlags, boolean DamageSource )⚓︎


Bomb·Explosion·Effects ()⚓︎

void BombExplosionEffects ( Vector Position, float Damage, int TearFlags, Color Color, Entity Source, float RadiusMult, boolean LineCheck, boolean DamageSource )⚓︎

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


Bomb·Tearflag·Effects ()⚓︎

void BombTearflagEffects ( Vector Position, float Radius, int TearFlags, Entity Source )⚓︎

Does bomb-exclusive special effects.


Butter·Bean·Fart ()⚓︎

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


Change·Room ()⚓︎

void ChangeRoom ( int RoomIndex )⚓︎


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 )⚓︎


Donate·Angel ()⚓︎

void DonateAngel ( int Donate )⚓︎


Donate·Greed ()⚓︎

void DonateGreed ( int Donate )⚓︎


End ()⚓︎

void End ( Ending Ending )⚓︎


Fadein ()⚓︎

void Fadein ( float Speed )⚓︎


Fadeout ()⚓︎

void Fadeout ( float Speed, FadeoutTarget Target )⚓︎


Fart ()⚓︎

void Fart ( Vector Position, float Radius, Entity Source, float FartScale, int FartSubType )⚓︎


Finish·Challenge ()⚓︎

void FinishChallenge ( )⚓︎


Get·Ambush ()⚓︎

Ambush GetAmbush ( )⚓︎


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·Item·History ()⚓︎

History GetItemHistory ( )⚓︎


Get·Item·Overlay ()⚓︎

ItemOverlay GetItemOverlay ( )⚓︎


Get·Item·Pool ()⚓︎

ItemPool GetItemPool ( )⚓︎


Level·Stage ()⚓︎

LevelStage GetLastDevilRoomStage ( )⚓︎

Notes

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


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

LevelStage GetLastLevelWithDamage ( )⚓︎


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

LevelStage GetLastLevelWithoutHalfHp ( )⚓︎


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 ( StateFlag StateFlag )⚓︎


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 ()⚓︎

int HasHallucination ( )⚓︎


Is·Greed·Mode ()⚓︎

boolean IsGreedMode ( )⚓︎


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 hiving the pause menu opened, being in room transitions/cutscenes or while displaying a "big book" animation.


Move·To·Random·Room ()⚓︎

void MoveToRandomRoom ( boolean IAmErrorRoom, int Seed )⚓︎


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 ( StateFlag StateFlag, boolean Val )⚓︎


Shake·Screen ()⚓︎

void ShakeScreen ( int Timeout )⚓︎


Show·Fortune ()⚓︎

void ShowFortune ( )⚓︎


Show·Hallucination ()⚓︎

void ShowHallucination ( int FrameCount, int HallucinationBackdrop )⚓︎

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

Example Code

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(0)
    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)

Bugs

This function does not work and will crash your game on use!


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 ( Entity::EntityDesc desc, Vector Position, Entity Spawner )⚓︎


Spawn·Particles ()⚓︎

void SpawnParticles ( Vector Pos, EntityEffect::Variant ParticleType, int NumParticles, float Speed, Color Color, float Height )⚓︎


Start·Room·Transition ()⚓︎

void StartRoomTransition ( int RoomIndex, Direction Direction, RoomTransition::Animation Animation )⚓︎

Notes

Available Animation types (Discovered by "ilise rose" (@yatboim)):

0: (Default) Standard transition, sweeps the room in from a direction 1: (Fade) Fade to black transition, like its used for the "goto" - console command 2: (Stage) Pixel out transition, like used for crawlspaces and the trapdoor at the end of floors 3: (Teleport) teleport transition, isaac teleports out of the current room and into the next 5: (Ankh) Same as standard transition 6: (Dead Cat) Same as standard transition 7: (1Up) Same as standard transition 8: (Guppys Collar) Same as standard transition 9: (Judas Shadow) Same as standard transition 10: (Lazarus Rags) Same as standard transition 12: (Glowing Hourglass) Same as standard transition 13: (D7) Same as standard transition 14: (Missing Poster) Same as standard transition

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 )⚓︎

Starts a transition animation like it`s playing when entering a trapdoor to switch between stages. Stage Transition types:

  • 0: Standard transition. Removes the playermodel before the pixel fadeout. Then plays the Stage Nightmare animation. The player starts in fetal position after the transition.
  • 1: Standard transition with pixel fadein/out, nightmare cutscene but the player model doesnt get removed and starts in the normal standing position after the transition.
  • >2: Same as 0

Update ()⚓︎

void Update ( )⚓︎


Update·Strange·Attractor ()⚓︎

void UpdateStrangeAttractor ( Vector Position )⚓︎


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: June 9, 2021