Game Development Reference
In-Depth Information
First, I want to illustrate how I made the background stripes that will create the paral-
laxing effect. This is crucial to understanding how the texture atlas TexturePacker cre-
ates can help you save memory and performance and also save time positioning the in-
dividual stripes. Figure 7-1 shows the background layer as a Seashore image composed
of individual parallax layers. This image is also in the Assets folder of the
ScrollingWithJoy01 project, as background-parallax.xcf .
Figure 7-1 . The source image for the parallax scrolling background
Each stripe is on its own layer in the image-editing program Seashore. In Figure 7-2
you can see the various layers, and the Assets folder holds images named bg0.png
through bg6.png , which correspond to the seven individual stripes making up the
background.
I recommend creating the parallax background image this way for several reasons. You
can create the image as a whole, but you're able to save each layer to an individual file.
All these files are 960 × 640 pixels in size, which may seem wasteful at first, but
you're not adding the individual images to the game—instead, you're adding them to a
texture atlas. Because TexturePacker removes the surrounding transparent space of
each image, it shrinks the individual stripes down to a bare minimum. You can see this
in Figure 7-3 .
 
 
 
 
Search Nedrilad ::




Custom Search