How to Create a High Score Screen or Leaderboard in Scatch

Опубликовано: 28 Октябрь 2024
на канале: Learning With Greg
10,753
118

In this programming tutorial, I'll teach you how to build, show, and maintain a leaderboard or high score screen in MIT Scratch by storing high scores to a list. I'll walk you through all the steps including all the code needed to program your scoreboard in scratch including things like:

1) Checking the current player's score against scores in the high score list
2) Figuring out how to insert new scores at the correct position in the list
3) Ensuring the list only holds a certain number of scores

I'll show you how you can maintain related scores and names across multiple lists and then easily combine them into 1 high score display list and then I'll even show you a more complicated way (but one that's reusable and allows you to add more styling) to programmatically build out your own high score display using sprite costumes.

It's a bit of a long tutorial so here are some quick links for easy jumping around:

00:00 Intro
01:06 Brainstorming
03:59 Score Variable
05:36 Tracking Multiple Score and Names with Lists
08:13 The Importance of Indexes (primary keys) in Relational Databases (and Lists)
11:22 Managing Lists with the List Coding Blocks
14:13 Accepting and Using User Input with the Ask/Answer Blocks
15:52 Using a Game Flow Variable
17:23 Adding Comments to your Code
18:08 Using Custom Blocks
18:57 The High Score Code, Part 1: Adding Scores to the Correct Position of the High Score List
24:29 The High Score Code, Part 2: Trimming the High Score List
26:00 The High Score Code, Part 3: Combining Names and Scores into a Display List
27:58 Testing that the High Score Screen is Working
30:57 The More Complicated Sprite Costume Method

Interested in going from a Scratch programming beginner to an expert? Check out my full course, Learn to Code with Greg, https://www.udemy.com/course/learning.... The course takes a step-by-step approach, starting with the fundamentals and then moving on to real world projects that are broken down into simple steps with full-access to all the code and challenge projects along the way.


Some related Scratch programming tutorials:

How to Program a Scoreboard (Score Display) in Scratch:    • How to Program a Scoreboard in Scratch