Here’s a quick tutorial (before I rush off to work haha) for the basics until Ansca posts something more detailed. Keep in mind I am assuming you have enabled Game Center in ITC and have put up leader boards and achievements.
- Initialize Game Center
local gameNetwork = require("gameNetwork")
--Callback
local function finishAuth(event)
gamenetworkEnabled = event.data
end
function authorize()
gameNetwork.init("gamecenter", finishAuth)
end
- Post a High Score, where board is the leaderboard id, and score is the player’s score
function updateHighScore(board, score)
if gamenetworkEnabled == true then
gameNetwork.request("setHighScore", { localPlayerScore={ value=tonumber(score), category=board }})
end
end
- Unlock an Achievement, where identifier is the achievement id. PAY CLOSE ATTENTION, identifier is spelled wrong (like it is in the daily build notes) in the api.
function unlockAchievement(identifier)
if gamenetworkEnabled == true then
gameNetwork.request("unlockAchievement", { identifer=identifier, percentComplete=100, showsCompletionBanner=true })
end
end
- Basic Leaderboard List (suitable for a button)
function getLeaderboards()
if gamenetworkEnabled == true then
gameNetwork.show("leaderboards")
else
authorize()
end
end
- Basic Achievements List (suitable for a button)
function getAchievements()
if gamenetworkEnabled == true then
gameNetwork.show("achievements")
else
authorize()
end
end
- Basic Friend Request (suitable for a button)
function getFriends(text)
if gamenetworkEnabled == true then
gameNetwork.show("friendRequest", { message=text })
else
authorize()
end
end
function getFriendsBasic()
if gamenetworkEnabled == true then
gameNetwork.show("friendRequest")
else
authorize()
end
end
I hope this tides you all over until official APIs. Yes, there’s plenty of stuff not listed here (such as advanced fetching and level specific leader boards. If no one gets around to it, I’ll post those later.
Good Luck!
(Keep in mind you need build 725 or higher) [import]uid: 36054 topic_id: 20394 reply_id: 320394[/import]
[import]uid: 36054 topic_id: 20394 reply_id: 79726[/import]
) will HELP A LOT!