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.
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.
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.
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.
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.
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.