Update:
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 🙂
I want to credit George for the wizard sprite, and Studio Evil for the ground texture.
The sample can be downloaded here: dynamicshadows.zip
Pingback: Catalin Zima - XNA and HLSL blog » April Sample Online!
Pingback: XNA Game Development « XNA Scratch
Pingback: Catalin’s XNA Experiments » Working on shadows…
Pingback: Blind « AwkwardGames – Quote: "AwkwardGames ftw!"
Pingback: Jeff On Games » Posted Without (Too Much) Comment