1. Introduction to Variables


(upbeat music)

Hi, and welcome to activity six of Google CS First Sports.

In this activity, you'll build a home run derby style baseball game while you learn about the computer science concept called variables.

Variables in computer science are places to store changing values.

For example, in Scratch a variable can keep track of time or the exposition of a sprite.

Most software uses variables to keep track of information.

StatsHub uses variables to compare athletes from different sports and to compare high school players to pros.

IBM SlamTracker keeps track of statistics that can help players and coaches analyze their performances as well as give viewers real-time insight during a match.

These statistics are stored in variables.

Then used in visually appealing graphics.

Additionally, SportVU and Synergy Sports Technology track players' location using cameras.

Then store this data in variables.

Coaches use data to understand their players strengths and weaknesses to create more successful teams.

For example, variables are used to keep track of how fast a player runs or how many times he or she touches the ball.

This project uses a variable in your baseball game to keep track of a baseball player's batting average.

Once you open the startup project, you'll see some extra sprites.

You only need one pitcher and one coach so pick the ones you like and delete the rest.

Alright, here's the game plan.

Open the starter project by clicking the link and sign in.

Then click remix.

Delete the extra sprites.

Then come back to the CS First page to watch the next video.


Open the starter project.
  • "Wimbeldon Slamtracker" by Wimbeldon (
  • "NBA Player Tracking" by NBA (!/player/)
  • "Statzhub Kurt Kelly Voice Over v5. mov" by KURT KELLY ( -- Licensed by Creative Commons Attribution 3.0 Unported ( -- Video trimmed to needed length, audio removed