-
Notifications
You must be signed in to change notification settings - Fork 0
Introduction
To add the GameJoltAPI node, select "Add Child Node" and add the GameJoltAPI to your main scene or under an Autoload scene (if you have multiple scenes).
You should only have one GameJoltAPI node per game.
Next, you have two options depending on whether your game is open-source.
Option A (closed-source): Set the export variables private_key and game_id to your game's private key and game ID.
Option B (open-source): Create a JSON file in your Resources with the contents:
{
"private_key": "<your_private_key>",
"game_id": "<your_game_id>"
}and set the export variable key_path to that JSON file's path, such as "res://gamejolt.json".
This is useful for open-source projects that you still want to have GameJolt API functionality, as you can now add that file to your repository's .gitignore and it won't be as easy for people to snatch your private key.
You can also, optionally, add a "trophy_ids" Array as a key:
{
"private_key": "<your_private_key>",
"game_id": "<your_game_id>",
"trophy_ids": [123456, 789012]
}Which will be loaded into trophy_ids during runtime.
Now you can call GameJoltAPI methods through a parent node or an extended script!