Game Haxe is supposed to add gamejolt support to any Haxeflixel (and potentially other game engine) project!
This allows you to add trohies in your GameJolt gamepage and award them to the user along with adding scores to leaderboard tables!
make sure you read this
HaxeFlixel along with the addons.
haxelib install flixel
haxelib install flixel-addons
haxelib git gamehaxe https://github.com/MrClogsworthYT/Game-Haxe
you need to place a few things into Project.xml
.
<haxelib name="flixel" />
<haxelib name="flixel-addons" />
add import GameJolt;
at the top of Main.hx
To add your game's keys, you will need to make a file in the source folder named GJKeys.hx (filepath: ../source/GJKeys.hx).
In this file, you will need to add the GJKeys class with two public static variables, id:Int
and key:String
.
package;
class GJKeys
{
public static var id:Int = 0; // Put your game's ID here
public static var key:String = ""; // Put your game's private API key here
}
DO NOT SHARE YOUR GAME'S API KEY! You can add source/GJKeys.hx
to a .gitignore
file to make sure no one grabs the key! If someone gets it, they can send false data!
https://twitter.com/firubiii / https://github.com/firubii
To setup toasts, you will need to do a few things.
Inside the Main class (Main.hx), you need to make a new variable called toastManager.
Main.hx
public static var gjToastManager:GJToastManager;
Inside the setupGame function in the Main class, you will need to create the toastManager.
gjToastManager = new GJToastManager();
addChild(gjToastManager);
TYSM Firubii for your help!
import GameJolt.GameJoltAPI;
GameJoltAPI.connect();
GameJoltAPI.authDaUser(FlxG.save.data.gjUser, FlxG.save.data.gjToken);
Exiting the login menu will throw you back. You can change this in the GameJoltLogin class inside GameJolt.hx.
The session will automatically start on login and will be pinged every 30 seconds. If it isn't pinged within 120 seconds, the session automatically ends from GameJolt's side.
FlxG.switchState(new GameJoltLogin());
GameJoltInfo.changeState:FlxUIState
The state you will call back to after hitting ESCAPE or CONTINUE
GameJoltInfo.font:String
The font used in GameJoltLogin
GameJoltInfo.fontPath:String
The font path used for the notifications
GameJoltInfo.imagePath:String
The file path for the image in the notifications.
GameJoltAPI.checkStatus():Bool
Checking to see if the user has signed in. Returns a
bool
value.true
if signed in,false
if not signed in.
GameJoltAPI.getuserInfo(username):String
Grabs the username and usertoken of the user and returns a
String
.
username:Bool = true
->true
to grab username,false
to grab usertoken.
GameJoltAPI.getTrophy(trophyID);
TrophyID:Int
-> ID of the trophy you want the player to earn.
GameJoltAPI.checkTrophy(trophyID);
Returns a
bool
value of the achieved status.True
for achieved,false
for not achieved.
TrophyID:Int
-> ID of the trophy you want to check.
GameJoltAPI.pullTrophy(trophyID);
Returns a
Map<String,String>
of the trophy called for.
TrophyID:Int
-> ID of the trophy you want to pull.
GameJoltAPI.addScore(score:Int, tableID:Int, ?extraData:String);
Adds a score to a table on GameJolt.
score:Int
-> The score to add. Will also count as the sorting value.
tableID:Int
-> ID of the table.
extraData:String
-> Exta data you want to add. Could be accuracy, who knows.
GameJoltAPI.pullHighScore(tableID:Int)
Pulls the data from the highest score on the table. Will return a
Map<String,String>
value.
tableID:Int
-> ID of the table.
Values returned ->score, sort, user_id, user, extra_data, stored, guest, success