AlmightyMikkel / Godot-helper

This is to help you use LootLocker in Godot make sure to read the README for how to set it up.
3 stars 0 forks source link

Godot-helper

This is to help you use LootLocker in Godot make sure to read the README for how to set it up.

Notes

This will only work for Godot projects that uses Gdscript!

Installation

Start by installing the ZIP file and extract it. Take the extracted folder LootLockerSDK and drag it into your Godot project.

Initially you may get some errors, to resolve this open Project->Autoload

Here you need to add two scripts.

  1. LootLockerAPI
  2. LootLockerConfig The setup should look as following: image

Finally, we just need to add an api key and game_version.

game_version is a semantic versioning, meaning it should look like 0.0.1

Find the api key here be sure to use the GAME API image If its empty, just create a new and copy it and paste it into the LootLockerAPI.gd script

This is where the information goes: image

Features

Currently I have supported the following features from LootLocker

Guest Session

Currently this is the only authentication method I have implemented as of yet.

var response : GuestSession = await LootLockerAPI._guestLogin()

Player Name

You can get and set the playername by doing the following:

#Get name -
var response : PlayerName = await LootLockerAPI._getPlayerName()

#Set name -
var response : PlayerName = await  LootLockerAPI._setPlayerName("Cool Name!")

Leaderboards

You can Submit a score and get a list of entries:

#Submit score -
var leaderboardResponse : LootLockerLeaderboardSubmit = await  LootLockerAPI._SubmitScore("leaderboard_key", "member_id", score, metadata)

#Submit score to Player leaderboard -
##We're not adding a member_id since the leaderboard is of type Player, it is not needed
var leaderboardResponse : LootLockerLeaderboardSubmit = await  LootLockerAPI._SubmitScore("leaderboard_key", "", 152, "Some interesting metadata")

#Submit score to Generic leaderboard -
##We're adding a member_id as if the leaderboard is of type Generic, it is needed
var leaderboardResponse : LootLockerLeaderboardSubmit = await  LootLockerAPI._SubmitScore("leaderboard_key", "generated_id", 152, "Some interesting metadata")

#List score
var getLeaderboard : LootLockerGetLeaderboard = await LootLockerAPI._ListLeaderboard("leaderboard_key")

Support

You can contact me directly through Discord at AlmigthyMikkel