Page 2
Indexalpha
Tutorial
They are painted in grayscale but end up as full color in
the game, with the palette as the alpha channel. Black is
transparent and white is opaque, which is what you'll
see. The last color in the palette is the sprite color.
These are just like decals. See my decal tutorials for
Photoshop and for Paint Shop Pro.
The three examples below show how this sprite changes in
the game, depending on what you choose for the last
palette color:
1 > After you've extracted
mommaspit.spr out of the pak file, open it up with the
sprite viewer.
2 > Save it by choosing 'File' then
'Save sequence...' and name it mommaspit.bmp. It will
save all 4 frames as mommaspit00x.bmp
3 > Open them in a paint program and
edit them. Paint something new, change the color and
resize them. All frames must use the same palette, and
paint programs usually have a way to save and load the
palette. Then save them.
4 > Set up the sprite.qc and compile
it by running sprite.bat. This is how the .qc file is
already set up, but you can change it:
//
mommaspit
//
$spritename mommaspit
$type vp_parallel
$texture indexalpha
$load mommaspit001.bmp
$frame 0 0 32 32
$load mommaspit002.bmp
$frame 0 0 32 32
$load mommaspit003.bmp
$frame 0 0 32 32
$load mommaspit004.bmp
$frame 0 0 32 32 |
5 > Copy mommaspit.spr to the
half-life\valve\sprites folder and you're done.
Advanced
Topics
$frame is for offsets (x,y) and size
(x,y). Offsets are used when you want to split up one
bitmap into a sequence of frames. X and Y indicate where
the top left corner starts in the bitmap. Size has to be
multiples of 8 and can be smaller than the file's
dimensions.
valid $texture types are:
additive
- Additive sprites can have 256 colors
and are blended with additive
transparency:
|
Includes all sprites except
ones listed below. This is the most
common type. |
|
|
|
indexalpha
- These are grayscale but show up as
color in the game, with the palette as
the alpha channel. Black is transparent
and white is opaque. The last color in
the palette is the sprite color:
|
bigspit.spr
bubble.spr
mommablob.spr
mommaspit.spr
mommaspout.spr
oriented.spr
steam1.spr
tinyspit.spr
vp_parallel.spr
vp_parallel_oriented.spr
wallpuff.spr |
|
|
|
alphatest
- These can use 255 colors with the last
one used for transparency:
|
agrunt1.spr
bhit.spr
blood.spr
blooddrop.spr
bloodspray.spr
crosshairs.spr
explode1.spr
rope.spr |
|
|
|
normal
- same as additive in practice, full
color, no blending or transparency:
|
lgtning.spr
Note: this sprite was set as additive in
Valve's sprite.qc, but was set to normal
in the .spr. Since it ends up being the
same as additive in the game, I'd
recommend using that instead of normal. |
|
|
|
If there are any questions or comments, feel free to email me.
|