Question for Photics

LordTarantorLordTarantor Member, PRO Posts: 890
edited November -1 in Working with GS (Mac)
Does the tex includes how to save the game level so if someone leaves the game instead of having to press new to start again, can press continue to start the level he was playing previously? The same for high scores?

Comments

  • PhoticsPhotics Member Posts: 4,172
    LordTarantor said:
    Does the tex includes how to save the game level so if someone leaves the game instead of having to press new to start again, can press continue to start the level he was playing previously? The same for high scores?

    Do you mean the textbook?

    The book doesn't have a specific example for high score or continue, but the Save and Load behaviors are briefly explained in the Behaviors section. You could use those behaviors to create a "continue" or "high score" option.
  • quantumsheepquantumsheep Member Posts: 8,188
    LordTarantor said:
    Does the tex includes how to save the game level so if someone leaves the game instead of having to press new to start again, can press continue to start the level he was playing previously? The same for high scores?

    Essentially what you need are variables.

    Make a variable called 'Progress' - it'll be an integer.

    When a player has completed a level, or even at the start of a level, change the 'progress' integer.

    For example.

    I start level 3 - change progress integer to 3.

    I start level 4 - change progress integer to 4.

    Then use the save behaviour to save attribute 'Progress' using a key (I recommend 'progress' - all lower case as keys are case sensitive).

    This way, whenever the 'Progress' attribute changes, make sure you save the attribute for use later.

    On your title screen, you'd have a control actor that loads in all your saved data.

    In this case, it would load in the attribute 'Progress' using the key 'progress'.

    You could have two actors - 'New' and 'Continue'.

    On 'New', change the attribute 'Progress' to 1 - this will start you on level 1 and resets the player's progress.

    On 'Continue' have the rules:
    If 'Progress' = 1 then change scene to level 1

    If 'Progress' = 2 then change scene to level 2

    and so on and so forth.

    Remember though that saving and loading only works if you're using the iphone viewer, and not in the GS viewer itself.

    Hope that helps!

    QS :D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • AfterBurnettAfterBurnett Member Posts: 3,474
    And you can PRINT that, too ;-)
  • LordTarantorLordTarantor Member, PRO Posts: 890
    QS... Always... You are the sheep bomb, thanks a lot... It worked perfect.
Sign In or Register to comment.