How do i save a high score?

So i'm having a bit of trouble with my highscore being displayed.
At the moment i have 2 scenes one being the main game scene and one is the menu scene. The game basically involves you getting a point every time an actor hits another actor (match the colors), and so what i basically did was create a rule that says when attribute game.score is > game.highscore, change attribute game.highscore to game.score, and than i have it save highscore attribute and load attribute, but the problem is when ever i restart the game the highscore is being displayed but when you start to get points again the highscore turns into the normal score even if it isn't higher. It is being displayed fine on the menu page but it keeps resetting during the game as if the highscore is loading the game.score no matter what.

Sorry my explanation is a bit ruff but if anyone could help me it would be much appreciated thx.

Answers

  • WhitePantherWhitePanther Member Posts: 72

    delete the load attribute from the game scene and insert load attributes on an actor in menu scene.

  • Game ChefGame Chef Member Posts: 20

    I did that and it was working fine but now the highscore on the menu page changes to water your previous score was even if it wasn't higher??

  • NNterprisesNNterprises Member, PRO Posts: 387

    I wish I had things in front of me to check, but I'm sure I'll get corrected by someone if I'm wrong:

    First I would change everything to tables (tables have better performance and save and load easily).

    1.Create table X
    2. Score will be in 1,1 and High will be in 2,1
    3. When actor hits another actor, change table value , X, 1, 1 to tablecellvalue(X,1,1)+1
    4. When Numeric Expression tablecellvalue(X,1,1) > tablecellvalue(X,2,1), Loop : Change table value X, 2, 1 to tablecellvalue(X,1,1)
    5. When you die, Save table X
    6. Display tablecellvalue(X,2,1) wherever you want your high score displayed

    The Score (X,1,1) can just be an attribute also, but the high score may be easier to save in a table

Sign In or Register to comment.