I’ve done some searches, I’ve found several threads on it…but I’m stuck…I’m using the Director Class and the beebe games class with each level its separate lua file, level1.lua, etc…
but I’m not entirely sure how to setup the code to unlock the next level after the previous has been completed.
Please? this is the only thing holding me back from the completion of my app…any help would be greatly appreciated. [import]uid: 14940 topic_id: 6799 reply_id: 24143[/import]
if you’re unlocking them in a linear numerical order then just store a single number in a field in your SQLite db. either the latest level complete, or the next available level.
when you go to your main screen check this value from the db and enable the user to select any level up to that point. [import]uid: 6645 topic_id: 6799 reply_id: 24148[/import]
in fact the problem you are referring to is discussed at length in the original thread you posted
[import]uid: 6645 topic_id: 6799 reply_id: 24154[/import]
If anybody is still looking for an easy way to unlock levels, there´s this great class developed by Peach Pellen called “EGO”. It´s as simple as eating cheese cacke.
Here’s another one I use called “Ice”. I use it for my level locking. http://grahamranson.co.uk/lib.php?id=6 [import]uid: 75779 topic_id: 6799 reply_id: 120864[/import]
The idea is quite simple. You have a table with true/false entries for each level. Start out with level one unlocked. Since you’re using director, it would probably be best as a global so that each level can access it.
\_G.levelLocked = { false, true, true, true, true, true} -- 6 levels in this sample
When you show your level select screen, you can look at those values to determine if you need to show the level is locked or not. Level 1 finishes and you’re read to goto level 2? Simply:
\_G.levelLocked[2] = false
Now of course you will want to save this to a file or database at some point. Plenty of the above posts will point you to ways to do that, like ICE or my Super Simple table saver.
If anybody is still looking for an easy way to unlock levels, there´s this great class developed by Peach Pellen called “EGO”. It´s as simple as eating cheese cacke.
Here’s another one I use called “Ice”. I use it for my level locking. http://grahamranson.co.uk/lib.php?id=6 [import]uid: 75779 topic_id: 6799 reply_id: 120864[/import]
The idea is quite simple. You have a table with true/false entries for each level. Start out with level one unlocked. Since you’re using director, it would probably be best as a global so that each level can access it.
\_G.levelLocked = { false, true, true, true, true, true} -- 6 levels in this sample
When you show your level select screen, you can look at those values to determine if you need to show the level is locked or not. Level 1 finishes and you’re read to goto level 2? Simply:
\_G.levelLocked[2] = false
Now of course you will want to save this to a file or database at some point. Plenty of the above posts will point you to ways to do that, like ICE or my Super Simple table saver.