Implement a Game Center leaderboard (iOS 7)

帅比萌擦擦* 提交于 2019-12-11 10:45:42

问题


I need help with developing Game Center! I found this developer web page http://blog.lucaslouca.com/game-center-leaderboard-ios-7-app/#comment-3761 and need some help with it

Here are my questions!

Hi, my name is David! I have developed game, it is like flappy bird and I need to implement game center! I have MyScene.m and MyScene.h, so I understand steps up to 7, but don't know if I should add those three files to my game I am not experienced game developer and need some help. I have few questions: 1) Do I have to add thee three files to my own game in order for game center to work GameCenterManager.h GameCenterManager.m AppSpecificValues.h? 2) Where exactly I should put this code? " // Dummy Highscore NSUInteger _highscore = 1234;

// Sumbit highScore [_gameCenterManager reportScore: _highscore forLeaderboardID:@"1"]; "

in MyScene.m? if yes can I put it in -(id)initWithSize:(CGSize)size delegate:(id)delegate state:(GameState)state or in -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event (I have created button for game center and called the method in touches began). 3) Where should I put this delegate method - GKGameCenterControllerDelegate (Step 9) in My Scene.m or in View Controller.m? For general info: I have only one UIView Controller in my game which is view controller. the scenes are navigated by "switch" method, each scene is game state something, of example GameStateMainMenue or GameStatePlay and so on. Thank you for your help!


回答1:


To create the necessary code for a leaderboard see here: Game Center in IOS 7 leaderboard

To authenticate the user you need this code:

[[GCHelper sharedGameKitHelper] authenticateLocalPlayer];


来源:https://stackoverflow.com/questions/26226830/implement-a-game-center-leaderboard-ios-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!