Saving, What am i missing?

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!
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
(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?
*edit*
As was said above.
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.
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.
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.
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.
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.
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?