r/godot•
Trogath123

Using Multiple Nodes as a mask for an image

help me

I am working with a purely 2D godot scene, and I want to have a several shapes act as "flashlights" or "windows" essentially showing the hidden image to the player, wherever their shape is. Is there some way to accomplish a mask with multiple nodes being the mask in godot4?

I can do this very easily if I only have 1 shape, as I just use "Clip Children" and make the hiddenImage a child of the shape, however, as soon as I want to have multiple shapes, I can't figure out a way to make this work (short of having multiple copies of the image).

~~ There seems to be a masking function with Light2D~~ This looks to be removed in Godot4.

Structure (as I imagine it):

Root (Node2D)

--HiddenImage (Sprite2D)

--MaskContainer (Node2D)

----SquareMask (Sprite/Panel/etc)

----CircleMask (Sprite/Panel/etc)

----SquareMask2 (Sprite/Panel/etc)

Posted Apr 15, 2025, 7:30 PM UTC

13
Loading comments…