Use
savedata/gamedata
A quick example for boss cutscenes
Code: Select all
GameData[Level.filename()] = GameData[Level.filename()] or {}
local gameData = GameData[Level.filename()]
function onstart()
-- Define a variable
if gameData.x == nil then
gameData.x = false
end
end
function onEvent(eventName)
-- Saving the progress that you already unlocked the boss fight
if eventName == "Phrase 1" then
gameData.x = true
end
-- When you first fight the boss, you go through a cutscene. After that, the cutscene is skipped and directly goes to the boss fight
if eventName == "Boss Trigger" then
if gameData.x == true then
triggerEvent("Phrase 1")
else triggerEvent("Cutscene") end
end
end
You can also use it to do different things, such as unlocking a secret path after collecting every red coins, even after dying or restarting.