To use 2d mask in Godot you need to use Light2d.
- Prepare mask in graphic editor, use white / alpha. Let the part that should be visible be white, the part that should be invisible should be totally transparent.
- Add Light2D node to the scene, ensure it's
enabled
(Enabled = true)
- Load your mask to the light with Texture property.
- Set light to
mask
mode (Mode->Mask)
- In
Range
section of the light take a note on what is the value of 'Item Mask
- Add ordinary sprite node that should be affected by the mask, setup it.
- In 'Canvas Item' section ensure that
Light Mask
property is corresponding to Item Mask
property of the light.
If you will have any problems check one of the demos, which illustrates how to use masks, demo is called "Using lights as mask", you can find it here: http://godotengine.org/download (Demos and Examples)