Sorting highscores

Hi there,

Just want to know if there is other smarter way to sorting numbers in GDevelop, I just use the dumbest way…

Any help is welcome and appreciated, thanks in advance!

The easy way would be to wait for the array feature that should be coming, because it will allow such things, I believe.
The clever (harder) way is to figure out the algorithm. :slight_smile:
For that, you must try to express with words the logic of what you’re doing to the list. It should start like:
Let X be a number that will go from 1 to 10.
Check if the score is greater than the score stored in position X of the list. If it is, do this and that.
And at the end, increase X by one and start over (until 10).

Once you have figured out all the details, you will use a repeat loop and structure variables to convert your words into events. :slight_smile:


Hi Gruk,

Thanks for you reply!

As a newbie, I will try my best to understand your words ~ :smile: :smile: :smile:

1 Like

An array feature is arriving? Super!

1 Like

You may try coding the “Bubble Sort” algorithm which is, I believe, the simplest sorting algorithm: Bubble sort - Wikipedia

1 Like

Hi Tarsio,

I’ll try to understand it, thanks! ^^