Construct 3 icon

Construct 3

Documentation

Game Center

Published 24 Aug, 2017
593 words
~2-4 mins

The Game Center plugin allows access to Game Center on iOS.

Setting up

To set up your game for Game Center, it must be appropriately configured on the iTunes store. Please follow Apple's Game Center configuration guide for more information.

Before your game can use any Game Center features, you must use the Authenticate action. This can be done on Start of layout or when pressing an in-game Login button. The user will either be prompted to log in or be automatically re-authorised.

Be warned that if you fail Game Center authorisation too many times your device may be blocked from accessing it. To help avoid this while testing, go in to Settings on your iOS device and make sure Game Center is enabled and signed in from there. It should automatically pick up your account when using the Authenticate action.

Game Center properties

The Game Center object has no properties.

Game Center conditions

On achievement list error

On achievement list received

Triggered after the Request achievements action, depending on whether an error occurred or it completed successfully.

On achievement report error

On achievement report success

Triggered after the Report achievement action, depending on whether an error occurred or it completed successfully.

On achievement reset error

On achievement reset success

Triggered after the Reset achievements action, depending on whether an error occurred or it completed successfully.

On auth fail

On auth success

Triggered after the Authenticate action depending on whether login was successful or not. On auth success must trigger before any other Game Center features can be used.

On player image fail

On player image success

Triggered after the Request player image action depending on whether an error occurred or it completed successfully.

On leaderboard displayed

On leaderboard error

Triggered after the Show leaderboard action depending on whether the leaderboard could be successfully displayed or not.

On score submit fail

On score submit success

Triggered after the Submit score action depending on whether the submission was successful or not.

Game Center actions

Report achievement

Report that the player has gained an achievement, or increased its percentage completion, by its achievement ID. Afterwards, On achievement report error/success triggers depending on success.

Request achievements

Request a list of available and completed achievements. Afterwards, On achievement list error/success triggers depending on success.

Reset achievements

Reset all the player's achievements and scores to their default states. Afterwards, On achievement reset error/success triggers depending on success.

Authenticate

Prompt the player to log in to Game Center, or automatically log them in again. This must be done before any Game Center features can be used. Afterwards, On auth fail/success triggers depending on success.

Request player image

Request a URL to the current player's image. Afterwards, On player image fail/success triggers depending on success.

Show leaderboard

Display top scores on a leaderboard by its ID. If you want to display a list of leaderboards use a blank string as the ID ( "" ).On leaderboard displayed/error triggers depending on success.

Submit score

Submit a score to a leaderboard. On score submit fail/success triggers depending on success.

Game Center expressions

AchievementCount

After On achievement list received, the number of achievements in the list.

AchievementAt(index)

After On achievement list received, the zero-based index of the achievement to retrieve.

PlayerID

UserAlias

UserDisplayName

After On auth success, the details about the current player.

PlayerImageURL

After On player image received, the URL to the image for the current player. This can be loaded in to a Sprite object using the Load image from URL action.

All Contributors

  • Ashley's avatar
    Ashley
    Last edited 24 Aug, 2017
    ~4,643 chars in 1 edits
  • Nepeo's avatar
    Nepeo
    Last edited 12 Apr, 2018
    ~164 chars in 1 edits