From: ellman AT xs4all DOT nl () Newsgroups: comp.os.msdos.djgpp Subject: Re: Allegro - shadow of sprites Date: 30 Mar 1997 21:18:23 GMT Organization: XS4ALL Message-ID: <5hmlav$57l$1@news0.xs4all.nl> References: <33387866 DOT 3593 AT oce DOT nl> NNTP-Posting-Host: xs1.xs4all.nl Lines: 28 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp In article <33387866 DOT 3593 AT oce DOT nl>, A. Jans-Beken 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.