Unlocked levels saves are over writing already unlocked levels, need help ASAP.

blisterblister Member Posts: 13
edited March 2012 in Working with GS (Mac)
First, I have all my levels once they are unlocked it saves the them and then when you load the game it loads all the unlocked levels. I used tshirtbooths tutorials for this.

My problem is this...

If you have lets say 5 levels unloked and decide to replay level 1, when you beat the level and go to the level select screen only level 2 is unlocked and levels3,4, 7 5 are locked again.

How do you tell gameSalad not to save if the level is already unlocked so all the unlocked levels are there still if you play an older level?

Comments

  • akstudiodevelopmentakstudiodevelopment Member Posts: 93
    Hey,

    Let me know if I'm on the right track here, I think this is what your after...

    Two parts; The Level actors in the level select screen and the trigger at the end of each level

    Create a Game Index Attribute i.e. CurrentLevel
    Create an Index Attribute inside the Global Level Actor (icon for each level) i.e. Level
    Create an Boolean Attribute inside the Global Level Actor (icon for each level) i.e. LevelUnlocked
    (These will feed through to each Level Actor on the Scene)

    Open each Level actor on the scene and change the Level attribute to represent each level... 1,2,3,4,5,6... etc

    On each Level Actor on the Scene, have a rule:
    Rule:
    - if attribute "self.Level" <= "game.CurrentLevel
    - Change image to "[YouUnlockedImageHere]"
    - Change Attribute "self.LevelUnlocked" to "true"
    - Else
    - Change image to "[YouLockedImageHere]"
    - Change Attribute "self.LevelUnlocked" to "false"


    At the point you end each level, there is a trigger telling it to unlock the next level and start it.
    You will need something similar to the following:

    Rule:
    When "[Something]" collides with "[Something]" (Or you could have - When "Score" = "[EnterGoalScoreHere]"
    At this point you would have Saving features and other resets for attributes etc...
    - Rule (inside the rule):
    - If "game.CurrentLevel" = "self.Level"
    - Change Attribute "game.CurrentLevel" to "game.CurrentLevel+1"
    - Change Scene to "Next Scene"


    I have to admit, I'm at work writing this from memory, but I'm pretty sure I have covered it all.

    Let me know how you go.

    Kris
  • blisterblister Member Posts: 13
    Thanks for the reply...
    WEll I've got that basically set up and the unlocks work and save as they should the problem is, if you replay an older level and beat it, then it saves your unlocks to the next level and you lose all of the unlocked levels you have done.

    So what I need is to figure out how to have my game check to see if the current level is unlocked already and if so then it does not save.

    Basically it only saves if you beat the level the first time. So my players do not lose their unlocked levels.
  • akstudiodevelopmentakstudiodevelopment Member Posts: 93
    I will have another look as one of my projects and revise what I wrote tonight (NZ Time). I may have missed something...

    K
  • blisterblister Member Posts: 13
    Thanks I appriciate your help.
  • blisterblister Member Posts: 13
    Think I solved it.

    I added a rule that says if gam attribute level unlock is < or = to (next unlock number) then
    change Level unlock to (next unlock number) and then it can save.

    This way if the level unlock number is greater than level played or next level then it will not save again or save over in this case. Test run and still had all my unlocks after replaying level 1 again!
Sign In or Register to comment.