[comp.sys.amiga] Some shadow suggestions

Chad_The-Walrus_Netzer@cup.portal.com (01/18/88)

In article  <1617@ssc-vax.UUCP>, (David Geary) writes:


>Anyway, in article 1606, I wrote:
>
>> I am in the process of developing my own version of Arkanoid...
>>
>> 2)  How can I put shadows underneath the boxes, paddle and ball? ...
>>     I want the background to show through the shadows. I'd like shadows
>>     similar to the shadows that Dropshadows creates on workbench.
>
>In article 4972, Leo Schwab writes:
>
>>  You should be able to get away with 8 colors on an arkanoid clone.
>>  Open a 4-plane screen (16 colors), then make colors 8-15 dimmer versions
>>  of colors 0-7.  Then, when you want to render a shadow, set your
>>  RastPort.Mask value to 0x08, and draw a slightly offset rectangle...
>
>Leo's suggestion sounds good to me except that I will have a pattern on
>the background that I want to show through.  Should I copy a rectangle
>from the playfield into a buffer, set the RastPort.Mask to 0x08, and
>then render the rectangle I copied back on to the screen?  Another
>consideration is that the shadows for the boxes can all be rendered
>with rectangles, but the baton's shadow is odd shaped.  How do I
>deal with that?  These *#$% shadows are really the only thing
>(besides lack of time) that is holding me back from getting
>this thing off the ground, so I'd really appreciate any
>responses I get from anyone out there in NetLand.
>

Well...
    My suggestion would be to render (for all the background objects) the
shadows first, by writing 1's into any place where you want a shadow to
be, using the additional bitplane (as outlined by leo Schwab).  Then,
when you draw the the scenery, the shadows will appear automatically,
assuming you have your color palette and screens set correctly (again,
as outlined by Leo Scwab).
    Now as for the baton, and other MOVING shadows, that's really no
problem.  Again, just draw the shadow of the object (using the BOB's
collision mask, or your own, which will already be a mask of the
object) into the shadow bitplane, at the appropriate offset.  Then draw
the object.  This will eliminate any overlap garbage between the object
and its shadow.   The only hard part will be collision handling between
shadows and another object (or between two shadows if you draw them with
COMPLEMENT mode).  This can be handled by drawing ALL moving shadows
first, then ALL moving objects, and explicitly writing 0's into the
shadow bitplane when rendering objects (thus turning off the shadow
effect, and making it go behind the object).   It can all be pretty
automatic, actually, if you set up your BOBS right.  Even if you don't
use BOBS, it would still be somewhat trivial (That extra bitplane, and
the right color table is THE key to making this easy!!!!!!!!!!
     If you need me to clarify, don't hesitate to ask.  And if you can
spare the source for any tricky parts, it would be easier to give more
 specific code examples. 


                    Chad "The Walrus" Netzer