1 of 13

Pong

The original Classic Arcade Game.

2 of 13

There is no cool way to

chase after a bouncing ping-pong ball.

3 of 13

Start a new project. Name your game.

Delete the cat sprite.

Use this sprite: here

Duplicate the sprite, twice. (pongSprite)

After you open the link, click this icon (top-right) to download.

In Scratch, you will need to Choose a Sprite and then upload this file

(the blue cat icon on the bottom right)

4 of 13

Name one sprite → ball

Name the other sprite → paddleOne

Name the third sprite → paddleTwo

NOTE:

Sprite names, Costume names, and variable names, should all start with a lowercase letter.

If a name has more than one word, then the first letter of each subsequent word is capitalised.

This is called camelCase, and it is an Industry accepted standard for naming conventions.

5 of 13

Check

Do you have 3 sprites. Are the named: ball, paddleOne, paddleTwo?

6 of 13

[code]

paddleOne

Note: you do NOT need to type in the “comments” (yellow textbox), these are provided as way of explanation as to the how & why of the code.

7 of 13

[code]

paddleTwo

These differ from paddleOne

Note:

“Comments” for this code can be seen on the previous sprite.

8 of 13

There are two slides for the ball code

You will need to append and/or alter the code as per the directions. (grey text)

The first slide offers the format of the control blocks within the code.

9 of 13

[code]

ball

Randomises the balls starting direction

There are FOUR If-Then conditions within this sprite, they control:

The maximum speed of the ball.

The ball bouncing off either paddle.

PlayerTwo scoring a point.

PlayerOne scoring a point.

The code for each of these is on the next slide, you will need to append this code accordingly.

Be careful and check that each block is NOT inside another.

10 of 13

[code]

ball

This code limits the ballSpeed

This code goes under the IF-THEN (touching paddle), but inside the FOREVER

HINT: If you get stuck, see code working HERE

11 of 13

Can I?

append & alter the ball code to offer a more “real” game experience

12 of 13

A good idea

Save as a Copy, add a “v2” to the name, before continuing

?

13 of 13

[code]

ball

Replace this code with BOTH the options below

You will need to create the

variable: paddleOffsetY (for all sprites)