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 Format1 min read
Vector Vexations
Why does MySQL not support vectors in its community edition? Generative AI is the hot topic in tech. GenAI relies on vector data. Yet Oracle has no plans to support vectors in the community edition of MySQL. If you want to try out vector data with ot
Linux Format5 min read
Tips For Managing Docker Containers
Everyone knows how containers revolutionised application building and deployment. Using a E disposable stack of containers that make up an app that aren’t using the docker-compose command to manage the stack are missing a trick. It allows the shippin
Linux Format1 min read
Wine For Wayland
2023 was a great year for the Wayland driver for Wine. The goal was to move forward from the experimental phase and make the driver a proper upstream component. A year later, after several merge requests, many people are now already able to use the l

Related Books & Audiobooks