How To unlock and save levels in Corona SDK

Hey guys I am new to Corona SDK I have worked in other languages like java and game salad. This is my first time working with lua,and I love lua so for. But now to my problem I want to unlock levels in corona and have a 3 star system like angry birds but I don’t have no idea how to do this. Also I have 34 levels and I want to know if I have to create 34 lua files one lua file for every level. How would I solve this this issue thanks in advance. Some please help:)…

You could create 34 lua files and I’ve seen a lot of coders do that – newbie coders. :wink: (Okay, there may be valid reasons for 1 file per level, but I’ve never seen one.)

Here’s an article I wrote a while back about the level lock/unlock thing:

http://gamedevnation.com/game-development/lockunlock-levels/

See if that helps.

 Jay

Hey Jay i read  your  article but i was confuse  a little  because  in my game i have a count on a ball and when the count  == 0 in level 1 the  count would set level2 true and make it playable.  would i put this  code in the main.lua file  or in my level 1 

LevelAccess = { [1]=true, [2]=false, [3]=false }
currentLevel = 1 

 Also would i put  this in the  level select  

for x = 1, #levelAccess do
  if levelAccess[x] == true then
    print("Play Level " … tostring(x) )
  else
    print(“Level " … tostring(x) … " Locked” )
  end
end

 would i put this  when the count == 0 

levelAccess[currentLevel+1] = true  

thanks so much to answer 

http://forums.coronalabs.com/topic/35119-need-a-skilled-developer-to-quickly-finish-up-a-project/

i also read this but i don’t know how to put this with my code isn’t their a zip file some one could send thanks 

FYI, please only post your question once.  Posting the same question multiple times is against forum rules. 

I’m going to close the other thread.  Everyone needs to post on this one.

Here is my post on the other one:
 

There won’t be a quick solution to this.  You could find some people
who sell existing templates that do it, but here is no existing Corona
SDK API to do this.  Why?

Because every game is different with different unlock rules and
requirements.   People use Storyboard in different ways and it’s really
up to you how you want to implement this.   Generally I would have a
table that represents each level with a status flag (true or false) if
it’s locked or not.  Then when drawing your level select screen you
would check  that table for the level you are drawing and if it’s true
(locked), draw your lock image, if it’s unlocked, draw the unlocked
images. 

You could use that same table to also include values for the # of
stars and the score for that level or any other attributes you want to
track.

Look for tutorials on using tables, drawing images, storing data across scenes, etc.

thanks for your help and i won’t do that no more but will do more research on this and see how i could do this one thanks a million  but any one else got something that might be useful please post  thanks Rob big fan of your work :D    

ii have been using this file here http://gamedevnation.com/game-development/lockunlock-levels/ but don’t understand it 

You could create 34 lua files and I’ve seen a lot of coders do that – newbie coders. :wink: (Okay, there may be valid reasons for 1 file per level, but I’ve never seen one.)

Here’s an article I wrote a while back about the level lock/unlock thing:

http://gamedevnation.com/game-development/lockunlock-levels/

See if that helps.

 Jay

Hey Jay i read  your  article but i was confuse  a little  because  in my game i have a count on a ball and when the count  == 0 in level 1 the  count would set level2 true and make it playable.  would i put this  code in the main.lua file  or in my level 1 

LevelAccess = { [1]=true, [2]=false, [3]=false }
currentLevel = 1 

 Also would i put  this in the  level select  

for x = 1, #levelAccess do
  if levelAccess[x] == true then
    print("Play Level " … tostring(x) )
  else
    print(“Level " … tostring(x) … " Locked” )
  end
end

 would i put this  when the count == 0 

levelAccess[currentLevel+1] = true  

thanks so much to answer 

http://forums.coronalabs.com/topic/35119-need-a-skilled-developer-to-quickly-finish-up-a-project/

i also read this but i don’t know how to put this with my code isn’t their a zip file some one could send thanks 

FYI, please only post your question once.  Posting the same question multiple times is against forum rules. 

I’m going to close the other thread.  Everyone needs to post on this one.

Here is my post on the other one:
 

There won’t be a quick solution to this.  You could find some people
who sell existing templates that do it, but here is no existing Corona
SDK API to do this.  Why?

Because every game is different with different unlock rules and
requirements.   People use Storyboard in different ways and it’s really
up to you how you want to implement this.   Generally I would have a
table that represents each level with a status flag (true or false) if
it’s locked or not.  Then when drawing your level select screen you
would check  that table for the level you are drawing and if it’s true
(locked), draw your lock image, if it’s unlocked, draw the unlocked
images. 

You could use that same table to also include values for the # of
stars and the score for that level or any other attributes you want to
track.

Look for tutorials on using tables, drawing images, storing data across scenes, etc.

thanks for your help and i won’t do that no more but will do more research on this and see how i could do this one thanks a million  but any one else got something that might be useful please post  thanks Rob big fan of your work :D    

ii have been using this file here http://gamedevnation.com/game-development/lockunlock-levels/ but don’t understand it 

Sean, so sorry I didn’t see your question. Since it was months ago you probably already discovered the solution, but if you still need help just ask.

 Jay

Hey Jay thanks for replying I figured out the problem and my level lock system is working fine. The only set back I have so far is getting the leader board system to work properly I have been using the blog post on the corona labs Web site but my project keep show crazy errors. I was wondering if theirs any video on YouTube that could help me set up the leader board properly for corona.i will post a forum and ask my question in more detail. But …thanks for your help …Jay your help is greatly appreciated :slight_smile: thanks

I haven’t done any leaderboard videos (nor recall seeing any) - are you talking about leaderboards with GameCenter? The last time I did that was probably at least a year ago. I’ll be digging into it again within the next couple months for a game I’m finishing and will probably have to figure it all out once again. :slight_smile:

 Jay

I am talking about the  the Google play store   GPGS SDK  i am not sure why i am getting these error in my project, but A video would probably be a  great  help to me and new corona sdk  developers.  Thanks again  Jay   :slight_smile:

Sean, so sorry I didn’t see your question. Since it was months ago you probably already discovered the solution, but if you still need help just ask.

 Jay

Hey Jay thanks for replying I figured out the problem and my level lock system is working fine. The only set back I have so far is getting the leader board system to work properly I have been using the blog post on the corona labs Web site but my project keep show crazy errors. I was wondering if theirs any video on YouTube that could help me set up the leader board properly for corona.i will post a forum and ask my question in more detail. But …thanks for your help …Jay your help is greatly appreciated :slight_smile: thanks

I haven’t done any leaderboard videos (nor recall seeing any) - are you talking about leaderboards with GameCenter? The last time I did that was probably at least a year ago. I’ll be digging into it again within the next couple months for a game I’m finishing and will probably have to figure it all out once again. :slight_smile:

 Jay