Binding of Isaac - Afterbirth+ Lua Reference/Guide
|
C:\Users\[YOURUSERNAME]\Documents\My Games\Binding of Isaac Afterbirth+ Mods
main.lua
file in the newly created folder. This file can then be used to contain the logic behind your mod. /Steam/steamapps/compatdata/250900/pfx/drive_c/users/steamuser/Documents/My Games/Binding of Isaac Afterbirth+ Mods
local mod = RegisterMod("Dark Matter tears", 1) -- Register the mod in the API (dont change anything here, except the name)
function mod:onTear(tear)
local player = Isaac.GetPlayer(0) --get the player entity
player:AddCoins(1) -- add a coin
tear.TearFlags = tear.TearFlags |TearFlags.TEAR_SLOW -- add slowing effect to the tear
tear:ChangeVariant(TearVariant.DARK_MATTER ) -- change appearance of the tear
end
mod:AddCallback(ModCallbacks.MC_POST_FIRE_TEAR , mod.onTear) -- Trigger the function "onTear()", when the "POST_FIRE_TEAR" callback is triggered.
local mod = RegisterMod("Dark Matter tears", 1) -- Register the mod in the API (don't change anything here, except the name)
local function onTear(_, tear)
local player = Isaac.GetPlayer(0) -- get the player entity
player:AddCoins(1) -- add a coin
tear.TearFlags = tear.TearFlags | TearFlags.TEAR_SLOW -- add slowing effect to the tear
tear:ChangeVariant(TearVariant.DARK_MATTER) -- change appearance of the tear
end
mod:AddCallback(ModCallbacks.MC_POST_FIRE_TEAR, onTear) -- Trigger the function "onTear()", when the "POST_FIRE_TEAR" callback is triggered.
local functions = {
[1] = function(_, tear)
end,
}
where this function would be called via functions[1], and is used in place of onTear in the AddCallback function of the main example
local mod = RegisterMod("Dark Matter tears", 1) -- Register the mod in the API (don't change anything here, except the name)
mod:AddCallback(ModCallbacks.MC_POST_FIRE_TEAR, function(_, tear)
local player = Isaac.GetPlayer(0) -- get the player entity
player:AddCoins(1) -- add a coin
tear.TearFlags = tear.TearFlags | TearFlags.TEAR_SLOW -- add slowing effect to the tear
tear:ChangeVariant(TearVariant.DARK_MATTER) -- change appearance of the tear
end) -- Trigger the function created within the function argument of the AddCallback function, when the "POST_FIRE_TEAR" callback is triggered.