Object Oriented Programming – Breakout in Python

The original game named Breakout was built in 1976, conceived by Nolan Bushnell and Steve Bristow and built by Steve Wozniak (some say aided by Steve Jobs). In this game, there are layers of colored rectangles in the upper part of the screen. A simulated ball moves around the game window, and if it hits a rect­angle, it accumulates points and bounces. The ball also bounces off of the top and sides of the window, but will pass through the bottom and be lost unless the player moves a paddle into its path. If so, the ball will bounce back up and per­haps score more points; if not, the ball moves out of play. After a fixed number of balls are lost, the game is over.

The game being developed here uses circles, that we call tiles, rather than rectangles. There will be 5 rows of tiles, each of a different color and point value: 5, 10, 15, 10, and 5 points for each row respectively. That way the most concealed row has the most points. The player gets three balls to try to clear all of the tiles away. The paddle moves left when the left arrow key is pressed and right when the right arrow key is pressed. The speed of the ball and of the paddle are deter­mined when the game is tested. A sound plays when a tile is removed, when the ball hits the side or top of the window, when the ball hits the paddle, and when the ball is lost. The current score and the number of balls remaining are displayed on the screen someplace at all times.

Figure 12.1 shows an example of a breakout game clone on the left, with rect­angular bricks. The picture with the circles is a possible example of how the game that we’re developing here might look.

Source: Parker James R. (2021), Python: An Introduction to Programming, Mercury Learning and Information; Second edition.

Leave a Reply

Your email address will not be published. Required fields are marked *