Very simple gamecenter code needed


#1

Hello there!

I want to integrate gamecenter with my app. I only want these functions in:
~~log in the user,
~~submit a score,
-show leaderboard.

I’m searching for a solution for hours now, but I haven’t found any code that I could make work, I just got confused. All of the sample codes consists tons of code, and I just figure out what part should I use, I’m quite a beginner in Objective C.

Since I’m using easyNDK (call native cocos2d functions from cocos2d-x) I only need a very simple native code, what is able to do these things, and a short guide where to put them (I suppose it should be in appcontroller.mm).

I was following this guide [[http://www.raywenderlich.com/3276/how-to-make-a-simple-multiplayer-game-with-game-center-tutorial-part-12]], so I’m able to log in to GC, but it does not cover the leaderboard part.

So please someone provide me a really short and straigthforward guide for this, I’d really appreciate it.

F


#2

Can anyone help me please.


#3

OK I finally found a very easy solution.

[[http://stackoverflow.com/questions/6278085/integrate-gamecenter-in-cocos2d-game/6290129#6290129]]

NOTE: download the files from the github link [[ https://github.com/ablfx/ABGameKitHelper]], don’t care about anything else on the stackoverflow page.

guide:
~~add GameKit framework to your app
~~drag the files in to your ios folder (or wherever you want)
~~enable gamecenter and create a leaderboard on iTunes connect
~~replace the secret key in ABGameKitHelper.h
~~use the ; code in Appcontroller.mm didFinishLaunchingWithOptions
~~the functions are in the readme file in the downloaded packege (from github)

To call these functions from cocos2d-x, integrate EasyNDK with your app. [[https://github.com/aajiwani/EasyNDK-for-cocos2dx]]

I hope it helps other people with the same problem.

F

thanks for the codes for: Alexander Blunck, aajiwani (whoever he is)