Unable to save highscore with custom font
Currently right now I don't know what i'm doing wrong, I've looked at different threads and they have successfully got theirs to work. I've also tried doing what they said worked for them but i was unsuccessful. I'm able to make it shows the score, but when i play the game again, the high score isn't saved and just displays zeros instead of actual numbers.
Rule:
If game.Score > game.HighScore change attribute game.Highscore to game.Score
Save game.HighScore as hi
Then on my high score:
Load Attribute from hi , load game.HighScore
For the high score zeros I have:
If game.Score > game.HighScore do constain self.image to floor((game.HighScore%self.div)/(self.div/10))
Any help would be nice. I'll post the file if what i provided isn't enough.
http://www.mediafire.com/download/embhf718bvd6dk9/GB.zip
Comments
The logic you've set up is that if the score is greater than the high score, change the high score to match the score. This part is correct. But then on the high score scene, you're checking to see if the score is greater than the high score. It won't be! Because you've set them to be the same.
Take out the rule condition -- that is, get rid of the rule altogether -- and change the constrains (you don't need to constrain the images on the pause scene) to change attribute behaviors and you should be good. You want to display the high score no matter what the score is, right?
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
You also appear to have a lot of constrain and change attributes in rules with no conditions. Take them out of the rule and delete the rule. You score display actors can be reverted to prototype there is no need for them to be unlocked. Those are a couple of things I noticed.
It might be a good idea to watch some of the tutorial videos to get the hang of how it all works and to make your rules/code efficient. This will save you a lot of headaches and time chasing and fixing bugs.
You can watch the mac vids if you can't find enough windows tutorials, the same principals apply. This is a pretty good resource for mac tutorials on a lot of subjects
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
@tatiang Thanks with the condition part. I couldn't understand the part where you said, change the constrain parts to change attribute. When i did that it wouldn't display the anything only the zeros. But when i changed the rule in the 0 from game.Score to game.HighScore, it would display the high score after all. I don't know if that would affect things in the future but so for it works. Thank you for your help!
@colander Thanks for mentioning the constrain and attributes without conditions. Makes sense that if there isn't a rule to it, then there is no need for it to have a rule. Thanks for the videos and looking over the rules!