Tutorial: Example Project
Example project
C:\Users\[YOURUSERNAME]\Documents\My Games\Binding of Isaac Afterbirth+ Mods:fontawesome-brands-linux: For Linux {: .subHeader .notes }
/Steam/steamapps/compatdata/250900/pfx/drive_c/users/steamuser/Documents/My Games/Binding of Isaac Afterbirth+ Mods:fontawesome-solid-code: Example "main.lua" {: .subHeader .example_code }
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.:fontawesome-solid-code: Local function example {: .subHeader .example_code }
Differences to the other method:
:fontawesome-solid-code: "Inline" definition of functions example {: .subHeader .example_code }
Differences:
Last updated
Was this helpful?