Instructions

The game
09pong
and the Scratch scripts for the ball
In this game, you try to beat a ball that is flying through the room back with a paddle. When the ball touches the coloured line, a point will be
deducted from the payer, and the ball will restart in the middle. The paddle is moved up and down with two sensor contacts. The LEDs signal
contact of the sensors.
The programme for the ball
The two objects in the game, the ball and the paddle, each have dedicated Scratch scripts, all of which start when clicking the green vane.
At the beginning of the game, the ball is set to the middle of the stage and the points counter is set to 0. The ball starts in a random direction
between –20 and –160 degrees. Then it will fly in an endless loop and only change direction when it bounces off of the edge.
This script controls the ball movement when the paddle is touched.
When the ball touches the paddle, the movement direction is inverted. The ball will fly on to the lower left at the same angle at which it came
from the upper left, or vice versa – if it came from the lower left, it will continue on to the upper left. Then the ball will fly a small step so as not
to touch the paddle again in any case. To make the movement direction a little less foreseeable, the flight direction is changed by a random
value between –20 and 20 degrees as compared to the previous direction.
When the ball touches the purple bar, a point is deducted from the player. The variable points is increased by
1
. Then the ball is put into the
centre of the playing field again, to fly off again from there. The flight direction is turned by a random value between -20 and 20 degrees to keep
it from taking precisely the same trajectory again, while still roughly flying in the same direction that it did last.
The electronics for the paddle
Components: 1 x plug board, 1 x LED red, 1 x LED yellow, 2 x 220-Ohm resistor, 2 x 20 MOhm resistor, 2 x wire bridges (sensor contact), 6
x connection cables, 1 x alligator clamp cable
The program for the paddle
The paddle has a dedicated Scratch script that is started when clicking the green vane, and that queries and controls the electronics.