of which could be the computer itself) but the version below is a single player version (maybe you can make it into a two player version?). I challenge you to find a Scratch game that is as playable as this and yet has a file size of only 30KB!

To get started, make the ball and bat sprites. Don't forget to hold down the shift key when you draw the circle with the oval tool - in that way the oval tool is constrained to give a circle. The scripts for the bat should be something like this:

and a basic script for the ball could be as shown below. For example, if the ball has direction 135° (down and right) then the direction is reset to -135° (down and left) with a little randomness thrown in to make the game more interesting.:

For such simple scripts, the game already behaves nicely. But sometimes the ball bounces back and forth between the bat and the right wall and sometimes, much worse, it seems to get stuck on the ball itself. You'll need to find solution to these 'bugs'. In fact you have a lot of work to do if you ant to develop your version into something as good as the version below...

In my 'final version' below the bugs mentioned above have been solved. I have modified the game so that the 'move 10 steps' block includes the 'score' variable in such a way that as the score gets bigger so does the speed of the ball. The score increases by 1 every time the ball hits the bat. The number of lives decreases by one each time the ball gets very close to the right edge. I actually found that surprisingly difficult to code because initially two lives were sometimes lost instead of one since the ball was spending 'too long' close to the right hand wall. My solution was to create a third variable which is set to one each time the ball gets very close to the right wall (x>200) and which is set to zero each time the ball gets close to the left wall. A life is lost only when the ball gets close to the right wall AND the extra variable has a value of zero. THINK ABOUT IT!

If the bat does not respond to the pressing of the arrow keys then clicking on the animation should fix that problem - that's a useful trick with all Scratch animations.

Going further

My version is far from perfect - can you improve it?.

  • You score points if the ball hits the bat just after hitting the right-hand wall - this is probably not reasonable.
  • I think you sometimes get two points instead of one when the ball hits the bat.
  • It's only a one person game whereas Pong should really be a two person game (or person versus computer).
  • Most people would prefer to control the bat with the mouse rather than with the arrow keys - can you make that happen?