The Land Of Light and Shadows (Part 3)

2

Index

Attached Files

The following files have been attached to this tutorial:

.capx

part-3-simple-with-layers.capx

Download now 192.27 KB
.capx

part-3-simple.capx

Download now 179.41 KB
.capx

part-3-very-simple.capx

Download now 179.75 KB
.capx

ball-shadow.capx

Download now 428.71 KB
.capx

line-of-site-full-grid.capx

Download now 310.91 KB
.capx

line-of-site-cone.capx

Download now 243.97 KB
.capx

cast-light-arc-01.capx

Download now 248.66 KB
.capx

cast-light-arc-reducing-length.capx

Download now 248.68 KB
.capx

cast-forwards-3.capx

Download now 318 KB
.capx

fog-test-01.capx

Download now 532.27 KB
.capx

cut-up-light-length.capx

Download now 318.01 KB

Stats

6,760 visits, 15,828 views

Tools

License

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 !

  • 1 Comments

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