I want to add darkness in my 2D game.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Montasir Raihan

Hello guys, I’m making a 2d top down shooter game and it works perfectly. I’ve added some difficulties in my game. But I want to make my stage dark. A light will follow the hero and players will be able to see a certain amount of area. Can you tell me how to do this? Or give me a clue or something?

Hi!
For adding “darkness” just ad a CanvasModulate node, and change its color to something dark.

Lights in the lame layer will make the areas where they reach less dark. Check out this:
User kaylamarquez - Godot Engine - Q&A

kaylamarquez | 2023-02-08 21:34

A light will follow the hero and players will be able to see a certain amount of area. Can you tell me how to do this? Or give me a clue or something? for more you can read User brendaray - Godot Engine - Q&A

brendaray | 2023-02-08 23:02

For adding “darkness” just ad a CanvasModulate node, and change its color to something dark.

Lights in the lame layer will make the areas where they reach less dark. Check out this
User joyceconley - Godot Engine - Q&A

joyceconley | 2023-02-09 00:03

A light will follow the hero and players will be able to see a certain amount of area. Can you tell me how to do this? Or give me a clue or something? for more you can read
User DiannHays - Godot Engine - Q&A

DiannHays | 2023-02-09 01:39

:bust_in_silhouette: Reply From: p7f

Hi!
For adding “darkness” just ad a CanvasModulate node, and change its color to something dark.

Lights in the lame layer will make the areas where they reach less dark. Check out this: Limited player vision with lights · GDQuest

And this is the project of that tutorial: https://github.com/GDQuest/godot-mini-tuts-demos/tree/master/2d/limited-player-vision

It also includes how to make things invisible like in among us, but you have the basics covered there.

Thank you very much. It really solved my problem.

Montasir Raihan | 2020-10-26 23:17

I’m glad to help!

p7f | 2020-10-27 00:52

:bust_in_silhouette: Reply From: customcabinetsnc

A light will follow the hero and players will be able to see a certain amount of area. Can you tell me how to do this? Or give me a clue or something? for more you can read: www.customcabinetsnc.com
https://godotengine.org/qa/user/customcabinetsnc