From the course: Learning Scratch

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Display a score

Display a score - Scratch Tutorial

From the course: Learning Scratch

Start my 1-month free trial

Display a score

- [Voiceover] To wrap up our game, we're going to keep track of how many apples the player catches and display that information on the screen. Let's head over to the Apple2 sprite. So, what we're going to do here is just, create a variable, that's called Score that's just going to keep track of how many apples were caught. So we go over to Events and then I'll drag out a when green flag clicked. Now, in here we're going to set our score variable to 0. So let's go over to Data and create a score variable. So, we go to make a variable, and this could be For all sprites or For this sprite only. It doesn't really matter. So I'm going to leave For all sprites as the default. So this can be accessible by other sprites if we ever wanted to do that. Now, for our game right now, we're not going to make this accessible by other sprites. But if you ever wanted to remix this, you could do that as well. So I'm going to add the variable named score and then click OK. So there's our score variable…

Contents