Hardware Reference
In-Depth Information
The Sounds
I found a good source of free sound efects at the Freesound website, www.freesound.org. You
need to register in order to download sounds, but that is simple enough. Freesound has a good
search engine to narrow down your choice of sounds, and you can hear them directly from your
browser without having to download them irst. Table 6-1 shows what sounds you need.
Table 6-1 Sounds Required
Filename
Action
Pie Man eats a pill.
eatPill.ogg
powerPill.ogg
Pie Man eats a power pill.
Pie Man kills a ghost.
ghostDie.ogg
pieDie.ogg
A ghost kills Pie Man.
Fanfare to indicate that you can start playing.
pieStart.ogg
Note here that the sound iles are all in the .ogg format. I downloaded suitable iles and
used Audacity to trim them, so there was a minimum delay before the sound actually started,
and there were no long silence at the end. Also, Audacity can convert them into mono iles
and save them in the .ogg format that Python on the Raspberry Pi handles with ease. Note
that the Raspberry Pi can also handle WAV iles, but I have found that it handles only some
iles, and I can't track down what the ofending parameters or variations are. When you have
these iles put them in a folder called sounds inside your working folder.
The Players
For the sprite I took the image of the racing pie slice used in Chapter 14, “Computer-
Controlled Slot Car Racing”, and made it square with a graphics package. I used Photoshop
Elements for this, but most graphics programs will allow you to resize an image; however, to
make it square, you have to remember to untick the Preserve Aspect Ratio box. hen with a
copy of this image, using the Select tool, I carefully removed the pastry lid of the pie slice and
pasted it back onto the pie at an angle. Make sure that the background is set to transparent,
and save it as a .png ile. his gives the two basic images for your Pie Man, shown in Figure
6-2. Make sure that both images are the same size (48 pixels square) and that they are aligned
so that when you show one and then the other only the lid moves. Well, if you allow a pixel
or two of misalignment in the Y direction, then Pie Man, when it is chomping stationary
against a wall, does look like its motor is revving up and down, but don't overdo it.
 
Search WWH ::




Custom Search