Get your ID and Private Key
First of all, let's go to GameJolt. I'll assume that you followed the tutorial mentioned before. You don't need to actually upload anything yet, is just for getting the proper Game ID, Trophies ID's and Leaderboards ID.
You will need to write down 2 things to start:
- Your GameID
- Your Private Key
You can find those under Dashboard / Manage / Achievements:
Since Galatic Octopus's capx is really helpful to set it up, we're definitely gonna use it. I would recommend to directly copy everything as it is, and modify only what you need to. It doesn't matter where you put your login box, but remember to include the event sheet that holds the Game Jolt Integration. Let's have a look and I'll try to explain what's happening in there.
First, we need to update the variables called GJGameID and GJKey. Just copy and paste into the initial value field.
Setup your event sheet: Login
We have a mayor group called 'GameJoltLogin'; this is were the authentication process takes places, and verifies the user.
It requires user input of the username and token.
Then, it takes that info and sends it to GameJolt to verify if the user exists and if the token is valid. Again, this is pretty straightforward since the capx is already set for this part, and we don't actually need to change anything.
The two things I added are marked in blue. Basically if the authentication is successful, then set the welcome message and then go the main menu.
I also added the option to play it offline, meaning it won't save the trophies and achievements. Some people likes to force people to login, but I think is good practice to just encourage it. In case they try it and now they want to login, then they have the option to do so.
I did this by adding a global variable called Offline. By default is 0. If the player chooses to go offline, it will be set to 1. Then, on my Menu Event Sheet, I'll state that if offline = 1, set the Login option to 'Visible'.
Also, if you look into the capx, in the bottom you'll find a disabled event "On Start of Layout". Be sure to turn it back on, because that will enable it to retrieve the username and token previously stored using WebStorage.