Creating a high score leaderboard

Finishing Touches

As mentioned, I'm only tracking three spots, but you could certainly track more or all of the scores. As long as you record the scores using the logic in my scripts, the values will always be listed from highest to lowest inside the list, and you will not have to do any additional sorting.

As pictured in Figure 1, you'll see additional sprites for Game Over and the Score labels. The code for these sprites is not shown because you simply need to show, hide, and position them.

Happy Scratchin'!

Infos

  1. Scratch code for this article: ftp://ftp.linux-magazine.com/pub/listings/raspberry-pi-geek.com/18
  2. "Scratch – Stamping Numbers" by Michael Badger, Raspberry Pi Geek, issue 17, 2016, pg. 86, http://www.raspberry-pi-geek.com/Archive/2016/17/Custom-stamping-game-scores-with-costume-numbers

The Author

Michael Badger wrote the Scratch 1.4 and 2.0 Beginner's Guide series from Packt Publishing. Learn more at http://scratchguide.com.

Buy Raspberry Pi Geek

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Custom stamping game scores with costume numbers

    Add style to game score displays with stamp blocks and costumes.

  • Using graphical effects to distort a picture

    In this guessing game, graphic effects distort sprite costumes while the player tries to guess the animal shape. The game is creatively scored based on how much the shape is distorted.

  • Creating a multiplayer quick-reaction game

    The quick-reaction game provides an introduction to building simple circuits with the Raspberry Pi and controlling those circuits with ScratchGPIO, an advanced version of Scratch.

  • Power to You

    Small-board computers (SBCs) are getting more and more powerful. The Raspberry Pi 3 (RPi3), which just came out in February of this year, is a case in point. This latest in the Rasp Pi line now has four cores running at 1200MHz with 1GB of RAM and on-board WiFi and Bluetooth. If you need even more power in a small computer, however, you are not left wanting. In this issue, we look at three SBCs with more cores, more memory, more ports, and more possibilities.

  • Synchronizing with broadcasts

    This article draws inspiration from the popular Pokémon Go app to recreate a sprite hunting game in Scratch. The project explores synchronization and randomness as the player explores various backdrops in search of sprites.