Making levels locked, AND Question about saving,

rickynikorickyniko Member Posts: 85
edited November -1 in Working with GS (Mac)
Hi everyone,
was wondering how i can make it for example, you cant unlock level 3, unless Level 2 is completed, etc,

and.

how can i save everything? is there a way to have it save whenever the user clicks the home button so next time they open the app it is back to where they left it?

thanks everyone!

Comments

  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    hi Rickyniko,

    For your first question, you're going to need to track which level the player has completed. Usually I have a, level (which level it is), currentLevel(which level the player is on) & completedLevel (the last level the player has beat) attribute. On my level selection screen I have rules that say:

    if level > completedLevel
    show lock button

    if level < completedLevel
    goto scene XXX.

    To actually have this work however, you'll need code to execute right before your level ends that saves progress. Something like:

    if currentLevel > completedLevel
    change attribute completedLevel = currentLevel
    save attribute completedLevel keyword completedLevel
    goto NextScene

    when you start your game, make sure you actually load that completedLevel value

    load keyword completedLevel attribute completedLevel

    Having the game resume where they left off exactly is done automatically by using iOS4. GS can't really support it right now.

    *im doing this from memory, so the exact code may be slightly different
  • rickynikorickyniko Member Posts: 85
    mulcahy said:
    hi Rickyniko,

    For your first question, you're going to need to track which level the player has completed. Usually I have a, level (which level it is), currentLevel(which level the player is on) & completedLevel (the last level the player has beat) attribute. On my level selection screen I have rules that say:

    if level > completedLevel
    show lock button

    if level < completedLevel
    goto scene XXX.

    To actually have this work however, you'll need code to execute right before your level ends that saves progress. Something like:

    if currentLevel > completedLevel
    change attribute completedLevel = currentLevel
    save attribute completedLevel keyword completedLevel
    goto NextScene

    when you start your game, make sure you actually load that completedLevel value

    load keyword completedLevel attribute completedLevel

    Having the game resume where they left off exactly is done automatically by using iOS4. GS can't really support it right now.

    *im doing this from memory, so the exact code may be slightly different

    thanks for the response, will try it out soon,

    as for the iOS4 multitasking thing, what would happen if the user actually exited the app from the multitask bar? it would end up closing the app, so anyone how would i save it?

    THANKS
Sign In or Register to comment.