#14 | 31-07-24 | High Score
Hello!
Today's task is to build the saving high score feature. This'll allow the highest score of any game played to be saved and displayed on the main menu.
To create the saving system, I used PlayerPrefs, which is a simple built-in way to save data in Unity. I modified the TimeCounter script to save the score after the counter reaches zero.
I created a script called "LoadScore" to handle loading and displaying the current highest score on the main menu. The script is attached to a game object called "Menu Manager" which will hold other scripts that need to be run while the scene is active.
Loading and display the score was simple enough. I used a local float and a logic check to set the highest score and displayed it using TextMesh Pro. I also created a function to handle resetting the current highest score by pressing the "R" key.
Here's a video to demonstrate the code in use:
That's another feature finished. Next up will be creating a combos mechanic, multiple different targets and revamping the shooting system.
Thanks for reading!
Get Hit That Target!
Hit That Target!
Top down 2D target shooter!
Status | Released |
Author | Ice Diamond Studio |
More posts
- #21 | 11-08-24 | PostmortemAug 12, 2024
- #20 | 11-08-24 | Project EndAug 12, 2024
- #19 | 11-08-24 | Planner & GDDAug 12, 2024
- #18 | 06-08-24 | Beta BuildAug 06, 2024
- #17 | 06-08-24 | Improved GraphicsAug 06, 2024
- #16 | 05-08-24 | Extra ScenesAug 05, 2024
- #15 | 05-08-24 | Multiple TargetsAug 05, 2024
- #13 | 29-07-24 | Planner & GDDJul 30, 2024
- #12 | 28-07-24 | Alpha BuildJul 28, 2024
Leave a comment
Log in with itch.io to leave a comment.