Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(+1)

A simple high score screen like the one in my game is not that hard to make. You need to store your score in a variable (and of course increase the value of the variable each time the player catches a present).

To get the value of the variable on the screen (outside of the dialog window) you use actors. You need three actors, one for each digit of your score (assuming your score can be between 0 and 999). The sprite for the actors has 10 frames, one for each number from 0 to 9.

Now you want to dissect your score into its ones, tens and hundreds digits. Therefore you copy your score to three new variables.

To get the hundreds digits just divide the first variable by 100 and then use this variable to set the animation frame of the first actor.

If the your score is greater than 100 you have to divide the second variable by ten and then modulo 10 to get the tens digits. If your score is smaller than 100 you just have to divide the second variable by 10 to get the tens digits. Then use the second variable to set the animation frame of the second actor

 For the ones digits modulo the third variable by 10 and then use it to set the animation frame of the third actor. 

And thats it. You can take a look into my project, just download it from GitHub: https://github.com/inverted-hat/christmasCarols. Its a bit simpler since my high score can't be over 54.

For a high score greater than 255 you have to store your score in a different way, since variables can't be greater than 255. But the display mechanism is the same.  

(+1)

Actors to make the numbers! Brilliant! Thank you for that. I will be able to do allot more going forward with just that bit.