Mission Python: Code a Space Adventure Game!

Mission Python: Code a Space Adventure Game! — page 7
Figure 4 The command line window 4 Pygame Zero should start to install It will take a few moments and 5 you’ll know it’s finished when your prompt appears again If you get an error message saying that pip is not recognized try installing installing Python again You can uninstall Python first by running the installation installation program again or using the Windows Control panel Make sure you select the box for the PATH when installing Python see Figure 2 After you have reinstalled Python try installing Pygame Zero again 6 When Pygame Zero has finished downloading and you can type again enter the following echo print Hello test py 7 This line creates a new file called test py that contains the instruction print Hello I’ll explain the print instruction in Chapter 1 but for now this is just a quick way to make a test file Be careful when you enter the parentheses curved brackets and quotation marks if you miss one the file won’t work properly 8 Open the test file by entering the following pgzrun test py 9 After a short delay a blank window should open with the title Pygame Zero Game Click the command line window again to bring it to the front you should see the text Hello Press ctrl-C in the command line window to stop the program 10 If you want to delete your test program enter del test py Installing the Software on other Machines Python and Pygame Zero are available for other computer systems Pygame Zero has been designed in part to enable games to work across different computers so the Escape code should run wherever Pygame Zero runs This book only provides guidance for users of Windows and Raspberry Pi computers computers But if you have a different computer you can download Python at https www python org downloads and can find advice on installing Pygame Zero at http pygame-zero readthedocs io en latest installation html 6 Introduction