You can use the Sprite Masking extension for this purpose.
I would like to see a Stencil or Window feature in GDevelop. A simple sort of bounding box or polygon where anything within the polygon would be rendered and anything outside the polygon would not be rendered. First of all, this is a feature widely seen in most complete game engines, and, as far as I’m concerned, is probably the only thing keeping GDevelop from being a game engine in which anything can be created with enough time and patience.
Why am I requesting this feature? First of all, it is the seemingly only feature which GDevelop lacks on the 2D plane.
Secondly, I don’t believe there is already a way to do this, and I have been wondering for a while. It’s likely not possible to do with extensions as it would probably have to change the rendering part of the engine itself. Defold has this feature. Godot has it. Unity has it. Unreal has it. All the large game engines have this stencil rendering feature.
And the fact that GDevelop lacks a rather basic building block of building some parts of games is rather sad.
Lastly, what is some supporting evidence? Well, I’ve already stated that there is no way to accomplish this (to my knowledge) and that alone is rather justifiable. However, why would someone want to use a stencil? To make something go behind something it’s normally in front of in an obscure position. To create a 2D portal for the player to go through. To crete tileable animated textures. Well, for that matter, animated textures in general. Take for example Minecraft enchantment effects. The affected object has glistening ripples, moving up the object within a rendering box which is only on the item.
You would be able to create UI elements which would previously have been impossible. Why can IOS, which I am typing this on, even allow some things to look the way they do? Rendering boxes. They are a feature which beginners on Scratch, etc can live without. But more advanced programmer, at some point, will likely desire this feature.
The user experience, too, would likepy be quite simple. You could create a new object just like when you make a sprie or tilemap, or anything else, only there would be a stencil object type. Upon creation, it will ask for another object to be “linked” to. The linked object will only be rendered inside the polygon. The polygon could possibly be edited with math, but that’s a bit complex. Furthermore, multiple objects could be “linked” to one stencil. This would allow for a unique way of programming and a set of possibilities not before heard of within GDevelop.
Because of all of these reasons and more, I ask for this feature.
- MarsChompsVenus
 
(Sorry if someone’s already asked for this, the topic did not seem to come up in any searches)