Hello fellow Godot Developers,
I would like to inform you that the code provided in the Leaderboards for Godot link on the ScoreSpace Jam #33 page is deprecated, as development mode is a deprecated parameter (see Authentication Request in the LootLocker documentation). In order to get the provided code to work, I had to set var development_mode = false even when in Staging mode. I also had to nest Lines 119 - 122 in a conditional (see below for all changes) because the first time you run the game, no leaderboard will exist and json.get_data().items returns null.
5 var game_API_key = "dev_your-api-key" 6 var development_mode = false 7 var leaderboard_key = "your-games-leaderboard-key" ... 119 if json.get_data().items: 120 for n in json.get_data().items.size(): 121 leaderboardFormatted += str(json.get_data().items[n].rank)+str(". ") 122 leaderboardFormatted += str(json.get_data().items[n].player.id)+str(" - ") 123 leaderboardFormatted += str(json.get_data().items[n].score)+str("\n")
Let me know if you found this helpful.
Happy Jamming,
Ethan