OTHER License
This is a module that integrates Apple's Game Kit API. Currently Leaderboards and Achievements are supported. You don't need to create a way to save scores locally because this module do it for you, and when a internet connection is available, it sends to Game Center server automagically. ;-)
Remember: Logout your regular Game Center account to enable Sandbox mode.
View the Using Titanium Modules document for instructions on getting started with using this module in your application.
Download the compiled release here or install from gitTio
To access this module from JavaScript, you would do the following:
var GameKit = require('com.obigola.gamekit');
Checks if GameKit is available on the current device and connect to Game Center server. Devices must be running iOS 5.0 or later.
Accepts one object with two properties:
callback success: Use it if you want to do something after the player was authenticated. This property is optional.
callback error: Use it if you want to do something after the player cannot be authenticated. This property is optional.
Saves a score for the current user to the specified LeaderBoard
Accepts two arguments:
Shows a particular LeaderBoard to the user.
Accepts a single argument:
Saves a score for the current user to the specified LeaderBoard
Accepts two arguments:
Shows Game Center Achiviements view.
Reset all users achievements from Game Center server.
Accepts one object with four properties:
string identifier: Set which Leaderboard you want to get scores.
int topOf: Set users limit that you want to get from Leaderboard, like "Top 15". It's limited to 100. Default value is 25. This property is optional.
callback success(response): Use it to manage scores.
callback error: Use it if you want to do something after the scores cannot be returned. This property is optional.
See example.
View the change log for this module.