O'Reilly logo

Hello World! Second Edition: Computer Programming for Kids and Other Beginners by Warren Sande and Carter Sande

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 17. Sprites and Collision Detection

In this chapter, we’ll continue using Pygame to do animation. We’ll look at things called sprites, which help us keep track of lots of images moving on the screen. We’ll also see how to detect when two images overlap or hit each other, like when a ball hits a paddle or a spaceship hits an asteroid.

Sprites

In the last chapter, you saw that simple animation isn’t quite so simple after all. If you have a lot of images and are moving them around, it can be a lot of work keeping track of what’s “under” each image so you can repaint when you move the image. In our first example with the beach ball, the background was just white, so it was easier. But you can imagine that, with graphics in the background, ...

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