Название: Code the Classics Volume II
Автор: Russell Barnes
Издательство: Raspberry Pi Press
Год: 2024
Страниц: 369
Язык: английский
Формат: epub (true)
Размер: 61.7 MB
Take inspiration from the some of the greatest video games of the 1980s and learn how to write your own modern classics. Code the Classics Volume II not only tells the stories of some of the seminal video games of the 1980s, but shows you how to create your own games inspired by them, following examples programmed by Raspberry Pi founder Eben Upton. In this book, you'll learn how to run and edit the games in this book by installing Python, Pygame Zero, and an IDE. This book has been written assuming that the reader has at least some knowledge of the Python programming language. Although it is outside of the scope of this book to teach you Python, we’ll go through some of the key features of the language that you’ll need to understand. Unless you only plan on making simple text-based games, there are certain things you always need to be able to do as a game developer: display images, play sound effects, and receive inputs from the keyboard or a game controller. In a basic Python installation, one of these is impossible and the others are hard to do in a way that works well for a real-time game. To address this, there are various libraries available for Python. A library is a collection of functions which can be used in multiple projects. One of the most popular libraries for making games with Python is Pygame, which makes it easy to create a window, draw sprites, play sound effects, and get control inputs. To reduce the amount of boilerplate code for our games, we’re using the library Pygame Zero, which is built on top of the Pygame library. It automates many things that a game programmer would usually need to write themselves. While we cannot fully cover everything that Pygame Zero does, we’ll give an overview of some of its most useful features.