We have released a score and achievements API for HMTL5 / JavaScript game developers. It allows you to make your games fully compatible with MyArcade scores, achievements, and contest features. With this simple to use API, you can submit scores, medals or achievements to user sites. This will make your games more attractive to players.

The integration of the API is very simple. You only need to include one JavaScript file into your game and then you will have access to score and achievement submissions functions:  “myarcade_submit_score” and “myarcade_submit_achievement”. You can call the score submission function at the place where you want to submit user scores, e.g. at the game over. The achievement function can be called for example after each level or if the user unlocks something special in your game.

The Scores and Achievements API has been released as open-source on GitHub. You are free to use it and to integrate it with your games.

How to use MyArcadeScoreBridge in your HTML5 / JS games?

There are only two simple steps to follow in order to make your game score and leader board ready.

Download our Scores and Achievements API for HTML5 games from our GitHub page: MyArcadeScoresBridge.

Step 1

Import ‘myarcadebridge.js’ into your game. You can do this in two ways:

Option 1

Import the JavaScript file directly in your index.html.

<script src="myarcadebridge.js"></script>

Option 2

Additionally, you could load the file dynamically.

var js = document.createElement('script');
js.type = 'text/javascript';
js.src = 'myarcadebridge.js';
document.body.appendChild(js);

Step 2

Now, you are ready to submit scores and achievements to user sites. The bridge offers you the functions myarcade_submit_score and myarcade_submit_achievement.

Submitting scores

Many games submit achieved scores on game over but some of them offer a button to submit scores. You can use any method you like in your game. Just make sure that the scores are submitted only once.

To submit scores just call myarcade_submit_score and pass the achieved score to the function.

myarcade_submit_score( score );

Submitting medals or achievements

In some games users are able to gain medals or achievements while playing. With MyArcadeScoreBridge you can submit achievements at any during the game play. Therefor use the function myarcade_submit_achievement.

In order to submit a medal or achievement you will need to create an achievement object. The object should contain following fields:

  • title: Achievement/Medal title
  • description: A detailed description of this achievement
  • score: Score associated with this achievement
  • icon: An URL to a badge, trophy for this achievement
Example
var achievement = {
 title: "Your achievement title",
 description: "Achievement description.",
 score: score,
 icon: "https://site.com/trophy.png"
};

myarcade_submit_achievement( achievement );

How to tell users that your game is compatible with MyArcadePlugin?

In the assets/images folder, you’ll find two MyArcadePlugin logos which you can embed in your games.