Godot 3 2D Day/Night Cycle

An asset by hiulit
The page banner background of a mountain and forest
Godot 3 2D Day/Night Cycle hero image

Quick Information

0 ratings
Godot 3 2D Day/Night Cycle icon image
hiulit
Godot 3 2D Day/Night Cycle

A 2D β˜€οΈ Day / πŸŒ” Night cycle using CanvasModulate and a moon light effect using Light2D.

Supported Engine Version
3.2
Version String
3.0.0
License Version
MIT
Support Level
community
Modified Date
3 years ago
Git URL
Issue URL

Godot 3 2D Day/Night Cycle

README Godot v3.x README GitHub release (latest by date) README GitHub license

A 2D β˜€οΈ Day / πŸŒ” Night cycle using CanvasModulate and a moon light effect using Light2D.

README Godot 3 2D Day/Night Cycle Banner

Examples

README Cycle without the moon light

Cycle without the moon light.

README Cycle with the moon light static

Cycle with the moon light static.

README Cycle with the moon light moving

Cycle with the moon light moving.

πŸ•ΉοΈ Demo

  • Clone the repository or download it in a ZIP file.
  • Open day_night_cycle/project.godot.
  • Play around πŸ™‚.

πŸ“‘ Documentation

πŸ› οΈ Setup

  • Clone the repository or download it in a ZIP file.
  • Copy the following files and folders to your project:
    • Time.gd file (day_night_cycle/src/Singletons/Time.gd).
    • DayNightCycle folder (day_night_cycle/src/DayNightCycle).
    • MoonLight folder (day_night_cycle/src/MoonLight).
    • DebugOverlay folder (day_night_cycle/src/DebugOverlay).

πŸš€ Usage

Prerequisites

Add the Time singleton:

  • Go to Project -> Project Settings.
  • Go to the AutoLoad tab.
  • Add the Time.gd file.
  • Enable it.

README Enable the Time.gd singleton

Change the Time parameters to your liking.

Add a simple cycle

Instance the DayNightCycle node in the root scene.

Node
β”œβ”€β”€ TileMap
β”œβ”€β”€ Player
β”œβ”€β”€ OtherStuff
└── DayNightCycle

Change the DayNightCycle parameters to your liking.

Add a cycle with a moon light

Instance the DayNightCycle node and the MoonLight node in the root scene.

Node
β”œβ”€β”€ TileMap
β”œβ”€β”€ Player
β”œβ”€β”€ OtherStuff
β”œβ”€β”€ DayNightCycle
└── MoonLight

Sync the MoonLight with the DayNightCycle.

The MoonLight can be static or moving in sync with a DayNightCycle.

Change the DayNightCycle parameters and the MoonLight parameters to your liking.

Add a delay between cycles

  • Create a CanvasLayer for the background and set its layer to -1.
  • Instance the DayNightCycle node in the background CanvasLayer previously created.
  • Instance another DayNightCycle node in the root scene and add a delay.
  • Instance the MoonLight in the root scene and sync it to the DayNightCycle node with a delay.

Something like this:

Node
β”œβ”€β”€ CanvasLayer (layer = -1)
β”‚   └── BackgroundSprite
β”‚   └── DayNightCycleBackground (delay = 0)
β”œβ”€β”€ TileMap
β”œβ”€β”€ Player
β”œβ”€β”€ OtherStuff
└── DayNightCycleForeground (delay = 1800)
└── MoonLight (cycle_sync_node_path = DayNightCycleForeground)

This will create the effect that the background starts changing before the foreground.

Add a debug overlay

Test the passing of time, the cycles and the moon light.

README Debugg overlay example

  • Create a CanvasLayer and set its layer to 1.
  • Instance the DebugOverlay node.

Something like this:

Node
β”œβ”€β”€ TileMap
β”œβ”€β”€ Player
β”œβ”€β”€ OtherStuff
β”œβ”€β”€ DayNightCycle
β”œβ”€β”€ MoonLight
└── CanvasLayer (layer = 1)
    └── DebugOverlay

πŸ—’οΈ Changelog

See CHANGELOG.

πŸ‘€ Author

hiulit

🀝 Contributing

Feel free to:

πŸ™Œ Supporting this project

If you love this project or find it helpful, please consider supporting it through any size donations to help make it better ❀️.

README Become a patron

README Suppor me on Ko-Fi

README Buy me a coffee

README Donate Paypal

If you can't, consider sharing it with the world...

README

... or giving it a star ⭐️.

πŸ‘ Credits

Thanks to:

πŸ“ Licenses

A 2D β˜€οΈ Day / πŸŒ” Night cycle using CanvasModulate and a moon light effect using Light2D.

Reviews

0 ratings

Your Rating

Headline must be at least 3 characters but not more than 50
Review must be at least 5 characters but not more than 500
Please sign in to add a review

Quick Information

0 ratings
Godot 3 2D Day/Night Cycle icon image
hiulit
Godot 3 2D Day/Night Cycle

A 2D β˜€οΈ Day / πŸŒ” Night cycle using CanvasModulate and a moon light effect using Light2D.

Supported Engine Version
3.2
Version String
3.0.0
License Version
MIT
Support Level
community
Modified Date
3 years ago
Git URL
Issue URL

Open Source

Released under the AGPLv3 license

Plug and Play

Browse assets directly from Godot

Community Driven

Created by developers for developers