Unlock Level Problem

KempProductionsKempProductions Member Posts: 139
edited November -1 in Working with GS (Mac)
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?

Comments

  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    instead of just having currentUlickedLevel increase by 1, put it in a rule

    if urrentUlockedLevel = 1
    change to 2
    save

    if currentUnlockedLevel = 2
    change to 3
    save

    etc.
  • KempProductionsKempProductions Member Posts: 139
    I thought about that too. But theres still a problem with that. Just like in the first problem if i get to level 5 and quit, and then my friend plays and starts at level 1 and gets to 3 and quits. Then I get on it again, only level 1-3 is unlocked.
  • KempProductionsKempProductions Member Posts: 139
    Anyone know the best way??
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    At the end of each level you probably have a change attribute game.currentunlocked to next level. Well, make another game attribute called current level. Only change game.currentunlocked if current level = currentunlock.
  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    yea, you'll need some logic on the actor that updates current level

    if currentLevel is greater than currentUnlockedLevel
    change attribute currentUnlockedLevel to currentLevel
  • KempProductionsKempProductions Member Posts: 139
    I'm still having a problem with this. I used the currentLevel and all of that, but people who are playing it say that after they beat it and exit, then get back on it another day go back to play like Level 17, it locks Levels 19 and up after they beat level 17.
  • synthesissynthesis Member Posts: 1,693
    If you are allowing multiple players to play...then you would have to track the levels that are unlocked with each unique player...as if its a different game...if I understand your problem correctly.

    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)
  • KempProductionsKempProductions Member Posts: 139
    That is what I have. It works correctly on my iTouch which i test on, but people who bought it have told me they are having this problem.
  • synthesissynthesis Member Posts: 1,693
    Don't know what to tell you...its a tiny bug in your logic somewhere then...

    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.
  • KempProductionsKempProductions Member Posts: 139
    Alright, Thank you. If I can't find the problem, I may just have to unlock all levels. Although it wont be as fun, because if you can't beat the level you can still move on.
  • synthesissynthesis Member Posts: 1,693
    Its in there somewhere...don't give up too easy.

    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.
  • KempProductionsKempProductions Member Posts: 139
    Ok, might this be my problem?

    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?
  • synthesissynthesis Member Posts: 1,693
    I having trouble following your logic there.

    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.
  • KempProductionsKempProductions Member Posts: 139
    Yeah, sorry I didn't explain that very good.

    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).
  • synthesissynthesis Member Posts: 1,693
    Is that all...!!!
    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?
  • KempProductionsKempProductions Member Posts: 139
    Yeah, I do have a scene selection page. And its really not made for 2 different players to play. But I want the person to be able to play any level they want once that level is unlocked.

    And I don't understand why it works on my iPod, but it doesn't on other peoples.
  • synthesissynthesis Member Posts: 1,693
    I'm confused then...
    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.
  • synthesissynthesis Member Posts: 1,693
    It seems like you have the logic design correct...but something isn't right in the rule structure. The discussion we have had seems like it should work and its not that complex a logic structure. There has to be something out of sequence or misfiring or mistimed in its execution.

    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.
  • KempProductionsKempProductions Member Posts: 139
    Yeah, I think I may have my Save Attribute in the wrong place, I didn't have time to try it out yesterday. But I really wont know if it works until someone else who bought it updates it and lets me know.
  • iPhoneDevForMeiPhoneDevForMe Member Posts: 362
    Any sure solution yet? Im working on this problem as well.
Sign In or Register to comment.