Active Room darkening

Godot Version

godot-4 gdscript


I’m not sure if this is the exact right place to ask this because I’m pretty new to the Godot community but I need help with a problem I can’t even begin to know how to ask. I’m a refugee from the crap storm that happened with unity’s pricing so I’m gonna use terminology from that to try and get my point across, please feel free to correct me so I can get used to the Godot terminology.

I’m making a 2d top down exploration game kinda similar to Zelda but that’s a loose comparison. I have a camera that follows the player exactly and I’d look to make it so it can’t see into adjacent rooms the player is walking by.

My thought is, in unity terms, using a trigger collider that has a black rectangle attached to it so when the player is within that collider the rectangle turns off and reveals the room and when the player isn’t in the collider the rectangle turns back on and conceals the room and it’s contents.

I have no idea how to do this and would appreciate some help making it happen.

What you want is an Area2D in Godot terms, just wire the signals so they show or hide the black rect as appropriate, it should be as easy as in Unity.

1 Like

Awesome, I’ll look into that. thanks

To add to what Efi said - a Player object will generally extend a “body” node (usually CharacterBody2D) so you want to connect to body_entered/exited signals instead of area_entered/exited ones.

The “body” or “area” in signal name refers to type of object that enters/exits Area2D.

Also if you want to learn about most core objects, this 13-hour hands-on tutorial is excellent: