save levels - salvare livelli

superalpensuperalpen Member Posts: 7
edited November -1 in Working with GS (Mac)
hello all, I would like to know if I have a game with many levels, how can I save the position without having to start from scratch?

thanks to all

ciao a tutti, vorrei sapere, se ho un gioco con molti livelli, come posso salvare la posizione senza dovere iniziare da capo?

grazie a tutti

Comments

  • LoadingZeroLoadingZero Member Posts: 75
    Ciao,

    you must create an attribute to store the level state, for example a bool and set it to true when level is complete.
    After this you must save your attribute with SaveAttribute behaviour

    ti devi creare un attributo per ogni livello (game attribute) per esempio booleano settato a false.
    Quando completi il livello lo metti a true e salvi il tuo attributo
  • richcoyrichcoy Member Posts: 211
    You can set a game attribute as an integer called something like "LastLevel" then when a level is completed update that attribute. Then program your continue button to look for the value of that attribute and go to the appropriate level.

    Hope that helps.

    Rich
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Hi superalpen

    It involves the use of the Save and Load attributes to save the level to go to next time a user plays the app. (You can save in themiddle of a level as well, but will need more attributes to save). So:

    Make a text attribute called GoLevel. Place an actor on-screen but outside of the playing area on every scene you have.

    In it's Rules, put:
    Change attribute GoLevel to ----- whatever that particular scene's name is
    Save Attribute GoLevel -- with a key of your choice

    Now at the start of your game, next to Start Game I guess, make a Continue Button. In it's rules, put:

    When GoLevel > ""
    Load Attribute GoLevel (with the same key in the behavior)

    When GoLevel = Scene1 (or whatever you've called it, etc.,)
    Change Scene Scene1

    When goLevel = Scene2
    Change Scene Scene2

    When goLevel = Scene3
    Change Scene Scene3

    etc; up to the amount of scenes you have. Hope it works out for you.

    Edit: Richcoy beat me to it; but mine's a bit more detailed... ;-)

    ---------------------------------------------
    http://www.davidgriffinapps.co.uk/
Sign In or Register to comment.