Hey there! Back again with another problem. I don't know how to make a scoreboard and have it keep updating itself. I need the scores to be in order of highest to lowest and i need the sprite to announce the highest score and who did it. So basically i need a scoreboard that goes in order from highest to lowest, then at the end of the game, i need the sprite to announce the winner and who it was by.
This is quite a complex requirement.
One method would be to use a two-dimensional list, 1st entry to hold the name of player, 2nd entry to hold their score.
Then each time a player finished, you'd need to insert the new score at the right point in the list
Or you could rearrange them afterwards.
You have a
sort block in the lists library (file menu → libraries → list utilities) that you can use for that purpose
OK. I haven't really experimented with that library yet; I'll give it a go.
I have the library now, but how do I use the sort? It's not an actual block, so I'm confused
(A little new to Snap!)
A library is a set of blocks. You'll find the new sort block somewhere around the bottom of the Variables category
Is it suppose to be a real time scoreboard?
Sorry for the bad wording, I meant that I have the library downloaded, but I am confused on how to use the sort block. If this is the wrong place to ask for help on that please tell me.
Oh I see! Here's a usage example:
Drop your list into the first input slot (the little list icon), and your sorting condition into the second one. It can get more complex and powerful than that, but for most purposes you won't need to know what the grey-shaped input stands for.
Your sorting function needs to have two empty input slots, which will represent every pair of elements in your list.
I hope that makes sense!
You should add a binary sort algorithm to that library.