Flashlight - Shadow Casting Plugin

Index

Stats

1,212 visits, 2,110 views

Translations

This tutorial hasn't been translated.

Tools

Editor Layout

Open up the insert-new-object window and select a Flashlight object and place it in the layout.

Once dropped in the layout it will behave like a Sprite and the image editor will open so you can set images, animations, collision polygons and imagepoints in the usual way. Select or draw an image for your light source. One quick way to draw your own light image is to select Brush with a size equal to the image width and the hardness set to zero - click once or twice in the middle and that’s it.

There are two ways to use Flashlight to create a shadow effect and both of them will be covered in detail later in this tutorial. For now, let’s look at the editor properties list:

The first 5 properties are similar to other c2 objects and these won’t be covered here.

Shadow objects. This is where you can choose what sort of objects will cast shadows. Your options are: Solids, Flash-Shadow and Other. The selection bounds what type of objects it will search for to draw shadows. Solids includes all Solid objects and Jump Through objects. Flash-Shadow is the helper behavior plugin that comes with Flashlight – if it is added to an object that has Solid behavior then it adds some more options (covered later) but here you can set whether the plugin will just search for objects with the Flashlight Shadow behavior (ie objects with Solid won’t cast shadows unless they have Flashlight Shadow, and non-Solid objects will cast shadows if they have Flashlight Shadow). The final Other option allows you to pick only those object types that have been added using events. More on all of this later.

Light height. This is the height of the light above the layout, in pixels. If the light height is set to greater than zero and the other objects have a Flashlight Shadow behavior with an object height set to greater than zero, then the cast shadow shape will depend on the relative heights of the light and the object.

Light radius. If you set a light radius to greater than zero then all infinite shadows will be drawn with a penumbra effect (infinite shadows are drawn when the light height is zero). If the light height is greater than zero then no penumbra effect will be present.

  • 5 Comments

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