Put this in a luna.lua file for each level you want the effect in:
Code: Select all
local starcoin = require("npcs/ai/starcoin")
local collected = false
function onTick()
if starcoin.getLevelCollected(Level.filename()) >= starcoin.count() and not collected then
triggerEvent("Event Name")
collected = true
end
end
It triggers the event when ALL of the Star Coins for that level are collected.