Partial Locking of app

How to make the app partially locked and partially unlocked ?

I'm assuming you mean you have multiple levels and you only want players to access some of them and then the rest will become unlocked either through play or by upgrading.

If that's what you mean, there really is no "easy" answer because a lot depends on how your game is structured.

But assuming you have levels and the levels are numbered and you want to start with 2 levels unlocked you could do something like:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
currentLevel = 1
maxUnlockedLevel = 2
 
...
-- then later in your code....
 
if currentLevel <= maxUnlockedLevel then
     -- let them play
else
     -- prompt to upgrade
end
 
...
-- or if you want to reward them with a new level after completing one...
 
-- end level code
if currentLevel == maxUnlockedLevel then
     maxUnlockedLevele = maxUnlockedLevel + 1
     currentLevel = currentLevel + 1
end

Thanks for the solution.Say for Example I have 10 Levels and I want to unlock only two and the rest of 8 to be locked.And I want the user to pay for the rest of the 8 Levels and then unlock all the levels?

I have a Question that what i have to do in
1. Programming part
2. While uploading in Apple Store..
3. Do I have to do anything Special or it is the normal way.
4. How to add price for the unlocked Levels.

Well its the same basic logic. You have a "locked" flag

local isLocked = true

if playerPurcahsesFullGame then
isLocked = false
end

However, how you go about dealing with the player unlocking the game is a whole different ball of wax. You have to get in-app purchases working which is a bunch of iTunes connect setup, making sure your app is enabled for IAP, having a test account to test your purchases.

Part of that setup is you hve to provide a screen shot of your store to Apple before they will enable your items for testing which also involves submitting your app to apple even though its not done or working, the immediately rejecting the binary. There are several threads in the forums on people and their struggles to get IAP setup.

In your code, if you're going to use IAP (as opposed to a lite version and getting people to upgrade to a full version -- which Apple doesn't really want us doing any more...) you have to track if the player has bought your upgrade and since they can delete the app and any files you might have saved, you have to restore any purchases when the app starts up.

It's a complex question.

views:1620 update:2012/1/13 9:04:04
corona forums © 2003-2011