Playing Breakout
Open the chapter1_complete.py
script to see the final version of the game, and run it by executing chapter1_complete.py
, as you did with the previous code samples.
When you press the spacebar, the game starts and the player controls the paddle with the right and left arrow keys. Each time the player misses the ball, the lives counter will decrease, and the game will be over if the ball rebound is missed again and there are no lives left:
In our first game, all the classes have been defined in a single script. However, as the number of lines of code increases, it becomes necessary to define separate scripts for each part. In the next chapters, we will see how it is possible to organize our code by modules.