Leader Board tutorial (using rexrainbow Parse plugin)

2

Index

Attached Files

The following files have been attached to this tutorial:

.capx

parseleaderb.capx

Download now 189.26 KB

Stats

6,408 visits, 11,370 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 10 May, 2015. Last updated 19 Feb, 2019

In the previous tutorial we set up a backend player info database using Parse by rexrainbow's Parse plugins. In this tutorial we are going to build a leader board based on our previous work. Please make sure you've finished the last tutorial.

Step 1. Add new leader board layout and event sheet

-------------------------------------------------------------------------------

Open the previous project (parseLogin.capx) and add one new layout (<leaderBoard>) with event sheet (<e_leaderBoard>). Change to <leaderBoard> and add new objects like below:

Please refer to the attached .capx for detailed settings.

Now here comes an important part: You have to set your Parse app id and JS key for [LeaderBoard] object. You can connect to your Parse account and find these two values under <Settings> -> <Keys>.

Now our <LeaderBoard> layout is ready. Next we will go back to our platform game and add some game mechanism for player to get score.

Step 2. Add scoring mechanism

-----------------------------------------------

Change to <layout 1>, and use <Sprite> plugin to add [coin] object class. In the image editor, draw a yellow circle freely to make it like a coin. And then place several instances around the layout.

Now add corresponding events to count scores:

Event#8 works when user drops off screen. When it happens we go to <leaderBoard> layout to show leader board.

Between event#8 & 9 there is a declaration of a global number variable called score. We will use this variable to store player score.

Event#9 initiates the value of score to be 0 on start of layout.

Event#10 triggers when player touches coin. When it happens we add 100 points to score, and destroy the coin instance (to speed up testing, we disable destroy action temporarily).

Event#11 shows player score on UI screen (a.k.a HUD, head up display).

Change the <First layout> project parameter to be <login>. Then push <F4> to run from the first layout. Login into our platform game and control your player to get coins. You can see the score value changes on UI screen.

But when you drop off screen, there will be nothing shown on leader board. This is because we haven't write any event or action for it. Now let's do it.

  • 0 Comments

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