18ANIMATING GRAPHICS
Now that you’ve learned some pygame skills, we’ll write a program to animate boxes that bounce around a window. The boxes are different colors and sizes and move only in diagonal directions. To animate the boxes, we’ll move them a few pixels on each iteration through the game loop. This will make it look like the boxes are moving around the screen.
Sample Run of the Animation Program
When you run the Animation program, it will look something like Figure 18-1. The blocks will be bouncing off the edges of the window. ...
Get Invent Your Own Computer Games with Python , 4th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.