Game Center Tutorial?

Hi All–

I came across this Google Play Game Services article, https://coronalabs.com/blog/2013/06/25/tutorial-introducing-google-play-game-services/, however have been unable to find a tutorial like this regarding Apple’s Game Center Leaderboards.  I have been searching for a while, and it seems like there are little amounts of tutorials regarding this.  Is there anything around here that lays out GameCenter leaderboards that I am missing?

Thanks.

Hi @hi1,

In regards to coding this in Corona, I think a decent starting point is to inspect our sample project. The “leaderboards.lua” file within shows a reasonably basic setup of leaderboards, event handlers, etc.

The project is located in your local Corona application folder:

CoronaSDK-XXXX > SampleCode > GameNetwork > GameCenter

Hope this helps,

Brent

Hi,

Thank you for showing me that, I never knew all those resources were included.

As I was looking through the file, I noticed that it references “composer.” a lot in the lines.  I do not use the composer in my game, so what would I use as a replacement to this?

Thanks.

Hi @hi1,

Composer is used as the sample’s “scene manager,” and in many cases, for the storing/saving of various “global” variables. If you don’t want to use Composer, you can localize and store/save those variables directly in “main.lua” or in another way.

Although you’re not using Composer now, if your game will use any kind of scene flow (i.e. more than one screen), you should consider implementing it. Of course you’re not required to, and you can roll out your own scene management system, but most games need some type of scene management system since the flow rarely can exist in one file/module.

Best regards,

Brent

Hi @hi1,

In regards to coding this in Corona, I think a decent starting point is to inspect our sample project. The “leaderboards.lua” file within shows a reasonably basic setup of leaderboards, event handlers, etc.

The project is located in your local Corona application folder:

CoronaSDK-XXXX > SampleCode > GameNetwork > GameCenter

Hope this helps,

Brent

Hi,

Thank you for showing me that, I never knew all those resources were included.

As I was looking through the file, I noticed that it references “composer.” a lot in the lines.  I do not use the composer in my game, so what would I use as a replacement to this?

Thanks.

Hi @hi1,

Composer is used as the sample’s “scene manager,” and in many cases, for the storing/saving of various “global” variables. If you don’t want to use Composer, you can localize and store/save those variables directly in “main.lua” or in another way.

Although you’re not using Composer now, if your game will use any kind of scene flow (i.e. more than one screen), you should consider implementing it. Of course you’re not required to, and you can roll out your own scene management system, but most games need some type of scene management system since the flow rarely can exist in one file/module.

Best regards,

Brent