In this course, you’ll learn various expression techniques using ACTION GAME MAKER.
In the second session, we’ll focus on creating light and shadow effects.
Preparation Before Starting the Course
We’ll continue using the project from the first session.
Please open the project and get it ready.
STEP 1: Let’s Set Up a PointLight2D
- Open the
game_scene
tab and select ObjectRoot
.
- Add a new node:
PointLight2D
.
You won’t see anything immediately—that’s because no texture is assigned yet.
- In the FileSystem, go to
templates > other
and drag 2d_lights_and_shadows_neutral_point_light.webp
into the Texture property of the PointLight2D
in the Inspector window.
- A white light should now appear. That’s all you need to set up a basic light, but here are some commonly used properties to experiment with:
- Texture Scale: Adjusts the size of the texture.
- Color: Changes the light’s color.
- Energy: Controls the brightness of the light. Higher values result in stronger light.
- Next, let’s enable shadows. Turn on the Enabled checkbox under the Shadow section.
That’s all you need to activate shadow processing.
Tiles and characters provided in the sample are already set up to cast shadows by default. Move the PointLight2D
close to them, and you should see the shadows appear.
- In the next STEP, we’ll cover how to set up objects to cast shadows.
Notes
About the Texture
In this tutorial, we used a simple circular light texture. But you can create any shape you want—like a cone for a flashlight beam.
The texture should be black and white, where black becomes transparent. You can also create your own custom textures.
Using AnimationPlayer
Properties such as color, scale, and energy can be animated using AnimationPlayer
, allowing you to make effects like flickering lights.
For details on using AnimationPlayer
, refer to the Graphic Course.
STEP 2: Create Shadow Collisions with LightOccluder2D
- To generate shadows, you need to set up a dedicated shadow collision using a
LightOccluder2D
.
Let’s add a LightOccluder2D
to a sample object.
- Open
Decoration_Statue.tscn
from the sampleobject
folder.
- Add a
LightOccluder2D
node.
- In the Inspector, create a new
OccluderPolygon2D
.
- At the top of the editor window, select the point-drawing tool from the toolbar and draw a polygon inside the statue.
You can create complex shapes, but they are more resource-intensive. For now, it’s best to keep the shape simple.
- Try placing
Decoration_Statue.tscn
within the light area created in STEP1.
A shadow should be generated along the shape of the polygon.
Notes
Shadow looks unnatural?
Try changing the CullMode
of OccluderPolygon2D
to Clockwise or Counter-Clockwise.
If you placed the points in a clockwise direction, choose Clockwise, and if counter-clockwise, choose Counter-Clockwise.
Want smoother, more detailed shadows?
You can adjust shadow quality in the PointLight2D
settings.
Change the Filter in the Shadow section from None (Fast) to PCF5 or PCF13.
This will make the shadows appear softer and more refined—though it may impact performance.
Want to add shadows to tiles?
To add shadows to tiles, go to your TileSet settings and define the polygon under Rendering > Occlusion Layer
.
However, in ACTION GAME MAKER, if you’re using autotile format, the occlusion layer is automatically set—so in most cases, no additional setup is needed.
STEP 3: Try Using DirectionalLight2D
- Open the
game_scene
tab and add a DirectionalLight2D
node as a child of BaseLayer
.
- The screen may become extremely bright, so reduce the Energy to around
0.4
.
DirectionalLight2D
simulates sunlight.
If you set the Color to bluish tones, it will resemble nighttime or dawn.
If you set it to reddish tones, it can look like sunset.
- You can also enable Shadows to generate shadows.
By default, the light shines directly from above.
Adjust the Rotation in the Transform section to set the light direction at an angle, which gives a more natural appearance.
That concludes Tutorial: Visual Effects Course #2 – Lights and Shadows.
Next tutorial:
https://guild.rpgmakerofficial.com/t/topic/66?u=ggg-administrator