The Land Of Light and Shadows (Part 3)



Attached Files

The following files have been attached to this tutorial:



Download now 192.27 KB


Download now 179.41 KB


Download now 179.75 KB


Download now 428.71 KB


Download now 310.91 KB


Download now 243.97 KB


Download now 248.66 KB


Download now 248.68 KB


Download now 318 KB


Download now 532.27 KB


Download now 318.01 KB


5,873 visits, 14,343 views



This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Lets look at version two ("Part 3 simple.capx")

So every tick we :

set our light image to where the mouse is

find out how far to the left (or right) the light is compared to the building simple by taking the mouse x position away from the building x postion this gives us the distance and the direction (a positive result show that the mouse is to the left, negative to the right) and we set this to a global variable called gvLightOffSetX

do the same for up and down offset (gvLightOffsetY)

then we offset the shadow from the buildings position by adding the gvLightOffsetX and gvLightOffsetY to the buildings x and y location.

Try changing gvShadowOffset at the top of the sheet from 10 to 1 or 5 or 20 and see what happens. Using different values here creates different offset amounts. Could be used to cast a shadow from a plane onto the ground below - alter the shadow offset to simulate the planes height ...

Finally in "Part 3 with layers.capx" :

We add a Shadow layer

We use an alpha image on "Layer Shadow" to see through this layer to the main layer below.

We constantly update the alphas x and y position to match the mouse x and y.

I am going to post this now - it is not finished but I will edit in the extra bits as I go along. I thought I would have had this finished by now and at this rate it will be the weekend at best - so have a read of this to be going on with.

I'll be back...

I'm back !


  • Order by
Want to leave a comment? Login or Register an account!