Mail Archives: djgpp/1997/03/30/19:06:22
In article <33387866 DOT 3593 AT oce DOT nl>, A. Jans-Beken <jabe AT oce DOT nl> wrote:
>In a game I am working on I want objects to cast shadow on the ground.
>With Allegro it is possible for graphic object to regard color 0 as
>transparent. What do I have to do to replace color 1 with the current
>background color minus (for example 3).
Allegro 2.2 has many transparent drawing functions, as well as lighting
functions.
A possible idea is to create a seperate bitmap containing a mask of your
sprite with colour 255 as the background and a lower colour where the sprite
is. Using Allegro's lighting features, use this 'shadow' bitmap to illuminate
where the shadow is to appear. The areas with colour 255 will remain the same,
but the shadow gets darker depending on how low the other colours are.
However, you will have to choose a good palette with darker versions of the
main colours you are using for where you want your shadow to go. In fact, you
could even vary the intensity of the shadow at different parts by having
several colour values in the shadow bitmap. This would be good for anti-aliased
shadows.
AE.
--
Andrei Ellman - URL: http://www.xs4all.nl/~ellman/ae-a - ae1 AT york DOT ac DOT uk
"All I wanna do is have some fun :-) || ae-a AT minster DOT york DOT ac DOT uk
I've got the feeling I'm not the only one" || mailto:ellman AT xs4all DOT nl
-- Sheryl Crow :-) || It's what you make of it.
- Raw text -