Unlock Level Problem
KempProductions
Member Posts: 139
Ok, i have been able to lock each level, and then after you beat the level, it raises an attribute "currentUnlockedlevel" by 1. I also have the Save attribute when you beat each level. And load attribute at the very beginning of my game. It all works like it's supposed to. Except if a person plays the game and beats level 5 and then decides to quit, then the next time they play level 6 is unlocked. But if another person is playing on their iPhone and starts at level 1 and beats level 5 also, then because of the change attribute "currentUnlockedlevel" +1, it continues to unlock levels. So that means levels 6-10 will be unlocked, even though they havent been beat.
How do i fix this?
How do i fix this?
Comments
if urrentUlockedLevel = 1
change to 2
save
if currentUnlockedLevel = 2
change to 3
save
etc.
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
if currentLevel is greater than currentUnlockedLevel
change attribute currentUnlockedLevel to currentLevel
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
If you are allowing users to go back and repeat earlier levels...then it sounds like to need a "threshold" rule switch...something like:
if currentLevel = currentUnlockedLevel
and...the currentLevel is beaten...
(then execute my level unlocking routine when the level is beaten)
You'll just have to go back through the logic and try to determine the source and trace all the switching rules to make sure its sound. Its all part of game development.
Sometimes it is easier just to rebuild the problematic rule sequence then to find a bug...and usually the new sequence rebuild is more efficient in the end anyway.
I have a currentUnlockedlevel attribute and currentLevel attribute. In a rule i have change scene when blockCounter is less than or equal to 0, then in a rule inside that i have when attribute current level = currentunlockedlevel, change attribute currentunlockedlevel to (number of next level). Should my save attribute be inside that last rule?
I think the logic structure should be:
I am playing the currentLevel which = the currentUnlockedLevel.
I win the level!!!
After the win...my currentUnlockedLevel should be self+1
save the currentUnlockedLevel to memory.
Then ask...
Do you want to continue to the next level?
If yes...repeat sequence with a change scene.
Then (in parallel sequence)...
If currentLevel < currentUnlockedLevel...
currentUnlockedLevel remains unchanged no matter what.
if the game is having trouble remembering your currentProgress...you may need to track that as well.
In other words...you are tracking the currentLevel, the currentProgressLevel...and the maxProgressLevel (aka currentUnlockedLevel).
This way...the game will remember what level you last played...what level you are ready for if you beat the level...and the maximum progress you have achieved (for those that wish to start over).
hope this helps you analyze the logic.
Say im on level 15. In my actor the display's "Congrats" for winning, i have an attribute "currentLevel" that is set to 15. The currentUnlockedlevel is a game attribute. Now in a rule i have, when self.currentLevel = game.currentUnlockedlevel change attribute game.currentUnlockedlevel to 16. So, because i just beat level 14 the currentUnlockedlevel is set to 15. And thus, self.currentLevel (15) is = to game.curentUnlockedlevel (15) and then because they are equal it changes to 16.
Now the problem im having, is when people beat the game, the currentUnlockedlevel attribute is equal to 41. And when they go back to play, say level 29, and they beat that level, it will not change the currentUnlockedlevel, because the self.currentLevel (29) is not = to game.currentUnlockedlevel (41).
sounds like all you need is a settings page...such as where you adjust your sound or select a level.
You need a "Reset Entire Game" button. Then the player taps that...
it then asks, "Are you sure you want to erase all progress and start over?"
Player taps..."YES"
currentLevel=1
currentUnlockedLevel=1
changeScene.level1
is that what you are looking for?
otherwise...if you are looking to try to allow 2 or more simultaneous players (like plants vs Zombies)...you will need to create internal user accounts (advanced stuff there...but doable).
But if you are just trying to allow a player to go back and replay earlier levels and continue in progress...then you need a levelProgress attribute that operates between the currentLevel and MaxProgressLevel (currentUnlockedLevel) and allows the player to advance same as the unlocking mechanism...like a "tour guide" attribute.
Make sense?
And I don't understand why it works on my iPod, but it doesn't on other peoples.
either you want to be able to reset the game and have all levels locked or are you wanting the simple ability to play lower levels than the unlockedMaxLevel?...Or Both?
All three of these options we have discussed above...so if they are not working...then something is out of sequence or there is something overriding the logic strategy sequence.
keep digging around...something is not right in there if its not behaving right. It seems to be some fairly basic switching...so if its giving you this much grief...there has to be something misfiring or something out of sequence somewhere.
I think you have the strategy correct...just need to make sure the rules match the logic design.
I guess you'll just need to keep digging. i'm not sure what else I can offer you.
Hope you can find the bug.