2D Day/Night Cycle
This Godot 3 project provides a 2D day/night cycle using CanvasModulate and Light2D for a moon light effect. It includes examples for cycles with and without moon light, and features a debug overlay for testing.
https://github.com/hiulit/Godot-3-2D-Day-Night-CyclePreview Images




2D Day/Night Cycle in Godot 3
This project offers a ready-to-use 2D day/night cycle implementation for Godot 3. It utilizes CanvasModulate to simulate the changing ambient light throughout the day and night. A Light2D node is used to create a moon light effect, enhancing the visual appeal of the night cycle.
Key Features
- CanvasModulate: Implements the core day/night cycle by adjusting the overall color of the scene.
- Light2D: Creates a dynamic moon light effect that can be static or move in sync with the day/night cycle.
- Time Singleton: Manages the passage of time within the game, allowing for easy customization of cycle duration.
- Debug Overlay: Provides a visual representation of the current time and cycle state, aiding in development and testing.
Usage
The project includes detailed instructions on how to integrate the day/night cycle into your Godot project. This involves copying specific files and folders, adding the Time
singleton to the autoload list, and instancing the DayNightCycle
and MoonLight
nodes in your scene. The system supports adding delays between cycles and implementing a debug overlay for testing purposes. Example code and node setups are provided to facilitate easy integration.