Save and Load Attribute. HELP!!!

MarcusOMarcusO Member Posts: 147
edited November -1 in Working with GS (Mac)
How do i use Save and Load Attribute. HELP!!!
Cheers
Marcus

Comments

  • InLikeFlynnInLikeFlynn Member Posts: 171
    It's really easy once you figure it out. Just create an attribute, then give it a value. So you could make an integer game.topscore that will indicate the player's top score. Then, to save, just use the save attribute behavior. Set your attribute, then pick any word you want as a key. I'd recommend just using the same word 'topscore'.

    to save:
    Attribute: game.topscore
    Key: topscore

    to load:
    Key: topscore
    Attribute: game.topscore

    Once it's loaded you'll be able to access it anytime just by calling on the attribute instead of loading.
  • MarcusOMarcusO Member Posts: 147
    Awsome. Thanks man :)
    Cheers.
  • akstudiodevelopmentakstudiodevelopment Member Posts: 93
    GeoffB said:
    It's really easy once you figure it out. Just create an attribute, then give it a value. So you could make an integer game.topscore that will indicate the player's top score. Then, to save, just use the save attribute behavior. Set your attribute, then pick any word you want as a key. I'd recommend just using the same word 'topscore'.

    to save:
    Attribute: game.topscore
    Key: topscore

    to load:
    Key: topscore
    Attribute: game.topscore

    Once it's loaded you'll be able to access it anytime just by calling on the attribute instead of loading.

    In addition to that... If you want to save the highest score:

    Have an actor on the scene and edit it at scene level (not prototype) and add an attribute called "Score" and add a game level attribute called "TopScore"...

    When changing Score (Score = Score +1), just access the Score attribute by game.layer.actor.Score

    Rule: If attribute self.Score > game.TopScorethen
    Save attribute self.Score to Key TopScore
    Load Key TopScore to attribute game.TopScore

    Hope this makes sense.

    K
Sign In or Register to comment.