The source code for this simple example is available here. Although be aware it uses the Box2D physics library for handling the shapes, so some of the source may be confusing if you’re not familiar with that library.
A demonstration of the 2D shadow effects that I discuss in a tutorial on the TIGSource forums that I wrote a while ago. Just a series of rooms that you can walk through. No source code for this one because frankly it’s a bit of a mess. It’s the same technique as used in the first example, just applied to a more overtly game-like setting.
W, A, S and D to move, space bar to toggle the light on your faerie companion.