Reputation: 184
I'm looking to create a sprite kit game with stages like stage 1 , stage 2 ,stage 3,etc .
and i want to create a condition that if not finish the first stage you can't reach the 2nd one.
what I'm asking for is can you tell me how to create these stages , or lead me to some tutorial to do that.
Upvotes: 0
Views: 102
Reputation: 29896
Easiet would be to store a dictionary of {String: Bool} to hold {stageIndex: isLocked}
You serialize and deserialize this dictionary in NSUserDefaults as needed.
This dictionary is then used to display the locked state on UI elements etc. If locked and the button pressed, run some animation to show that it cant be opened, e.g. blink the button. (assuming the button shows the stage is locked)
When a player passes a stage, unlock the next one and update the dictionary. When you return the the game menu, reload the UI elements using the dictionary so the updated stage states are shown.
if isLocked == false
{
// init the stage and present its scene
}
Upvotes: 1
Reputation: 11696
Your question is really too broad to provide a good answer but seeing that you are just starting out, I suggest you create a main menu scene and a separate scene for every level you need. You can then transition back and forth between your main menu and levels scenes.
Upvotes: 0