Programe Games Com Python
Programe Games Com Python
qxp
12/21/06
11:47 AM
APPENDIX
Page D-1
Creating
Graphics
and Sound
ames require graphics and sound effects, but this book is more
focused on programming than the details of media production.
If youre not comfortable creating graphics and audio on your own,
heres some step-by-step instructions for creating the media needed in the
Mail Pilot game in Chapter 7.
068229_bc_appd.qxp
12/21/06
11:47 AM
Page D-2
By Color Select
Pencil
Brush
Pen, Pattern, and
Gradient Indicators
Smudge
Tool Options
D-2
068229_bc_appd.qxp
12/21/06
11:47 AM
Page D-3
2. Open the 1945.bmp file from the shooter directory of the SpriteLib
package.
Use File Open to open the file in GIMP.
3. Use the Crop tool to select only the piece you need.
Use the zoom in/out tool to view a particular part of the image. Figure D-2
shows how to use the crop tool to select a smaller part of the image.
D-3
068229_bc_appd.qxp
12/21/06
11:47 AM
Page D-4
Figure D-2: Crop away everything but a rectangle containing the piece you need.
In the Image window, use the menu system to select Layer Transparency
Add Alpha Channel. (Alpha channel is a fancy term for allowing
transparency.)
Information Kiosk
An alpha channel is one way to manage transparency in computer
graphics. Truthfully, I wont use the alpha channel here for long.
Im just telling GIMP that I want to allow transparency here, because the
format of the image I loaded (BMP) doesnt normally handle transparency.
5. Use the By Color Select tool to select the blue color of the original images
background.
The original image has a blue background, but Im going to eventually add a
more interesting ocean background, so I need to change the blue to transparent
so the plane wont appear to be flying in a blue box.
D-4
068229_bc_appd.qxp
12/21/06
11:47 AM
Page D-5
Figure D-3: The cropped plane image with its transparent background ready to be saved.
2. Draw an outline.
Use the pencil or brush drawing tool to make a lumpy cloud outline.
Building the Cloud Graphic
D-5
068229_bc_appd.qxp
12/21/06
11:47 AM
Page D-6
D-6
068229_bc_appd.qxp
12/21/06
11:47 AM
Page D-7
Information Kiosk
The water graphic Im showing you now is based on a simple
and effective tutorial for making a random water texture
which I found on the GIMP Talk forum (www.gimptalk.com). Of course,
you can use my image if you want, or you can use another editor. Most
high-end graphics tools have the same capabilities but might name things
differently.
Heres one easy way to build the ocean graphic using the GIMP:
5. Copy the top and set its size to 640 by 480 pixels.
Use the rectangular selection tool to select the top section of the picture. Make
sure your selection is 640 480 pixels.
D-7
068229_bc_appd.qxp
12/21/06
11:47 AM
Page D-8
The seam
Figure D-4: After you copy the top, there is a seam.
D-8
068229_bc_appd.qxp
12/21/06
11:47 AM
Page D-9
2. Click the Record button (the red circle) in the Audacity window and record
your sound effect.
Simply speak or make your sound effect into the microphone. A waveform will
appear as you create the sound. Click the Stop button (two blue parallel lines)
when youre finished.
D-9
068229_bc_appd.qxp
12/21/06
11:47 AM
Page D-10
Information Kiosk
Before you normalize or perform any other effect operation on
a sound clip, you must select it. Click the left-hand panel next
to the tracks wave form to select that track, or drag in the wave form to
select a portion of the track.
Transfer
Turn back to Chapter 6 if you need to review the basics of the
Ogg Vorbis format.
D-10
068229_bc_appd.qxp
12/21/06
11:47 AM
Page D-11
Figure D-6: Now Ive trimmed off the beginning and end.
Information Kiosk
You dont need much audio. A second or two should be plenty.
This is supposed to be a repetitive background sound, so dont
make it too long, or your game file will be larger than necessary.
D-11
068229_bc_appd.qxp
12/21/06
11:47 AM
Page D-12
D-12
068229_bc_appd.qxp
12/21/06
11:47 AM
Page D-13
Use this slider to control which speaker youll hear the audio on.
Figure D-8: The first track is played in the left ear and the second in the right
D-13
068229_bc_appd.qxp
12/21/06
11:47 AM
Page D-14