Hardware Reference
In-Depth Information
Figure 11-4. ARGB 1555 color format
The sprite used for Stack it is illustrated in Figure 11-5 , using the coding to the 4-color palette. Each sprite maps
1 byte to the color palette per pixel. One sprite can be made with a 265-color palette, two sprites with a 16-color
palette, and four sprites with a 4-color palette. Using the 4-color palette allows more sprites to be in memory, because
it takes 2 bits to map to a color, and 8 bits are available. Each 2 bits of the sprite map can describe a different color
used; this is good for space saving and making animated sprites. When multiple sprites are combines in one map, they
can be added to the screen by changing the palette argument when calling the sprite() function. Larger graphics can
be made by placing two or more sprites side by side on the screen.
Figure 11-5. Stack it' s sprite with palette coding
Figure 11-6 illustrates the color palette used for Stack it. It consists of the colors black, red, green, and blue. Any
color value can be used, however There is a limit to amount of different colors that the palette can hold. Stack It's
sprite only uses three of the four colors available. You can give sprites transparent pixels by setting bit 15 to 1 on one
of the colors. When transparency is used, the color information for R, G, and B are ignored and only one color needs
to be transparent. Transparency allows for background colors to show; this is useful for non-square character sprite
move over a changing background the background.
Search WWH ::




Custom Search