Unlock Levels
iPhoneDevForMe
Member Posts: 362
I am having a small issue with unlocking levels. Here is my logic:
I currently have 3 levels to start with (this will grow by quite alot). I have a level select scene with 3 of the same actor. I have a game attribute named UnlockedLevel set to 1 (so that the first level is unlocked). In each level, when the conditions are met to win, I have a rule to add 1 to the UnlockedLevel attribute. On level 1, it states that if UnlockedLevel = 1, add 1 to UnlockedLevel, otherwise do nothing. This is so that when a player decides to play an already unlocked level again and wins, it will only add 1 to the UnlockedLevel attribute if you are at the last level you unlocked.
In my level select scene, each actor that represents a level has its own behavior. The actor for level one states that when the actor is clicked/touched, if UnlockedLevel is = to 1, change scene to level 1. The actor for level 2 and 3 are the same only when UnlockedLevel = 2/3, change scene to Level 2/3 when clicked.
My problem is when I preview my level select scene and click on any of the levels, they all load level 1. When I click 3, it goes to level 1, and when I click 2 it goes to level 1.
If I go to level 1 and win, every single button now loads level 2, including the level 1 button. This also happens with the 3rd level.
Im assuming it has to do with the logic, so maybe after clearing my head for a little, I can look back at my logic, but as of right now, its just not coming to me! Any ideas?
I currently have 3 levels to start with (this will grow by quite alot). I have a level select scene with 3 of the same actor. I have a game attribute named UnlockedLevel set to 1 (so that the first level is unlocked). In each level, when the conditions are met to win, I have a rule to add 1 to the UnlockedLevel attribute. On level 1, it states that if UnlockedLevel = 1, add 1 to UnlockedLevel, otherwise do nothing. This is so that when a player decides to play an already unlocked level again and wins, it will only add 1 to the UnlockedLevel attribute if you are at the last level you unlocked.
In my level select scene, each actor that represents a level has its own behavior. The actor for level one states that when the actor is clicked/touched, if UnlockedLevel is = to 1, change scene to level 1. The actor for level 2 and 3 are the same only when UnlockedLevel = 2/3, change scene to Level 2/3 when clicked.
My problem is when I preview my level select scene and click on any of the levels, they all load level 1. When I click 3, it goes to level 1, and when I click 2 it goes to level 1.
If I go to level 1 and win, every single button now loads level 2, including the level 1 button. This also happens with the 3rd level.
Im assuming it has to do with the logic, so maybe after clearing my head for a little, I can look back at my logic, but as of right now, its just not coming to me! Any ideas?