Skip to content

Please update your browser

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

Transcript

This add on will keep score on your game so that each time you complete a pass to a receiver the score will go up.

Click make a variable, name its score, and click OK.

Computers store changing information in variables.

In this case, you are going to put the score in the variable so the computer can keep track of the current score.

Next do two things.

Start the score at Zero and raise the score by one each time a pass is completed.

To do this first click on the ball's brite.

At the top of the code stack just under the win flag click block place set variable two block.

Make sure that score is selected in the drop down then enter zero in the values space.

This will make the score start at zero every time the flag is clicked.

For the second task make the score go up each time one of the receivers touches the ball.

Click on a receiver's brite to see that you've already programmed a conditional that checks if the receiver is touching the football.

Into this conditional place a change variable block.

Make sure that score is selected in the drop down then type one into the value blank if it's not already there.

This conditional reads if the receiver is touching the ball's brite add one to the score.

Great.

But there are three receiver's brites in this example and the score should go up if any one of them has touched.

Add the same change variable block to the script for each receiver's brite in your project.

Finally to see the score check the box next to the score variable in the data menu.

Test it by playing around a bit.

Watch the score go up by one each time you hit a receiver then watch it start over at zero each time you click the flag.

Here's the Game Plan.

Make a variable called score.

Set the score to zero each time the game starts.

Increase the score by one each time any of the receivers touches the ball's brite.

Have fun.

Choose an Add-On
Never Ending Game
Make the receivers disappear and regenerate each time you pass to them.
Passing Back
The ball will always bounce back to the starting position.
Power/Receiver Speed
Add realistic variables with sliders that control the speed of the ball and the receiver sprites.
Keep Score
Count how many passes you complete.
arrow_backward Back
Next arrow_forward
Instructions
  1. Watch the introductory video.
  2. Scroll down to see the add-on choices.
  3. Select an add-on and start creating!
  4. Choose another add-on, and continue building.