Linux Format

Write your own classic Pong game

OUR EXPERT

Matt Holder was told he wasted far too much of his youth playing Pong – but it turns out it was all in the name of research.

We can’t imagine there are many folk who need introducing to Pong. However, for those who do, it is a two-player game in which table tennis (or ping pong) is simulated.

Pong was an early computer game, first released in 1972. Upright arcade cabinet machines existed that ran the game as well as home consoles that became available from 1975 onwards. Pong was first released by Atari and there have been many versions created over the years, both ones that use hardware and versions using various programming languages that run on top of your operating system.

In this article, we are creating a basic Pong game and the full code is available on GitHub (see Quick Tip, left). We cover a number of concepts including the event loop, how to use keyboard control and how to use variables to store each player’s score. Before we begin coding, let’s quickly discuss the gameplay. A paddle is drawn on the left- and right-hand sides of the screen. Each player controls the vertical

You’re reading a preview, subscribe to read more.

More from Linux Format

Linux Format4 min read
Pepper Grinder
Minimum OS: Ubuntu 22.04 CPU: Intel Core i5 4570, AMD A105800K APU Mem: 8GB GPU: GeForce GTX 650, Radeon HD 7750, Iris Pro Graphics 580. OpenGL 2.1+, 1GB VRAM HDD: 300MB Poor Pepper. She’s the star of Devolver Digital’s new Drill baby, drill! platfor
Linux Format1 min read
Microsoft Open Sources MS-DOS
On 25th April, Microsoft announced that, in partnership with IBM, it has released MS-DOS 4.00 under the open source MIT licence. This release of the OS, which originally came out in 1988, includes its source code, binaries, disk images and document
Linux Format10 min read
Create Turn-based Internet Games
OUR EXPERT David Bolton worked for several years as a postal game developer back in the late ’80s for what was then the UK’s largest postal game company. There’s an old saying that you should always validate your inputs. Even if you wrote the part of

Related Books & Audiobooks