LitMy.ru - литература в один клик

Code the Classics Volume II

  • Добавил: literator
  • Дата: 28-08-2024, 08:49
  • Комментариев: 0
Название: 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.

It is a testament to the performance of modern machines that they can achieve better performance in a high-level scripting language like Python than machine code could back in the day. This book takes a look at some of the game ideas from those times, and gives you a chance to experience and enjoy experimenting with some of those fun design ideas, though of course those hardware limits no longer apply. Maybe you will come up with something groundbreaking of your own!

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. However, Pygame projects require a bit of what is known as boilerplate code – code which is pretty much the same from project to project, and can be tedious to write. For example, code is required to create a game window, load sprites and sound effects, run a main game loop, handle events (such as the window’s close button being clicked), and ‘flip’ the display so that graphics that have been drawn are shown to the user.

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. You can find a full guide to the library at pygame-zero.readthedocs.io – or just search online for ‘Pygame Zero docs’.

You'll also:

• Get game design tips and tricks from the masters.
• Understand the fundamental tasks needed for every game: display images, play sound effects and receive inputs from the keyboard or a game controller.
• Learn how to code your own games with Pygame Zero, a library that helps automate those tasks.
• Explore the code listings and find out how they work.

You'll meet these vintage-inspired games, and learn from their code in between rounds of play:

• Avenger: fly across a scrolling landscape while you save humans from malevolent aliens.
• Beat Streets: fight your way through a level, and defeat a notorious crime boss.
• Eggzy: collect gems and survive as long as possible before time runs out.
• Leading Edge: Race a car on a pseudo-3d race track.
• Kinetix: Break bricks with your paddle, and use powerups to avoid various menaces.

Скачать Code the Classics Volume II












[related-news] [/related-news]
Внимание
Уважаемый посетитель, Вы зашли на сайт как незарегистрированный пользователь.
Мы рекомендуем Вам зарегистрироваться либо войти на сайт под своим именем.