Tutorial Downloads

File Size
parseLeaderB.capx189KB

Translations

Know another language? Translate this tutorial!

Stats

1,334 visitors
7.2K page views

Leader Board tutorial (using rexrainbow Parse plugin)

Favourite 16 favourites
Tutorial written by jomoOriginally published on 10th, May 2015

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.

Share and Copy this Tutorial

You are free to copy, distribute, transmit and adapt this work with correct attribution. Click for more info.

Comments

1
delgado 31.9k rep

great tutorial! but when i try preview i have javascript error
its weird because in whole simple project, object 'Leaderboards' and 'Auth' dont have place to type keys (???)

Wednesday, March 30, 2016 at 8:32:05 PM
0
IGD 210 rep

its possible to send score typing only name ? without email password etc?

Thursday, March 31, 2016 at 10:02:33 PM
0
maxwell88 361 rep

@jomo its possible to send score without registration?
just play and type name to send score?

Saturday, April 02, 2016 at 5:32:39 PM
0
josetovar 522 rep

hello, you can update the tutorial?
partly because no longer accept new registrations of session

Sunday, July 24, 2016 at 8:23:47 PM

Leave a comment

Everyone is welcome to leave their thoughts! Register a new account or login.