O'Reilly logo

Hello! Python by Anthony Briggs

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 9. Gaming with Pyglet

 

This chapter covers
  • Display images and text on the screen
  • Using event loops and timers
  • Game design, and making your game fun

 

In this chapter, you’ll be writing your own arcade game using a library called Pyglet. Pyglet bills itself as a “cross-platform windowing and multimedia library for Python,” but you’ll be using it for its real purpose—writing games!

If you’re familiar with various arcade games, yours will be sort of a cross between Spacewar!, Asteroids, and Space Invaders—it will have a spaceship, evil aliens to shoot, and a planet to run into. To make the game more interesting, you’ll give the planet some gravity, so it draws in the ship gradually.

But first, you’ll need to get Pyglet installed and ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required