Build 10 games and learn game development along the way in this fast paced game development course

Get the source code of 12 commercial games, loaded 50+ million times, and learn the secrets of game design

Learn how to make a successful Flash game from a real world example. Fully commented source code

Create realistic Flash physics games from scratch with advanced features, from Angry Birds to Crush the Castle

How to create a leaderboard in your Flash game with Scoreoid

Some days ago I showed you how to save and show the best score in your game with Scoreoid.

Now it’s time to make something more interesting, such as a top 5 leaderboard. If you followed the first step, you should know one of the best Scoreid features is there isn’t any SDK since the Scoreoid Open Web API is based on the standard RESTful HTTP/HTTPS protocol.

Anyway, this is the new version of the game, with the top 5 at the bottom right of the stage:

You know how to play: mouse button to turn on engines, avoid the squares, collect the circles and travel as far as you can. Notice the leaderboard in the bottom right corner.

I just created another sprite called Leaderboard with a dynamic text in it, and made some changes to the main class. In the script, I highlighted the changes from the previous version.

As you can see, it’s just a matter of using getScores() method to retrieve a number (requestVars.limit) of game scores ordered by a desired way (requestVars.order_by) in a particular order (requestVars.order).

You will get an XML like this one:

Which is pretty easy to parse by loaderCompleteHandler function. Refer to understanding AS3 and XML if you don’t know how to parse XML.

And that’s another great Scoreoid feature unveiled, next time I am going to show you even more.

No need to download anything, just copy/paste this code in the file you can get from the original prototype, just remember to use your own game id and api key.

Rate this post: 1 Star2 Stars3 Stars4 Stars5 Stars (6 votes, average: 4.33 out of 5)
Loading...Loading...
Learn how to make a successful commercial Flash game from a real world example: get the fully commented source code of Globez, a Flash game played millions of times which generated a four figure income. Limited copies available.

Get it now
Be my fan on Facebook and follow me on Twitter! Exclusive content for my Facebook fans and Twitter followers

This post has 4 comments

  1. faisal

    on June 14, 2013 at 8:29 am

    Is there any function to remove scores of any specific player ?

  2. Luis Gallego

    on June 14, 2013 at 5:44 pm

    Damn!, that is addictive…

  3. Luis Gallego

    on June 14, 2013 at 5:54 pm

    I just think that would look better if the font were like neon.

  4. Ozgur SEVIK

    on June 30, 2013 at 10:50 pm

    how to add ad-mob advertise?

Thank you for the download!!

I hope you will find it useful and make something interesting out of it

To keep up to date with the blog, why don't you like my Facebook page and follow me on Twitter?

Want to learn more? Don't miss this:

Learn how to make a successful commercial Flash game from a real world example: get the fully commented source code of Globez, a Flash game played millions of times which generated a four figure income. Limited copies available.

Get it now

×