Invent Your Own Computer Games with Python

Invent Your Own Computer Games with Python — page 9
Chapter 16 Reversegam AI Simulation expands on the Reversegam game in Chapter 15 to make multiple AIs that compete in computer versus-computer games Chapter 17 Creating Graphics introduces Python’s pygame module and shows you how to use it to draw 2D graphics Chapter 18 Animating Graphics shows you how to animate graphics with pygame In Chapter 19 Collision Detection you’ll learn how to detect when objects collide with each other in 2D games In Chapter 20 Using Sounds and Images you’ll improve your simple pygame games by adding sounds and images Chapter 21 A Dodger Game with Sounds and Images combines the concepts in Chapters 17 to 20 to make an animated game called Dodger How to Use This Book Most chapters in this book will begin with a sample run of the chapter’s featured program This sample run shows you what the program looks like when you run it The parts the user types are shown in bold I recommend that you enter the code for each program into IDLE’s file editor yourself rather than downloading or copying and pasting it You’ll remember more if you take the time to type the code Line Numbers and Indentation When typing the source code from this book do not type the line numbers at the start of each line For example if you saw the following line of code you would not need to type the 9 on the left side or the one space immediately immediately following it 9 number random randint 1 20 You’d enter only this number random randint 1 20 Those numbers are there just so this book can refer to specific lines in the program They are not part of the actual program’s source code Aside from the line numbers enter the code exactly as it appears in this book Notice that some of the lines of code are indented by four or eight or more spaces The spaces at the beginning of the line change how Python interprets instructions so they are very important to include Let’s look at an example The indented spaces here are marked with black circles so you can see them xxiv Introduction