Saving, What am i missing?

JamesZeppelinJamesZeppelin Member Posts: 1,927
edited November -1 in Working with GS (Mac)
I am completely puzzled with saving high score.

1. I have searched the forums even walked through step by step with the video tutorial. I know this has been covered but i must be missing something really silly.

2. I can get the high score to save. The high score will remain on the title screen and regular score resets each gameplay.....

However the problem is when i close the app on the iphone the high score resets. So it seems to save but not through a reset.

Please let me know if any of you have had the same problem

note: i am using the save attribute and load attribute

thanks!

Comments

  • BeyondtheTechBeyondtheTech Member Posts: 809
    Are you using the same keyword? I use the same name as the Attribute.

    (start of app)
    `Load Attribute: game.HighScore, keyword: highscore`

    (end of game scene)
    `Save Attribute: keyword: highscore, game.HighScore`

    Are you sure you're not Changing the Attribute anywhere in the program?
  • JamesZeppelinJamesZeppelin Member Posts: 1,927
    thanks, ill check
  • design219design219 Member Posts: 2,273
    You also have to use the "load" attribute so when you game is reopened it will load the number.

    *edit*

    As was said above.
  • JamesZeppelinJamesZeppelin Member Posts: 1,927
    Yeah just tried all that still nothing... ill keep plunking away at it
  • BeyondtheTechBeyondtheTech Member Posts: 809
    How about a screenshot of your Behaviors? What's the keyword you are using for both Behaviors?

    Are you Constraining the Attribute of High Score? I'm sure this can be resolved if we find out what exactly is going on in there.
  • micahmicah Member Posts: 85
    Are you testing this on your iPhone? I'm pretty sure each time you Preview your game it doesn't restore the same saved settings, so that might be your problem.
  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    Did this ever get resolved?

    I'm definately being an idiot , I'm blaming lack of sleep and too much juggling baby, gs ideas and testing and lazyness. But can someone please point me the way of a walkthrough/tutorial/forum posts on how to go about creating a highscore (I'd like to use my timer which counts down) have it so it is saved on each scene and added together to make a total which can be saved as games highest score. Possibly with score board showing a few options possibly showing just one.

    And that's me done for the night in cold wet miserable England, bring on app sale success and my own sunny beach villa.
  • SingleSparqSingleSparq Member Posts: 1,339
    In the same boat - been at it for 5 nights now and have made some progress as the scores are saving but not in the correct high score order. I understand you have to save and load the scores but it was an issue (for me) how the adjusted scores (score1, score2 etc) got saved and at what point or how they were triggered to save.

    Also I see it mentioned to "Constraining the Attribute to highscore" but it's not explained why you need to do it.

    If I figure it all out I will post. IF anyone has a full method (including when and where to load the scores) please feel free to post, thanks.
  • JamesZeppelinJamesZeppelin Member Posts: 1,927
    I did get it resolved a day or so after posting. I had found a video on the forums by I think Ideveloperz. I just went step by step witht his YouTube video and it magically worked.

    Was a lifesaver.

    My problem was just getting my head around the attributes thing.

    Once I got that it was lime a light came on.
  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    Cool. Thanks tiny monster, just watched YouTube video. Nice and simple looking. Did youake any changes or stick with the exact same design?
  • SingleSparqSingleSparq Member Posts: 1,339
    My definitive answer:
    This tutorial is under the assumption you have scores working and displaying - so you should have an attribute called "Score" that holds the numerical information. There are other ways to do this but this worked for me.

    Create the attributes you need for Hi scores

    Attributes (real or integer) name them as you wish
    Score (if you have a score set up, use that attribute)
    score1
    score2
    score3
    score4
    score5
    (do more if you so wish)

    Scenes
    You should have at least these scenes to work with in your game:
    - Start scene (start up screen)
    - A Game level (scene)
    - Hi Scores scene
    - optional - a tally scene (or finish scene) but I will show this as an actor instead as then you don't have to make the user load a scene just for the end game score.

    ******
    Actors

    Create this actor: HiScore1

    - this will be used to display score

    Add these to it:
    - display text - choose via the expression editor "score1" so it reads game.Score1 in the text area - Set size, colour, font

    -Copy this actor as many times as you need and change the score1 to score2, basically match your attributes to what your displaying

    -Place these Actors onto the Hi Scores scene as you wish

    ******
    Create this actor: Scoresload

    Add a load attribute
    -Set your Key to HiScore1 and attribute (choose score1 from attribute pop up - will say game.score1 once you have finished

    -Copy the load attribute for as many times has you need - just change the KEY and Attribute for each to match your score1, score2

    REMEMBER - your KEY has to Match exactly in your load and save attributes (Tip: copy Key text to an open text file and use it to paste when you need to)

    -Place this Actor on the first screen your game opens to (you can use this for other load attributes as you see fit as well)
    -Set it to be invisible as it doesn't need to be seen

    ******

    Create this actor: Scores

    - this will contain the rules to set the order of scores for display AND will contain the save scores attributes

    -add a rule and set to ALL conditions when valid

    - Make it an attribute rule choosing Score (your main score attribute) and will look like game.score once chosen from the attribute browser (…)

    -Set the 'greater than or equal to' sign form the pop menu

    -Set Score1 (your high score) from the expression editor and will look like 'game.score1' when complete

    -Add 5 Change attributes (or as many as you have HIscore attributes) in this rule and from top to bottom change each to the following (by now you should know there are two fields to change so just follow the list below):
    score5 to: score4 (will look like 'game.score5' and 'game.score4' when complete)
    score4 to: score5
    score3 to: score2
    score2 to: score1
    score1 to: score

    Create a second rule (copy the first)

    -Have 2 attributes on the rule and should look like this:
    game.score < game.score1 (that would be less than)
    game.score (use greater than or equal sign) game.score2

    -You should only need 4 attributes in the rule now so delete the last one
    (in this case 'score1 to: score')
    and change the NEW last Attribute so that :
    'game.score2 to: game.score1'
    is now
    'game.score2 to: game.score'

    Create a Third rule (copy the second)

    -Have 2 attributes on the rule and should look like this:
    game.score < game.score2 (that would be less than)
    game.score (use greater than or equal sign) game.score3

    -You should only need 3 attributes in the rule now so delete the last one
    (in this case 'score1 to: score')
    and change the NEW last Attribute so that :
    'game.score2 to: game.score'
    is now
    'game.score3 to: game.score'

    Continue with more rules sets as needed (I think the pattern is clear here)

    TIMER
    -Add in a timer set to 'after 1 second'
    -place in the timer 5 SAVE attributes
    again it should be obvious to match them as
    game.score1 to HiScore1
    game.score2 to HiScore2
    etc.

    Now this can be placed in the game scene/level (invisible of course) with a rule set wrapped around it - like level complete attribute that gets triggered and then makes this act. Usually you would have a game controller actor that controls various attributes on your scene and would place these there but it can be it's own actor

    OR

    The level complete trigger that you should have might send you to a new 'Complete' scene where the actor would be present

    Alternatively (in mine)

    I created an actor called tally that will pop up once the level is complete (the game controller actor on a level has rule that when attribute 'levelwin' is true - spawn tally actor. It's quicker than sending to a new scene.

    Tally actor (or could be a scene)

    This actor is set to be over top of the finished level with a pause attribute on the game and is good for showing final level info like score, any additional bonuses, a continue button (spawned with position setting for placement) and of course I spawn the invisible 'Scores' actor to trigger the HIscore arrangement from the final score and save attribute of the all the scores.

    ****
    RESET (optional)

    You may want to have a reset button option to set the scores to 0

    create an actor called 'reset'
    - add display text 'reset'
    -set rule to touch is pressed ( to act a button of course)
    in the rule add in all change attributes for each score like
    game.score1 to 0
    game.score2 to 0
    etc.

    After the above add in all your SAVE attributes to
    game.score1 to Key: HiScore1
    game.score2 to Key: HiScore2
    etc.

    clicking the button will set the scores to 0 and save them

    I place this on Hi Scores scene

    Hope this tutorial is helpful to those who may have gotten a little frustrated.
  • millerbrother1millerbrother1 Member Posts: 108
    Great post, SingleSparq. Only missing 1 thing. How does the user "name" their high score in this example? Somewhat pointless to see the 5 highest scores for a game if you don't know who accomplished them. :-) Awesome explanation thought, very detailed.
  • chicopchicop Member Posts: 263
    I'l be having a go at his soon,

    i do have a question though based on this, could you just make the high score level specific?
    and this score would show up in the level select scene? (so each level has its own score.. when you start a new level level score is at 0, points gained are then tied to the levels high score...)

    what would be the best logical way to go about that based on the above tutorial?
Sign In or Register to comment.