Skip to content

Please update your browser

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


In the previous video, you should have added sprite to the starter project.

If you haven't done this yet, please pause this video and do so now.

In this video, you'll program the player sprite to launch or repeatedly move forward when the space bar is pressed.

First, program the sprite to move when the user presses the space bar.

From events, add a one space key pressed block, and for motion, add a move block.

Click the code to test.

Good, but the sprite should launch when the space key is pressed.

Meaning it will keep moving forward without stopping.

Program the sprite to move forward until it reaches the finish line.

From control, place a repeat until block around the move block.

The sprite should repeat moving forward until it touches the finish line.

Click the sensing menu and drag out a touching block and put into the repeat until block, and change the value to finish line.

Test your code.

The sprite moves forward and stops once it reaches the finish line.


Next, program the game to restart.

Drag the sprite to where you want it to start when the program begins.

Then, click the motion menu and add a go to block below the repeat until block.

Now, when you press the space bar, the sprite moves forward until it reaches the finish line.

Then it goes back to the start.

In our next video, you'll program the sprite to turn left and right with the arrow keys.

Now it's your turn.

Move the sprite forward when the space key is pressed.

Program the sprite to move forward until it touches the finish line with a repeat until in a touching finish line block.

Then set the starting position using a go to block.

  1. Select a Player 1 sprite and create an event that will happen when the spacebar is pressed.
  2. Add a "move" block to make the sprite move forward.
  3. Add a "repeat until" block to the stack.
  4. Add a "touching Finishline" block as a condition.
  5. Set a starting position for your sprite with a "go-to" block.