Skip to content

Please update your browser

Your browser version is not supported by this site. CS First may not work properly. Learn more

arrow_back Vote on the Talent Show (Advanced)

Transcript

You may have seen talent shows that allow people to vote on a winner.

This screen cast will show you how users can vote for a winner in your talent show by clicking on a button sprite.

But you can use any button sprite you want.

When the user clicks on a button it will instruct the computer to cast a vote for a sprite.

To make that happen, use the when this sprite is clicked event block.

Now, the program needs to keep track of how many votes each sprite receives.

In computer science, an element that keeps track of things such as a score or number of votes is called a variable.

To make a variable in Scratch, choose variable.

Now, choose make a variable.

You need to name your variable using a name that describes it.

This makes it easier for other people to understand your code if you work together on a program.

In this example, the variable keeps track of how many votes the dog gets so it's called dog votes.

Choose a name for your variable that makes sense for your program.

Every time this sprite is clicked, the sprite vote count goes up by one.

To make that happen put the change my block under the when this sprite is clicked block.

In this case, the block is set to dog votes, but George will be set to the variable that you made.

To see what the variable is holding, make sure the check mark next to is checked.

Then, the variable and the number it contains will show up in your program.

Test your code.

When you click on the check mark, the sprite vote should go up by one.

Do the same for the other sprites in your talent show.

Now it's your turn.

Add sprites that work as buttons so that the user can vote for their favorite talent show participant and create a variable of votes for each sprite.

Choose an Add-On
Bust a Move
Learn how to earn the "Bust a Move" badge.
Energy Burst
Learn how to earn the "Energy Burst" badge.
Multiple Musicians
Learn how to earn the "Multiple Musicians" badge.
Clone Crazy
Learn how to earn the "Clone Crazy" badge.
Vote on the Talent Show (Advanced)
Modify your project so you can vote for a talent show contestant.
Win the Show! (Advanced)
Make the winning performer celebrate their victory!
arrow_backward Back
Next arrow_forward
Instructions
  1. See the talent show characters you can build.
  2. Find out what badges you can earn.