Dynamic 2D Shadows
The XNA 4.0 version for Windows Phone 7 is available here: HardShadowsWP7.zip
This sample shows an implementation for dynamic 2D shadows in XNA. The code is based on an article from GameDev.net, written by Orangy Tang, but only implements hard-edged shadows.
As exercises to further understand the sample, you could try some of the following:
- Make some objects (ConvexHull) move around
- Add other lights, and modify their parameters
- Add player-world collisions. This shouldn’t be too hard, since you already have the ConvexHull class.
- Switch on/off the light surrounding the wizard
- Try various texture for light
- Make the player drop shadows. (Hint: switch off player light, and make a ConvexHull object that surrounds the player, and moves together with him)
The wizard character is controlled by the directional keyboard keys. My wired GamePad was not available these days
The sample can be downloaded here: dynamicshadows.zip