Level Lock/Unlock

Greenkirby21Greenkirby21 Member Posts: 32
edited November -1 in Working with GS (Mac)
So basically, my game is this, when you start the game, there are levels to choose from. When you first begin the game, level 1 is "unlocked", and once you beat level 1, it unlocks number 2. I am confused how to implement this. Do i basically make an attribute for EACH level, set 0 for locked, and set 1 for unlocked. Once that level is completele, set the next level to unlocked How would I save this so when a person quits, it remembers all the levels?

Thanks! You guys are awesome

Comments

  • Greenkirby21Greenkirby21 Member Posts: 32
    wow thanks a lot!!
  • nocrynocry Member Posts: 1
    i did everything but i still did not get it :(
  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    I have two attributes:

    currentLevel and completedLevel

    currentLevel starts at 1 for level 1, and completedLevel starts at 0

    at the end of level 1, right before you change the scene, change completedLevel to currentLevel
    at the start of level 2, set currentLevel to 2

    at the end of level 2, right before you change the scene, change completedLevel to currentLevel
    at the start of level 3, set currentLevel to 3

    at the end of level 3, right before you change the scene, change completedLevel to currentLevel
    at the start of level 4, set currentLevel to 4

    so on and so forth

    so, on the level unlock screen, lets say you're altering level 10. Put code on it that says:

    if completedLevel >= 10 show unlock graphic and if touched, goto level 10

    otherwise
    show locked graphic

    something like that should work
  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    I'm throwing together a quick template I'll post it soon
  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    ugg,gs just crashed and I lost it. I'll redo it later and post it
  • @jonmulcahy Dam that way is so much easier than the way I did it in my current game. I have about 35 booleans.
  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    my first game has over 200 unneeded booleans :)

    you should SEE the code I used to change levels, that was when I tried to make everything a prototype actor, and before "change scene -> next scene was an option"

    it takes 5 minutes to open that actor.
  • JGary321JGary321 Member Posts: 1,246
    I think we would all be surprised to see our first games rule-sets. What a waste of performance. I could certainly do it a LOT better with what I know now.
  • Greenkirby21Greenkirby21 Member Posts: 32
    I am confused. Where in your code do you have the "locked" text. I keep looking for it in your project. For example, I am trying to find where you are putting the "Level 2 is locked". I can't find it. I basically just want mine to say "locked"
  • Greenkirby21Greenkirby21 Member Posts: 32
    never mind i see it was in the else statement : ). thanks
Sign In or Register to comment.