Quantcast
Viewing all articles
Browse latest Browse all 2922

LunaLua • Re: Adding a Power Star for Each Star Coin

while this might work, i have to recommend against as it would mandate putting each star coin in its own section due to the way vanilla smbx keeps track of collected stars.

instead, you'd be better off creating an individual layer for each distinct star coin requirement and putting each corresponding warp into it (for example, every warp that leads to a level that needs 30 star coins would be in the layer "starCoin30"), having each layer be hidden by default

then, putting something like this in your hub's luna.lua file should do the trick (assuming no star coins can be collected inside the hub itself):

Code:

local layerPrefix = "starCoin" -- change this according to the common prefix of your layer namesfunction onStart()    for _, v in ipairs(Layer.find(layerPrefix)) do        local reqCoins = tonumber(string.sub(v.name, string.len(layerPrefix) + 1))        if(SaveData._basegame.starcoinCounter and SaveData._basegame.starcoinCounter >= reqCoins) then            v:show(true)        end    endend

Statistics: Posted by deice — Sat Dec 14, 2024 9:39 am



Viewing all articles
Browse latest Browse all 2922

Trending Articles