December 2016
Intermediate to advanced
376 pages
9h 5m
English

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.
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. ...