3. Pong

Pong

The classic among the classics: the game 'pong'. Click the button below and test the game. Then create your own version of the game.

click here

You learn to:

  • draw your own backdrop
  • make sure your sprite follows the mouse pointer

Register before you start the exercise. Click the button below and sign up.

click here

ORIENTATION

Take a look at the example and consider the following questions:

  • What should I do?
  • What are the goals?
  • What are the expectations?
  • What can I already do?
  • What do I still have to discover?

PREPARATION

View the steps under 'carry out'. Then answer the following questions:

  • Which steps should I follow?
  • Which steps can I follow?
  • How much time do I need?
  • What tools do I need?

Go!

Do the steps one by one. Do you not remember how to do it? View the hints or download the solution.

STEP 1

Remove the cat (= sprite) from the playing field. Right click on the cat and click on delete or the bin.

STEP 2

We shape the empty playing field ourselves. Select the playing field and go to the "Backdrops" tab.

We are going to make a bottom on our playing field and add a catch. After all, we want to make it clear to the computer that the ball must not hit the ground. By giving it a color, we can determine that the game will stop when the ball comes into contact with that color.

Select 'Rectangle' (the bottom) and at the top left select that your rectangle should be completely filled ('Fill'). Which colour? Your favorite color!

STEP 3

Choose a new sprite.

STEP 4

Drag your sprite to the correct height above your ground plane. You do this by clicking on the sprite and then dragging it. The correct height? You determine that yourself!

You can also see the position of your sprite:

 

Now make the code: when the green flag is clicked, the location of the car (only left-right, so coordinate 'x') must be the same as the location of your mouse. This way you can control the car with the mouse. This must be done (repeat) throughout the game.

STEP 5

Now we need to have a ball. Choose one yourself from the 'library'. Do you prefer a melon or a lightning as a ball? It's your game! Make your ball as big or as small as you want. Select the correct sprite (the ball in the example) to write a script for it:

5

It is best to start the ball at a higher place in the playing field, so that you have time to move the car. He must randomly bounce (move) and return when hitting the edge.

Can you express what the block 'move 10 steps' does in this game? What happens if you change 10 to 2?

The x value determines your departure position (in our case: in the middle), the y value determines the departure height. Feel free to play with this.

toelichting

Is your game going too fast or too slow? Then you can increase or decrease the number of steps! You could also add different levels to it: the higher the level, the faster the ball moves!

STEP 6

However, the ball still bounces through your catch ... We urgently need to solve that. Do you know how to do this?

STEP 7

Now we have to stop the game if the player missed the ball and the ball hits the ground (or color 'red'). You probably know which blocks to use for this.

toelichting

To change the color, first click on the colored square in your script and then on the correct color in your playing field.

Now you can try to make your game more fun! For example, add a sound every time your ball hits your other sprite (or every time the ball hits the edge, or every time you start your game, or every time your game stops, ...)

REFLECTION

Look back at the project you just made. Ask yourself the following questions:

  • Does the program work as I expected? Why / why not?
  • What works well?
  • What works less well?
  • How can I approach it differently?

Download

Click on the link below to download a sample solution.

 

Upload the project in the Scratch environment. Click the button below and follow the steps.

Click here