Thank you for visiting Blazing Games

Sprites

The term sprite is quite often also known as billboards when used in 3D because they are a two dimensional picture placed in the three dimensional environment, similar to the ads you see along the highway. Of course, the term sprite is used to describe images that are drawn over another image but have transparent areas and do not destroy the underlying image when they move. I could probably go into a large amount of detail about the difference between a software sprite and a hardware sprite, but as both effectively do the same thing this is not relevant.

The sprites that are used in the game have the special property that they are always facing the player. This is done to keep the rendering of the sprite as simple as possible. Sprites are drawn the same way as walls. In other words they are simply a scaled picture. There is one slight difference in the way that they are drawn. Sprites have a transparent color. That means that pixels of the sprite that are of a certain color are simply not drawn. In theory any color could be used for the transparent color. Likewise, you could take advantage of the alpha channel data that java provides. For the sake of simplicity, I use black with a zero alpha value for the transparent color, as that means that the integer value used for the color is zero. This makes testing for transparency very easy.

All the code for rendering the walls and the sprites is located in the com.blazinggames.cq1.ImgCell class.

Previous page
Chapter 3 Page 5

About - Privacy Policy - Contact - Links - FAQ
Copyright © 2006 Blazing Games Inc. All Rights Reserved