Book Image

Raspberry Pi Gaming

By : Shea Silverman
Book Image

Raspberry Pi Gaming

By: Shea Silverman

Overview of this book

Table of Contents (16 chapters)

Ping Pong

It's time to go back in time, and recreate a game that helped to launch the video game industry. It has gone by many names such as Pong, Ping Pong, and Table Tennis, but the basic gameplay has stayed the same. Two paddles, one ball, and an epic battle to get the ball past the other player.

So, let's break down this game. We will require:

  • One paddle for the left player

  • One paddle for the right player

  • One bouncing ball

  • Two variables to keep score for each player.

Let's get started!

Making the paddles

After creating a new project, you will be presented with the white stage and a Scratchy sprite.

  1. Right-click on Scratchy and click on delete. Now, click on Paint new sprite.

  2. Draw a long black rectangle and click on OK. Name this sprite Left.

    We are going to create three simple scripts for this paddle, as follows:

  3. The first script ensures that the left paddle points in the proper direction and then sets its size to 60 percent. You should experiment with the size to determine what feels right for your...