Book Image

Game Development with Swift

By : Stephen Haney
Book Image

Game Development with Swift

By: Stephen Haney

Overview of this book

Table of Contents (18 chapters)
Game Development with Swift
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Adding a leaderboard of high scores


We will submit the player's scores to the Game Center servers every time they finish a game. The first step is to register a new leaderboard on iTunes Connect.

Creating a new leaderboard in iTunes Connect

First, we will create our leaderboard in iTunes Connect. We can then connect to this leaderboard from our code and send new scores. Follow these steps to create the leaderboard record in iTunes Connect:

  1. Log back in to iTunes Connect and navigate into the Game Center page for your app.

  2. Locate and click the button that says Add Leaderboard.

  3. The next page asks you what type of leaderboard you want to create. Choose Single Leaderboard.

  4. Fill out the information for your leaderboard. You can reference my example here:

    Let's take a look at each field:

    • Reference Name is an internal use name for leaderboard listings in iTunes Connect

    • Leaderboard ID is a unique identifier we will reference from our code

    • Score Format Type describes the type of data you will be passing...