Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Does anyone know how to make a leader board in godot?

A topic by TheOnlyOne created Jan 29, 2022 Views: 199 Replies: 2
Viewing posts 1 to 3
Submitted

I want to make a leaderboard so anyone knows how to?

I'll give an example of a ten place leaderboard.

One way to do it is something like- When the game is played for the first time and the player has ended their run and can no longer increase their score, you create a save file which has ten variables, named like 1, 2 and 3 and etc and their values are 0, and also a variable that is used to tell weather the game is being played for the first time, the value of which can be like 1. 

If its the first play, your code goes like, "if IsFirstGame == 1:", "LeaderBoardPosition1Score = get_node("Player").score". And then, your code would set "IsFirstGame" To 0. Then your game would save the score and take you to the leaderboard scene, where the savefile would be loaded and the values applied to the leaderboard. Then when the game is played for the next time and finished, your code checks if the new score is higher or lower than the previous best score. "If LeaderBoardPosition1Score <=  get_node("Player").score:" "LeaderBoardPosition2Score = LeaderBoardPosition1Score",  "LeaderBoardPosition1Score = get_node("Player").score"and below that-

 "If LeaderBoardPosition1Score >=  get_node("Player").score:" "LeaderBoardPosition2Score = get_node("Player").score"

Atleast i would make a  leaderboard like this. To make my previous "explanation" work. Sorry, my english aint that good. But im sure that you'll need to know how to make a save file. And how to read and write to it. I can give a code example of this if you'd like

Submitted

I know your game is already done and submitted.

But just for future reference, I would HIGHLY recommend you check out Silent Wolf for making a simple online leaderboard.

https://silentwolf.com/

Good luck with the jam!