Quantcast
Channel: GameSalad 101 — GameSalad Forums
Viewing all articles
Browse latest Browse all 8931

High score works intermittently and sometimes creates random numbers

$
0
0

Hello,

I have two attributes, both are INDEX (so they can't go into negative numbers)
1. game score
2. high score

At the end of my game (when lives=0) a pause scene is activated for "game over"
On this game over scene, I have the following codes on an actor to determine the high score and display it:

When "game.game score" > "game.high score"
Change attribute "game.high score" to "game.game score"
Save attribute "game.high score" to key: "highscore"

Then I use a display text to actually display the high score.

On my game's main menu (first scene when restarting), I have an actor with:
Load key: "highscore" attribute: "game.high score"

As far as I am able to find online, this code should work, however I am finding that it only works sometimes. Other times, it either doesn't keep the most recent score, or it chooses a completely random number to display as the high score - I'm not even sure how it has come to the random number.

Can anyone shed some light or provide a different code to achieve this please?
I have triple checked that my code is EXACTLY what I have written above.

I have also already tried achieving the same result using a table, however that froze my entire game. I have posted about that separately because I'm trialing some different options to fix my overall problem and don't want to confuse.

Thanks for any help.


Viewing all articles
Browse latest Browse all 8931

Latest Images

Trending Articles



Latest Images