Let's develop the code for this application. As mentioned earlier, a big chunk of the code comes from the Single Image Animation section. So we will only discuss the new and modified methods needed to create a bowling animation.
Download the Python source file
BowlingAnimation.py
from the Packt website. The overall class design is the same as the one developed in the Single Image Animation section. We will only discuss the new and modified methods. You can review the rest of the code from this file.Also, download the image files used in this project. These files are
ball.png
andpin.png
. Place these files in a sub-directoryimages
. Theimages
directory should be placed in the directory in which the above Python source file is located.The
__init__
method of the class is identical to that of classSingleImageAnimation
. The only change here is that it initializes the following flags:self.paused = False self.pinHorizontal = False
The flag
self.pinHorizontal...