Easily Add Leaderboards to Your Game

2

Index

Stats

12,958 visits, 31,984 views

Tools

Translations

This tutorial hasn't been translated.

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Published on 8 Feb, 2012. Last updated 19 Feb, 2019

Showing Scores

Before we can show scores, we need to load them. This is dead easy (just make sure you use the same leaderboard name that you used when saving!):

As soon as the data has finished loading, we can show it. A couple things to note about this next bit of code:

To access the loaded data, we can use the Playtomic expressions like Playtomic.LeaderboardScoreName(row)

I use 3x System->ForEach loops to go through each row of text

Each piece of text knows which row it is because we saved it in the row variable earlier

The first row in our layout is 1, but in the Playtomic plugin the first row is 0. So when I assign data from Playtomic to the layout, I so it from Playtomic(RowNumber)->Layout(RowNumber-1)

Try it out! If you load the layout now you should see it fill with any scores you uploaded so far.

Now only 1 last thing remains to do... there's no way to exit the leaderboard screen! It's an easy fix. In the game layout, locate where the game is restarted (event row 10). Copy & paste the events into the leaderboard layout. However we need to change it so that it triggers when the player clicks the button, instead of when pressing space (the player could be entering their name when they press space). Here's the tweaked version:

... and that's the end of the tutorial! If you followed all the steps so far correctly, you should have a fully functional leaderboard :)

If you had any problems, you can always check out the Construct 2 project for the tutorial that I made here.

Questions, feedback or suggestions are welcome! Just stop by our blog and leave a comment.

  • 1 Comments

  • Order by
Want to leave a comment? Login or Register an account!