Scratch Game
Beginner
60 mins
170 points
What you need:
Computer/laptop

In this lesson you will program a game called Paddle Ball! You will learn about moving sprites, backdrops and using sensing blocks.

Learning Goals Learning Outcomes

### 1 - Create a new Scratch project

Create a new Scratch project and delete the cat sprite that's added by default.

Drag the paddle to near the bottom of the stage area (by holding down the left mouse button and moving your mouse). Make sure to leave some space between the bottom of the stage area and the paddle (this is important later on as we'll be putting something there).

### 3 - Add the football sprite

Add the sprite called 'Soccer Ball' from the sprite library.

### 4 - Position the ball

At the game's beginning, the ball should be at the top center, set by its X and Y coordinates.

X and Y coordinates pinpoint a location on the screen. X is vertical (left-right), while Y is horizontal (up-down). The screen's center is `X:0 Y:0`. Moving right increases X, left decreases it. Moving up increases Y, down decreases it.

To position the ball at the top center (`X:0 Y:170`), add the following code to the ball sprite:

``` when green flag clicked go to x [0] y [170] ```

Once you've added this code and entered the correct X and Y coordinates, click on the green flag at the top right of your screen to run the code. Your ball should go to the top center of your screen.

### 5 - Make the ball bounce around

Now that we have the ball in the correct position for the start of the game, we want to make the ball start moving around the screen and bouncing of the edge of the screen when it touches it.

First we point the ball in a downwards diagonal direction and then we get it to continually move, if it touches the edge of the screen we want it to bounce. Add the following code underneath the go to x: 0 y: 170 block:

``` when green flag clicked go to x [0] y [170] // insert new code under here point in direction [120] forever move [10] steps if on edge bounce end ```

Run your code by clicking the green flag. The ball should start bouncing around the screen!

# Unlock the Full Learning Experience

Get ready to embark on an incredible learning journey! Get access to this lesson and hundreds more in our courses spanning 7 essential digital skills.