Alyce
Jan 27, 2006
- "Removed reference to mask being mirror image, which implies flipping. Changed XOR to raster operations. Changed incorrect instructions about having black in sprite images."
Alyce
Jan 27, 2006
- "Removed reference to mask being mirror image, which implies flipping. Changed XOR to raster operations. Changed incorrect instructions about having black in sprite images."
What Are Sprites:
Wikipedia suggests that a Sprite is a class of preternatural legendary creatures commonly associated with elves, fairies, pixies, and spirits. Of course this is not what is meant when Programmers are discussing them in most cases.Within the realm of Liberty Basic programming we are referring to a two-dimensional pre-rendered graphics figure, usually containing some transparency. Liberty Basic implements sprites using Windows GDI function calls that allow manipulation of graphics with masked areas using multiple raster operations, first applying the mask to the background, then the sprite image. This is not critical to understand in order to use Sprites, but may help explain their operation if you wish to dig deeper into this area.
Create a Sprite:
Sprites are created by selecting a suitable graphic (in bitmap form) and applying a mask.Another way to create a sprite and mask.
The masking step can be done with this Liberty Basic program found in the helpfile. If you use this program, it will consider that all black pixels in the original image should be transparent in the finished sprite. If your image must contain black pixels, such as the nose of a dog, black shoes on a person, etc. then you can handle it one of two ways. You can either edit the mask by hand after you've used the masking code, and color the mask part so that all black pixels in the image are also black in the sprite, or you can create your original image in such a way that parts of the image that are to be black are very dark gray, rather than black.
Want to know more?
Read the entire Liberty BASIC Helpfile section on Sprites. It explains what sprites are, how they work, and how to use them. There are plenty of pictures.Next, check out the articles in the Liberty BASIC Newsletter that pertain to sprites. Download the archives to get all of the images needed to run the demonstration programs.
http://groups.yahoo.com/group/lbnews/
http://babek.info/libertybasicfiles/lbnews/
Beginning Game Programming by Richard Ryles
This series can be found in the following issues:
Sprite Bytes by Alyce Watson
This series can be found in the following issues:
You can use Game Workshop to create a skeleton for your game. The standalone version is available here:
- http://alycesrestaurant.com/game.htm
It is also part of Liberty BASIC Workshop, available here:Add your favorite sprite resources!