وبلاگ بلیان

Beginning Game Programming with Pygame Zero (Coding Interactive Games on Raspberry Pi Using Python) ||

معرفی کتاب «Beginning Game Programming with Pygame Zero (Coding Interactive Games on Raspberry Pi Using Python) ||» نوشتهٔ Sebastião Salgado، Philadelphia Museum of Art و Watkiss, Stewart، منتشرشده توسط نشر Apress L.P در سال 1007. این کتاب در فرمت pdf، زبان انگلیسی ارائه شده است.

Make fun games while learning to code. Focused on making games rather than teaching programming theory, in this book you're more likely to see code on how gravity affects a missiles trajectory instead of the most efficient way to search through data. Even then the code is kept simple as games should be about playability rather than complex physics. There are links to the official documentation when you need to lookup information that isn't included in the book. Start with a simple text based game to grasp the basics of programming in Python. Then moves on to creating simple graphical games in Pygame Zero. Not only will you learn object oriented programming to make it easier to make more complex games, you'll also work to create your own graphics and sounds. 3D graphics are a little complex. So we focus on 2D games, including spins on some classic boardgames and arcade games. All the games are designed to run on a Raspberry Pi. They will work on any Raspberry Pi, but will also work on any other computer that supports Python 3 along with Pygame Zero. The games you make will be playable and hopefully fun to play. And by the end of the book, you can step beyond the provided source code to develop your own unique games and programs. What You'll Learn Code in Python Generate sounds and graphics for 2D games Grasp object oriented programming with Pygame Zero Who This Book Is For Beginning game developers interested in working with low-cost and easy-to-learn solutions like Pygame Zero and the Raspberry Pi. Table of Contents 5 About the Author 12 About the Technical Reviewer 13 Acknowledgments 14 Introduction 15 Chapter 1: Creating Computer Games 17 Inspiration Rather Than Imitation 18 Playing Games 19 Create the Resources 19 Development Cycle 20 Making Programming Enjoyable 22 Python and Pygame Zero 22 Compiled vs. Interpreted 23 Choosing a Programming Environment 24 Summary 26 Chapter 2: Getting Started with Python 27 Using the Mu Editor 27 Python Programming 31 Variables 35 Strings and Format 40 Lists 43 Dictionaries 46 Tuples 47 Conditional Statements (if, elif, else) 47 Simple Quiz Game 51 Loops – While, For 53 While Loop 54 For Loop 55 Forever Loop – while True 57 Changing Loop Flow – break and continue 57 Functions 58 Variable Scope 60 Refactoring the Code 63 Further Improvements 64 Summary 65 Chapter 3: Pygame Zero 66 Pygame Zero Development 66 Compass Game 67 Required Files 68 Running Mu in Pygame Zero Mode 69 Adding a Background Image 70 Adding an Actor 72 Moving the Sprite Around the Screen 75 Making the Movements More Realistic 78 Keeping Game State 82 Detecting Collisions 88 Change in Direction 92 Keeping Score 93 Adding a Countdown Timer 96 Final Code for Compass Game Version 0.1 98 Summary 104 Chapter 4: Game Design 105 What Makes a Game Enjoyable? 105 Challenging but Achievable 106 Choices and Consequences 107 Rewards and Progress 108 Likeable Characters 108 Storyline/Historical Relevance 109 Educational 109 Takes an Appropriate Level of Time to Play 109 Inclusivity 110 Age Appropriate 110 Improving Compass Game 111 Updated Timer 111 Adding Obstacles 114 Adding a High Score 118 Try and Except 121 Summary 124 Chapter 5: Graphic Design 125 Creating a Theme 126 File Formats 127 Bitmap Images 127 Vector Images 129 Useful Tools 130 LibreOffice Draw 130 Inkscape 132 GIMP 134 Creating a Computer Image from a Drawing or Photo 134 Creating a Pixel Art Sprite 139 Blender 141 Create Using Code 143 Other Sources 144 Summary 144 Chapter 6: Colors 145 Color Mixing 145 Bouncing Ball 149 Background Color Selector 153 Handling Mouse Events 154 Creating the Color Selector 155 Summary 157 Chapter 7: Tank Game Zero 158 Vector Image of Tank 158 Creating a Dynamic Landscape 165 Calculating the Trajectory 170 Detecting a Collision 174 Complete Game Code 176 Improving the Game 192 Summary 193 Chapter 8: Sound 194 Recording Sound Effects 194 Creating Artificial Sound Effects 195 Recording Audio on the Raspberry Pi 196 Connecting a USB Microphone 198 Using arecord 199 Audacity 200 Recording Sounds with Audacity 201 Convert Audio Formats 202 Extract Audio from Video Files 202 Trim Audio Files 202 Creating Music with Sonic Pi 203 Downloading Free Sounds and Music 206 Adding Sound Effects in Pygame Zero 206 Playing Music in Pygame Zero 207 Piano Game Created with Tones 208 Summary 218 Chapter 9: Object-Oriented Programming 219 What Is Object-Oriented Programming? 219 OOP Classes and Objects 221 Creating a Class, Attributes, and Methods 221 Creating an Instance of a Class (Object) 223 Accessing Attributes of an Object 225 Terminology 225 Encapsulation and Data Abstraction 227 Inheritance 228 Design for Object-Oriented Programming 230 Matching Pairs Memory Game 231 Creating the Classes 235 Timer Class 235 Card Class 237 GamePlay Class 241 Program File 245 Summary 253 Chapter 10: Artificial Intelligence 254 Memory Game with AI 255 A Good Memory 274 Battleships 282 Summary 302 Chapter 11: Improvements and Debugging 304 Additional Techniques 304 More About Pygame Zero 305 More About Pygame 306 Adding Fonts 307 Scrolling Screen 307 Reading from a CSV config file 309 Joysticks and Gamepads 312 Creating Arcade Games for Picade 313 RetroPie 315 Debugging 317 Error Messages 318 Check for Variable Names 319 Print Statements 319 IDE Debugging Tools 320 Rubber Duck Debugging 320 Performance 321 Space Shooter Game 323 Summary 339 Where Next? 339 Appendix A: Quick Reference 341 Pygame Zero 341 Useful Keywords 341 Actor (Sprite) 341 Background Image or Color 342 Sound Effects 342 Mouse Events 342 Keyboard Events 343 Displaying Text 343 Python 3 344 Lists 344 Dictionaries 344 Conditional Statements (if, elif, else) 345 Loops 345 Python 3 Modules 346 Random 346 Math 346 Time 347 DateTime 348 Appendix B: More Information 349 Python 349 Pygame Zero 349 Pygame 350 Index 351 Make fun games while learning to code. Focused on making games rather than teaching programming theory, in this book you're more likely to see code on how gravity affects a missiles trajectory instead of the most efficient way to search through data. Even then the code is kept simple as games should be about playability rather than complex physics. There are links to the official documentation when you need to lookup information that isn't included in the book. Start with a simple text based game to grasp the basics of programming in Python. Then moves on to creating simple graphical games in Pygame Zero. Not only will you learn object oriented programming to make it easier to make more complex games, you'll also work to create your own graphics and sounds. 3D graphics are a little complex. So we focus on 2D games, including spins on some classic boardgames and arcade games. All the games are designed to run on a Raspberry Pi. They will work on any Raspberry Pi, but will also work on any other computer that supports Python 3 along with Pygame Zero. The games you make will be playable and hopefully fun to play. And by the end of the book, you can step beyond the provided source code to develop your own unique games and programs. You will: Code in Python Generate sounds and graphics for 2D games Grasp object oriented programming with Pygame Zero
دانلود کتاب Beginning Game Programming with Pygame Zero (Coding Interactive Games on Raspberry Pi Using Python) ||