xxi
Introduction
Game development is a field in programming that brings together many topics at once: Mathematics,
physics, graphics, user interfaces, artificial intelligence, and a whole lot more. For this reason, game
development is both challenging and rewarding. In most languages, game development is not something
that is recommended for any beginner to programming. Game development with a friendly language, like
Python, along with a module like Pygame, however, allows just about anyone to easily enter the field of game
development. Even if you are completely new to programming with Python, or a seasoned developer, you
may find that game development is a great way to further learn programming. Normally, programming is not
a very visual experience, but games change this. You can see your programming logic at work in way that is
normally not possible.
Who This Book Is For
This book is for anyone who has thought about creating a computer game, or wants to learn about the
technology behind game development. Although Python is the tool of choice for this book, many of the
techniques covered are equally applicable to other languages.
How This Book Is Structured
Beginning Python Games Development with Pygame is divided into 12 chapters, each of which builds on the
previous chapter—with a few notable exceptions. I’ve structured it so that you can get results quickly and see
something on-screen, which you may appreciate if you are as impatient as I am. Virtually all the listings are
self-contained, and hopefully entertaining, little projects that run independently. Because experimentation
is the best way to learn, you are encouraged to play with the sample code and modify it to produce different
effects. You can also use any of the code in your own projects—with my blessing! The first two chapters
introduce the Python language in a fairly conversational manner. If you read them with a Python prompt
in front of you, you should find you can quickly pick up the language. These two chapters don’t make a
complete language tutorial, but will cover enough for you to be able to understand the Python code in the
book and write some of your own. Occasionally, new syntaxes and language features are introduced in the
rest of the book, but I explain them where they are first used. If you are proficient in Python, you can skip
straight to Chapter 3.
Chapter 3 is your first introduction to Pygame and covers its history and capabilities. It also explains the
basics of setting up a graphical display and handling events, skills that are essential for any game. You will
become intimately familiar with the code introduced in this chapter, as it is used in all the sample code for
the rest of the book.
Chapter 4 dives straight into creating visuals and the various ways in which you can draw to the screen
with Pygame.
Chapter 5 explores the techniques that game programmers use to make those images move. You should
find the discussion on time-based movement to be particularly valuable, as it is essential for any kind of
animation in a game.
评论2
最新资源