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 High Score!

Choose an Add-On
play_circle_filled
Play a Sound if Caught
Add a sound to your game and program your project to play that sound.
arrow_forward
play_circle_filled
Play Your Game with a Friend
Program one sprite to be controlled by another player.
arrow_forward
play_circle_filled
Change Up the Player
Change up your player's costume whenever it touches another sprite.
arrow_forward
play_circle_filled
Speed Up the Chase
Make the game harder by making the chasers faster.
arrow_forward
play_circle_filled
High Score!
Create a new variable that stores the game's current high score.
arrow_forward
  • 1. Escape Games and Randomness
  • 2. The Chase Is On!
  • 3. Programming the Player Sprite
  • 4. Keeping Score
  • 5. Add-Ons
  • 6. Reflection
  • 7. Wrap-up: Escape Game
  • 8. Wrap-up: Share Your Project
  • 9. Wrap-up: Show Your Project
arrow_backward Back Next arrow_forward
Transcript

In this game, the player scores more points the longer they avoid the chasers. In this screencast, you’ll learn how to store a high score in a variable, then you’ll try the programming on your own.

To begin, select a chaser, click on the data menu, and select “make a variable”.

Computer scientists often work together on the same project, so it’s important to use names that would be easy for anyone who looks at the code on your project to understand.

This variable will hold the score, so name it something logical like, “High Score” or “Best Time.”

Now that you’ve created a place to store the high score, you need to program the computer to change it when a new high score is set. You will do this by adding an if statement.

Your if statement should read: When the player gets caught, To program this, drag another if statement into the “if touching player” block.

This should read, “if timer is greater than high score,” so click the operators menu and select a “greater than” operator.

Then, add a “timer” variable from sensing and a “high score” variable from data.

Now, you need to set the high score to equal the timer. Add a “set high score to” block, then add the timer here.

Now, when the player’s score is displayed, the computer will check if the timer is greater than the high score. If it is, the value in the timer will become the new high score.

Now, it’s your turn! Once you’ve finished programming, set your own high score, then challenge a neighbor to beat it.

Instructions
  1. Choose an Add-On, and click "watch" to learn how to build it.
  2. Once you finish one Add-On, try another one below the video!