Adobe AIR & GameCircle: Enabling Achievements

Introduction

Once you’ve set up your GameCircle Adobe AIR project, you’re ready to add achievements to your game.

Achievements are created in the Mobile Apps GameCircle Developer Console. Then, once you’ve initialized Amazon GameCircle in your game, you can call the GameCircle APIs to interact with your published achievements. This page covers using the GameCircle APIs to:

  • Send an achievement update
  • Add a link to the achievements overlay
  • Get achievement progress for the local player
  • Control placement of achievement toasts

Create and Publish Achievements

Use the GameCircle Developer Console to create and publish achievements for your game. To use the GameCircle Developer Console, you need to create an Amazon developer account. This is a quick sign-in process; you can use your Amazon retail account or set up a new account for the Developer Console. Once in the Developer Console, go to the Apps & Services > GameCircle tab and create a configuration for your game. The configuration workflow includes setting up and publishing achievements. See Creating a GameCircle Configuration for more help, including setting up leaderboards and achievements. You can create up to 100 achievements for each configuration you set up in the Developer Console. For more details on designing and implementing achievements, see Create Achievement Assets.

Send an Achievement Update

When a player earns an achievement, submit the event using the method updateAchievementProgress(). This method takes the achievement ID and the completion percentage (from 0.0-100.0) as parameters.

In response, one of the following events is fired:

  • UpdateAchievementProgressCompleted.ACHIEVEMENT_SUBMITTED
  • UpdateAchievementProgressCompleted.SUBMIT_ACHIEVEMENT_FAILED

Example:

// submit 100% progress to the achievement id "achievement01"
GameCircle.gameCircle.updateAchievementProgress("achievement01",  100.0).addUpdateAchievementProgressListener(
  function(updateAchievementProgressCompleted:UpdateAchievementProgressCompleted):void  {
    trace(updateAchievementProgressCompleted.toString());
});

Your players can view your GameCircle achievements in an in-game overlay. Add a link to it in your game using the method showAchievements() to display the standard achievement overlay.

Example:

// show the achievements overlay
GameCircle.gameCircle.showAchievements();

Get Achievement Data for Your Game

Retrieve your game’s achievement data using the method loadAchievements(). This method returns data on all achievements, as well as whether the local player has unlocked them. This can be useful when creating your own custom achievement views outside of the Amazon Developer Console.

In response to calling this method, one of the following events is fired:

  • LoadAchievementsCompleted .ACHIEVEMENTS_LOADED
  • LoadAchievementsCompleted .LOAD_ACHIEVEMENTS_FAILED

The ACHIEVEMENTS_LOADED event will be populated with an array of GameCircleAchievement objects with the following properties: title, ID, description, point value, progress, position, lock status & unlocked data (if relevant), and hidden status.

Example:

// load all achievements
GameCircle.gameCircle.loadAchievements().addLoadAchievementsListener(
  function(loadAchievementsCompleted:LoadAchievementsCompleted):void  {
    trace(loadAchievementsCompleted.toString());
});

You can get data for a specified achievement, including whether the local player has unlocked it, using loadAchievement().

In response to calling this method, one of the following events is fired:

  • LoadAchievementCompleted .ACHIEVEMENT_LOADED
  • LoadAchievementCompleted .LOAD_ACHIEVEMENT_FAILED

The ACHIEVEMENT_LOADED event will be populated with an array of GameCircleAchievement objects with the following properties: title, ID, description, point value, progress, position, lock status & unlocked data (if relevant), and hidden status.

Example:

// load a single achievement

GameCircle.gameCircle.loadAchievement(achievementId).addLoadAchievementListener(
  function(loadAchievementCompleted:LoadAchievementCompleted):void  {
    trace(loadAchievementCompleted.toString());
});

Control Placement of Achievement Toasts

Control the placement of leaderboard and achievement toasts in your game using the method setPopupLocation(). For more information see Enable Leaderboards: Change Toast Popup Location.