Construct2 example: Local Leaderboard using array

Friend of mine sent me a question how to create a local leaderboard for Top10 scores/times/results/whatever in Construct 2.

I want to introduce one simple way to implement leaderboard locally (no server required). Solution can be seen in this screenshot:


Brief description of the method used:

  1. Save new score to variable for further use (in this case inputScore)
  2. Check if new score is greater than the lowest value in current array
    => If it is greater, replace lowest value with new score (inputScore)
  3. Sort array contents to descending order using this simple algorithm:
    => Take two consecutive elements from the array, starting from bottom, and compare them
    => If two consecutive elements are not in correct order, swap them

Basically, this is very simple to do if you understand how to access arrays in C2.

Have fun!

-Jussi.

Comments

  1. Please help me more. I'm trying to do a leaderboard but i can't see well your screenshot. Can you send me a best image? Thank u (Leopf81@gmail.com)

    ReplyDelete
  2. Please help me more. I'm trying to do a leaderboard but i can't see well your screenshot. Can you send me a best image? Thank u (Leopf81@gmail.com)

    ReplyDelete

Post a Comment

Popular posts from this blog

Unity3D: Convert Seconds to hh:mm:ss Format

Construct 2: if-then-elseif-else statement

Issue with Unity3D: "Found plugins with same names, and ."