Best Score With Custom Font

Hi guys and girls,

I have been following the brilliant video tutorials by Tshirtbooth on YouTube and I have successfully set up a scoring system using .png images as a custom font.

However, I am having some real difficulty also setting up my 'Best Score' to use a custom font. Every time I play the game my 'Best Score' is identical to the current score.

I created a new integer attribute for 'Best Score'. Then I've copied a version of the score png and I modified the constrain attribute to self.Image to floor(( game.Best Score % self.Divider )/( self.Divider /10))..".png"

Then I created the rule that says when game.Score > game.Best Score .... Change attribute game.Best Score to game.Score.

Is anyone able to advise what I may be doing wrong?

Thanks in advance

N

Comments

  • ArmellineArmelline Member, PRO Posts: 5,369

    If the best score works initially, but is reset to game.Score when you restart the game, you probably want to check that you are saving and loading game.Best Score correctly.

  • NattyBitsNattyBits Member, PRO Posts: 18

    Yep, that's what it seems like is happening. Is there a best way to check that?

    I'm not using a Save Attribute yet because my understanding is that only applies when exiting and re-entering the game rather than just resetting the game, correct?

    Thanks
    N

  • ArmellineArmelline Member, PRO Posts: 5,369

    Any time you update the high score you should save it using a Save Attribute. If you aren't saving it, that'll definitely be your problem.

    If it's a game attribute and you reset the scene, it should persist, but if you reset the game it'll be set back to the default value - unless you load a previously saved one. Resetting the game is like quitting it entirely and then relaunching it.

  • NattyBitsNattyBits Member, PRO Posts: 18

    Ok I think I'm with you and that could be my problem.

    In my game what happens is that I keep a regular score on one scene (the gameplay scene if you like) then when the character dies it moves over to an 'End Scene' and it is here that I display the high score along with the current score.

    So, do you think that I should use a Save Attribute on this high score and then a Load Attribute on the gameplay scene so that when I return to End Scene once more the high score is preserved?

    Thanks for your help so far!

  • NattyBitsNattyBits Member, PRO Posts: 18

    Also I'm just thinking... I'm using the same images for current score and best score. To create best score I copied the current score actor. Would the fact that they're both calling upon the same set of images make a difference?

  • UtopianGamesUtopianGames Member Posts: 5,692
    edited September 2014

    Have you tried checking out our free templates on DBA we have a few with top score using custom fonts.

    Darren.

  • NattyBitsNattyBits Member, PRO Posts: 18

    OK, so I managed to fix this issue. Instead of displaying the High Score on a new 'End Scene' I simply set it up so that the High Score displayed on the same scene that the actual scoring was taking place.

    I used a Save Attribute to save the high score and also loaded it back into the same scene in a different actor.

    Glad I got this all sorted as this was the only thing holding my app back from being published!

Sign In or Register to comment.