Adding Game Center

@TechDojo I think that I uncommented the register function since

gamecenter.enabled 

doesn’t error out.

So I need to follow those steps on the other thread in order to access game center?

I take it that submitScore() doesn’t error, if so check to see if the showLeaderboard entry is listed correctly in the function mapping table.

@TechDojo Actually, submitScrore() does error.

@Goatboy76, are you using my fixed version of the Game Center Add On? You can’t get it on the addons repository, but get it from here if you aren’t.

The bug seems to only affect physics, but it could be a factor in your errors. (Plus replacing the files should fix any other problems lying in them)

@JakAttak I was getting a weird error when with physics contact. Your code fixed it, thanks!

It seems that my Game Center problem still persist tho.

@JakAttak Now, with your game center add on code, it errors out at when I try to get gamecenter.enabled while that worked before.

The leader boards should work in beta testing and not only when the app is published correct?

@Goatboy76, Simeon updated his addon to fix the physics bug, grab the latest from the github repository.

Leaderboards will work during beta testing if you are in sandbox mode.

@JakAttak I quickly tested the game center addon from git hub but the physics bug still persisted, it was probley user error tho. The syntax for the gamecenter calls also changed which was odd. What do you know about sandbox mode? I’ll test that out. Thanks.

@Goatboy76, odd. He said it was fixed. Feel free to keel using mine, there is no other difference, and enabled should be available under mine as gamecenter_enabled (_ instead of .)

From what I recall, pre iOS 8 sandbox mode enabled itself when running a beta app. However, in iOS 8, you have to go into the settings app and enable it yourself. (Settings > Game Center > Developer > Sandbox)

@JakAttak I’ll try the git hub addon again, I’m using yours right now. It asks to sign into Game Center (because of sandbox mode) when you start up the app for the first time and gamecenter_enabled calls fine without arguments but when I call gamecenter_showLeaderboard(), it says its a nil value :frowning:

@Goatboy76, should be Leaderboards, plural. gamecenter_showLeaderboards()

@JakAttak :open_mouth: … thats probley it.

@JakAttak In your code, the comments say the syntax is gamecenter_showLeaderboard(), nonpluar. You should probably change that. Thanks for the help, it works now.

Hmm… I’m using something like this-
if gamecenter_enabled() then
print(“Score Saved”)
end
just to test, and I’m getting nothing. What’s wrong?

@LaserGate_coder Are you doing this in a exported project? Try checking your AppDelegate.mm file to see if you’ve uncommented the line that it says to in order to have Game Center.

Well, stupid me, figured that one out pretty quick- gamecenter_enabled, not gamecenter_enabled(). Now I’m trying to gamecenter_saveScore(High, “lasergatehigh”), but when I check game center it tells me I’m unranked for my app. I’m not sure if this is an issue or not, honestly. Should I be ranked, or will it not save in the simulator?

@Goatboy76 Yes it is an exported project but yes I uncommented that line, and I replaced my files with the ones from @JakAttak

@Goatboy76, sorry about that, I missed it when writing them.

@LaserGate_coder You’d need to submit a score in order to get a rank. I dont think your gamecenter rank means anything out side of the simulation. I think it should have saved your rank the next time you open that project in the simular.

@JakAttak No prob