CHAPTER 9

image

Introduction to Animation

To begin our first animation, let’s start with the base pygame program from Chapter 6 that opens up a blank screen. Source for pygame_base_template.py can be found here:ProgramArcadeGames.com/python_examples/f.php?file=pygame_base_template.py

We will put together a program to bounce a white rectangle around a screen with a black background. Feel free to pick your own colors; just make sure the background color is different than the rectangle color!

9781484217894_unFig09-01.jpg

First step: start with the base template and flip the background ...

Get Program Arcade Games: With Python and Pygame, Fourth 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.