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

7,282 visits, 16,606 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.

Published on 8 Jan, 2014. Last updated 19 Feb, 2019

Method 3 - Light in an arc

Have a look at "Cast light arc 01" - This shows the last method I have been using to cast light/shadows. Run the program and move the mouse/sprite over the arc of red "light".

All this is doing is creating a long thin sprite "my light beam" and moving it through a set number of degrees. When this light beam touches an obstacle that particular light beam is destroyed.

A rather obvious problem is we are now left with a triangular shadow coming from the obstacle to the light source.

A simple solution to this is to reduce the light beams length on striking an object.

(see cast arc light reducing length.capx)

Note that I have each light beam set to fade out - there are other ways to do this but this is simple and it works.

To incorporate this method into a game then the light you would need to move these beams onto another layer and set the blend as previously discussed. The arc start point would need to be placed where the player is and the arc angle would need to take the players angle into account.

(Cast forwards 3.capx)

Well I guess that will do. Please leave a message with any question, comments or suggestions.

Have fun.

RPW

edit 6th April, 2014.

Added a couple more capx for you to have a look at - one cuts up the light into sections to get around the problem of long walls and the other is the fog test (see below). Both could do with tidying up and commenting...

.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
  • 1 Comments

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