Given that tutorial: 3 worlds, 2 levels per world and using Storyboard. what I would do is this:
- Create a table and add it to the storyboard object that tracks the highest level for that world:
storyboard.highestLevel = {1, 0, 0}
Now you want to let them have level 1 of world 1 unlocked.
In the code where you are drawing the whole world, you can do a simple check:
if storyboard.highestLevel[thisWorld] == 0 then
-- the code to draw the world greyed out or however you want to show the world is locked
end
In that example, substitue “thisWorld” with whatever variable is holding your current world ID.
Now for a world with unlocked levels you will do something similar.
Inside those nested “for” loops, between lines 36 and 37 I would add:
if storyboard.highestLevel \>= current then
then have the code to render the level and after line 43 add:
else
levels[current] = -- some code to draw a greyed out button
end
[import]uid: 19626 topic_id: 24589 reply_id: 99530[/import]