Skip to content

Achievement

Francisco Dias edited this page Apr 9, 2024 · 3 revisions

Achievement

Functions

This module offers a collection of functions designed to address specific tasks and provide utilities for various purposes. Explore the available functions to make the most of the functionalities provided by this module.

Structs

This module offers a collection of structs, which serve as custom data models for organizing and structuring data. Explore the provided structs to better understand the relationships between data elements and simplify your data manipulation tasks.



Back To Top

GameCenter_Achievement_Report

This function requests the Apple GameCenter API to update the completion percentage of the given achievement. The function will not return any value but it will create a request that will trigger a Social Async Event callback upon completion.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Social Async Event.


Syntax:

GameCenter_Achievement_Report(identifier, percent, showcompletionbanner)
Argument Type Description
identifier String The identifier for the achievement.
percent Real The new completion percentage.
showcompletionbanner Boolean Whether to show the completion banner.

Returns:

N/A


Triggers:

Social Async Event

Key Type Description
type String "GameCenter_Achievement_Report"
success Boolean Whether or not the task succeeded.
achievement_id String The unique name of the achievement.

Example:

GameCenter_Achievement_Report("YYAchievement2", 100, true);



Back To Top

GameCenter_Achievement_ResetAll

This function resets all previously earned/reported achievements. This function is for debug purposes only and should not be used in production, unless specifically required.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Social Async Event.


Syntax:

GameCenter_Achievement_ResetAll()

Returns:

N/A


Triggers:

Social Async Event

Key Type Description
type String "GameCenter_Achievement_ResetAll"
success Boolean Whether or not the task succeeded.

Example:

GameCenter_Achievement_ResetAll();



Back To Top

GameCenter_Achievement_Load

This function will load data from all the achievements the player has progressed on.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Social Async Event.


Syntax:

GameCenter_Achievement_Load()

Returns:

N/A


Triggers:

Social Async Event

Key Type Description
type String "GameCenter_Achievement_Load"
success Boolean Whether or not the task succeeded.
A String JSON formatted string containing an array of AchievementJSON information (can be parsed into a struct using json_parse)

Example:

GameCenter_Achievement_Load();



Back To Top

PlayerJSON

This struct is referenced by the following structs:


Member Type Description
alias String A string the player chooses to identify themself to other players.
displayName String A string to display for the player.
playerID String A unique identifier for a player of the game.


Back To Top

AchievementJSON


Member Type Description
identifier String A string that identifies the current achievement.
percentComplete Real The complete percentage of the achievement.
isComplete Boolean Whether or not the achievement was completed.
showsCompletionBanner Boolean Whether or not the achievement shows a completion banner.
player PlayerJSON A struct containing info on a player
lastReportedDate Date A GameMaker compliant date from when the last report occurred.