Skip to content

Global Functions⚓︎

Constructors⚓︎

BitSet128 ()⚓︎

BitSet128 BitSet128 ( int Low = 0, int High = 0 )⚓︎

Constructor for the "BitSet128" class.

BitSet128 is used as a storage system for flags and other bit-wise evaluated values that exceed the numeric limits of the default 64-bit integers which only allow for up to 64 flags to be defined. BitSet128 allows for up to 128 Flags by spliting the bitset into a "lower" and "higher" part. Those parts are represented by a simple 64bit integer number.


Color ()⚓︎

Color Color ( float R, float G, float B, float A = 1, float RO = 0, float GO = 0, float BO = 0 )⚓︎

Constructor for the "Color" class.

When using the Font class, use KColor() instead.

Colors are made of three separate components, tint, colorize and offset. Tint acts like a color multiplicator. Offset is a color which is added after the tint is applied. Colorize is complicated. See the SetColorize() function for a detailed description.

R, G, B, A, RO, GO and BO accept numbers between 0 and 1.


Entity·Ptr ()⚓︎

EntityPtr EntityPtr ( Entity entity )⚓︎


Entity·Ref ()⚓︎

EntityRef EntityRef ( Entity entity )⚓︎


Font ()⚓︎

Font Font ( )⚓︎

Constructor for the "Font" class.

Example Code

Example usage.

1
2
3
local f = Font() -- init font object
f:Load("font/terminus.fnt") -- load a font into the font object
f:DrawString("Hello World!",60,50,KColor(1,1,1,1),0,true) -- render string with loaded font on position 60x50y


Game ()⚓︎

Game Game ( )⚓︎

Returns a Game object.

Example Code

Example usage:

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


KColor ()⚓︎

KColor KColor ( float red, float green, float blue, float alpha )⚓︎

Constructor for the "KColor" class.

Notes

"KColor" is only used in the Font class. For most other situations you will need to use the Color() constructor.


Music·Manager ()⚓︎

MusicManager MusicManager ( )⚓︎

Returns a MusicManager object.

Example Code

Example usage:

1
MusicManager():Disable()


Projectile·Params ()⚓︎

ProjectileParams ProjectileParams ( )⚓︎


Register·Mod ()⚓︎

Mod Reference RegisterMod ( string modName, int apiVersion )⚓︎

Method to define a mod in the game. This needs to be defined to handle callbacks and save data in your mod.

Returns a table which acts as the Mod Reference.

Example Code
1
local yourMod = RegisterMod("someMod", 1)

RNG ()⚓︎

RNG RNG ( )⚓︎


SFXManager ()⚓︎

SFXManager SFXManager ( )⚓︎

Returns a SFXManager object.

Example Code

Example usage:

1
SFXManager():Stop(SoundEffect.SOUND_1UP)


Sprite ()⚓︎

Sprite Sprite ( )⚓︎


Vector ()⚓︎

Vector Vector ( float x, float y)⚓︎


Functions⚓︎

Get·Ptr·Hash ()⚓︎

int GetPtrHash ( Object object )⚓︎

Returns a hash-value of the pointer given as an input value. Valid inputs are any Isaac object, including Entity, Room, RNG, Sprite, Game etc.

It can be used to easily compare two entities, making equality checks very easy.

Example:

If you spawn a certain entity, save it in a variable and then compare it to the entity parameter in MC_ENTITY_TAKE_DMG, this comparison will never be true even if both variables refer to the exact same entity in the game. GetPtrHash() turns pointer into a fixed number, which makes comparisons easier.

Example Code

Example on check if two entities saved in different variables are the same.

1
2
3
4
5
6
7
8
-- don't do it like this
if entity1 == entity2 then
    -- this will always be false, because two different references on a pointer are not equal
end
-- use GetPtrHash() to compare them
if GetPtrHash(entity1) == GetPtrHash(entity2) then
    -- this will be true, when the pointer of both variables point to the same object.
end


Random ()⚓︎

int Random ( )⚓︎

Returns a random integer between 0 and 2^32. It is tested to be inclusive on the lower end and exclusive on the higher end.

Since this function can return 0, you cannot safely use it as the seed for an RNG object, since RNG objects with a seed of 0 crash the game. It is recommended to abstract away this failure case by using a helper function that arbitrarily sets the seed to 1 when the seed is 0.


Random·Vector ()⚓︎

Vector RandomVector ( )⚓︎

Returns a random vector with length 1. Multiply this vector by a number for larger random vectors.



Last update: April 19, 2024