I decided to port Matt Greer's work with 2D dynamic lighting for 2D games to C2 (I modded a bit the original shader to conform to C2's IDE).
The yellow square is the ligh source.
The work is described here : http://www.mattgreer.org/post/4dynamicLightingShadows
The idea is to use a Sprite, like this one :
and put another one on top of it, with normals "baked in" :
(don't forget to put everything not colord in that normal image to transparent !)
You can then apply the effect to the normal image, to get the effect you can see in the top screenshot.
The parameters of the image are the "Image Color" (you need to set all 3 channels to the same color for the moment), higher-value = darker shadows.
You can set the light direction with the same values as in the example.
The (x,y,z) vector set the postion of the light over the texture.
lower Z = ligther shadows.
You can set the value for the (X,Y,Z) position of the light like in the example :
Here, the light is going to follow the mouse, always facing the center of the image.
For that, I use a invisible Sprite, in red in the following screenshot, in the center of the scene. The light is always going to face it.
You can, if you want have several "Points Of Origins" in your scene, and change the POI the light is facing dynamically in your game, to have nice effects !
The demo : https://dl.dropbox.com/u/1412774/Lighti ... index.html
The effect (decompress it in the 'effects' folder !) : https://www.dropbox.com/s/kw6myraxljvek9h/pode_dynamic_lighting.zip?dl=1
The .capx : https://www.dropbox.com/s/o990ez8k972tm6a/LightingDemo.capx?dl=1
If you cant find your pode stuff on the scirra forum you maybe find them here:
https://github.com/Pseudopode/construct2_plugins_behaviors