1. Trang chủ
  2. » Tất cả

Beginning Game Development with Python and Pygame_ From Novice to Professional [McGugan 2007-10-19]

342 2 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 342
Dung lượng 8,61 MB

Nội dung

 CYAN   MAGENTA  YELLOW   BLACK  PANTONE 123 C Books for professionals by professionals ® Beginning Game Development with Python and Pygame: From Novice to Professional Creating computer games is a fascinating combination of an art and a science, and can make a rewarding career or hobby Do you know you can write cutting-edge games that run on Windows, Linux, and Mac OS X with open source technologies and freely available tools? In this book, I introduce you to Python—a powerful, dynamic language— and explain how to use the Pygame library to quickly develop compelling games I also explain how to create three-dimensional graphics using OpenGL, the technology behind many commercial games, such as the Quake series My aim for Beginning Game Development with Python and Pygame is to make game development accessible to as wide an audience as possible Previous programming experience is useful but not essential, because the first two chapters introduce the Python programming language—or serve as a refresher course if you are already familiar with Python Further chapters cover how to use Pygame to set up a graphical display, draw to the screen, handle events, and read input devices I also talk you through essential topics such as creating game characters with artificial intelligence and playing sound (including music) Four chapters are devoted to the topic of three-dimensional graphics in games, and show you how to manipulate objects in a virtual world and render impressive visuals with lighting and special effects The math involved in programming a game with three-dimensional graphics can be intimidating, but I explain it in visual terms rather than the more traditional pure mathematical approach you find in textbooks I also share with you a few of the tips and tricks I have picked up over the years in my career as a professional game developer I hope to be playing one of your Pygame creations in the future! Will McGugan Companion eBook THE APRESS ROADMAP See last page for details on $10 eBook version Beginning Python: From Novice to Professional Foundations of Python Network Programming Beginning Game Development with Python and Pygame The Definitive Guide to Django: Web Development Done Right www.apress.com ISBN-13: 978-1-59059-872-6 ISBN-10: 1-59059-872-5 53999 US $39.99 Beginning McGugan SOURCE CODE ONLINE Companion eBook Available Game Development with Python and Pygame Dear Reader, The EXPERT’s VOIce ® in Open Source Beginning Game Development with Python and Pygame From Novice to Professional Create stunning video games using popular open source technologies! Will McGugan Shelve in Python User level: Beginner–Intermediate 781590 598726 this print for content only—size & color not accurate spine = 0.802" 344 page count 8725.book Page i Wednesday, September 26, 2007 8:08 PM Beginning Game Development with Python and Pygame From Novice to Professional ■■■ Will McGugan 8725.book Page ii Wednesday, September 26, 2007 8:08 PM Beginning Game Development with Python and Pygame: From Novice to Professional Copyright © 2007 by Will McGugan All rights reserved No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher ISBN-13 (pbk): 978-1-59059-872-6 ISBN-10 (pbk): 1-59059-872-5 Printed and bound in the United States of America Trademarked names may appear in this book Rather than use a trademark symbol with every occurrence of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark Lead Editor: Jason Gilmore Technical Reviewer: Richard Jones Editorial Board: Steve Anglin, Ewan Buckingham, Tony Campbell, Gary Cornell, Jonathan Gennick, Jason Gilmore, Kevin Goff, Jonathan Hassell, Matthew Moodie, Joseph Ottinger, Jeffrey Pepper, Ben Renow-Clarke, Dominic Shakeshaft, Matt Wade, Tom Welsh Project Manager: Kylie Johnston Copy Editor: Liz Welch Assistant Production Director: Kari Brooks-Copony Production Editor: Kelly Winquist Compositor: Pat Christenson Proofreader: Erin Poe Indexer: Becky Hornyak Cover Designer: Kurt Krames Manufacturing Director: Tom Debolski Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor, New York, NY 10013 Phone 1-800-SPRINGER, fax 201-348-4505, e-mail orders-ny@springer-sbm.com, or visit http://www.springeronline.com For information on translations, please contact Apress directly at 2855 Telegraph Avenue, Suite 600, Berkeley, CA 94705 Phone 510-549-5930, fax 510-549-5939, e-mail info@apress.com, or visit http:// www.apress.com The information in this book is distributed on an “as is” basis, without warranty Although every precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work The source code for this book is available to readers at http://www.apress.com in the Source Code/ Download section 8725.book Page iii Wednesday, September 26, 2007 8:08 PM For Maria 8725.book Page iv Wednesday, September 26, 2007 8:08 PM 8725.book Page v Wednesday, September 26, 2007 8:08 PM Contents at a Glance About the Author xv About the Technical Reviewer xvii Acknowledgments xix Introduction xxi ■CHAPTER Introducing Python ■CHAPTER Exploring Python 19 ■CHAPTER Introducing Pygame 41 ■CHAPTER Creating Visuals 67 ■CHAPTER Making Things Move 91 ■CHAPTER Accepting User Input 111 ■CHAPTER Take Me to Your Leader 139 ■CHAPTER Moving into the Third Dimension 165 ■CHAPTER Exploring the Third Dimension 181 ■CHAPTER 10 Making Things Go Boom 211 ■CHAPTER 11 Lights, Camera, Action! 235 ■CHAPTER 12 Setting the Scene with OpenGL 263 ■APPENDIX A Game Object Reference 285 ■APPENDIX B Packaging Your Game 293 ■INDEX 297 v 8725.book Page vi Wednesday, September 26, 2007 8:08 PM 8725.book Page vii Wednesday, September 26, 2007 8:08 PM Contents About the Author xv About the Technical Reviewer xvii Acknowledgments xix Introduction xxi ■CHAPTER Introducing Python Your First Look at Python Numbers Strings Lists and Tuples 11 Loops 16 Python in Practice 18 Summary 18 ■CHAPTER ■CHAPTER Exploring Python 19 Creating Scripts Working with Logic Understanding Booleans Understanding Functions Defining Functions Introducing Object-Oriented Programming Using Classes Python in Practice Using the Standard Library Introducing import Useful Modules for Games Summary 19 20 20 23 24 26 27 31 35 35 36 39 Introducing Pygame 41 History of Pygame 42 Installing Pygame 42 Using Pygame 42 vii 8725.book Page viii Wednesday, September 26, 2007 8:08 PM viii ■C O N T E N T S ■CHAPTER Hello World Revisited Understanding Events Retrieving Events Handling Mouse Motion Events Handling Mouse Button Events Handling Keyboard Events Filtering Events Posting Events Opening a Display Full-Screen Displays Resizable Pygame Windows Windows with No Borders Additional Display Flags Using the Font Module When Pygame Goes Wrong Pygame in Action Summary 44 50 50 53 53 54 56 56 57 57 59 61 61 62 63 64 65 Creating Visuals 67 Using Pixel Power Working with Color Representing Color in Pygame Scaling Colors Blending Colors Using Images Storing Images Working with Surface Objects Drawing with Pygame pygame.draw.rect pygame.draw.polygon pygame.draw.circle pygame.draw.ellipse pygame.draw.arc pygame.draw.line pgame.draw.lines pygame.draw.aaline pygame.draw.aalines Summary 67 68 69 71 73 75 76 76 83 83 84 85 86 87 87 88 89 89 89 ... Beginning Game Development with Python and Pygame From Novice to Professional ■■■ Will McGugan 8725.book Page ii Wednesday, September 26, 2007 8:08 PM Beginning Game Development with Python and. .. work faster and accomplish more with less effort, and when combined with Pygame I could experiment with game ideas and build a complete game from scratch in record time The beauty of Pygame is that... This book was conceived to fill that gap and allow the beginner game programmer to get up to speed with Python and learn the fundamentals of game programming without having to first learn C++, C#,

Ngày đăng: 17/04/2017, 08:30

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN