+1 vote

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?

in Engine by (137 points)

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:
https://godotengine.org/qa/user/kaylamarquez

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 https://godotengine.org/qa/user/brendaray

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
https://godotengine.org/qa/user/joyceconley

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
https://godotengine.org/qa/user/DiannHays

2 Answers

+4 votes
Best answer

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: https://www.gdquest.com/tutorial/godot/2d/limiting-vision-with-lights/

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.

by (3,505 points)
selected by

Thank you very much. It really solved my problem.

I'm glad to help!

0 votes

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

by (14 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.