Posts

Showing posts with the label example. leaderboard

Construct2 example: Local Leaderboard using array

Image
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: Save new score to variable for further use (in this case  inputScore ) Check if new score is greater than the lowest value in current array => If it is greater, replace lowest value with new score ( inputScore ) 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.