Fill shape with pattern [SOLVED]

Hi,
In my game I need to draw mountains with lots of different shapes and I’d like to fill them with a pattern or shades. However I’m already able to do it, using a solid color, with shape painter or triangle sprites.

This is what I’d like to get (I’ve done it with a graphic software)
Pattern

Maybe a solution could be to do some triangle “transparency holes” in the background, in order to show the pattern image in the back, but I don’t know how to do.

Thanks in advance for any help

Hello,
I think you can also use Tiled Sprite object, rotate it 45 degree angle, and place on top of the solid colour.

1 Like

Fill patterns and masks are not available.
I have started a new development branch for something similar to mask.
Remove a color present in an object. This is on hold because the engine is changing a lot at the moment and I don’t want to rewrite my code in the coming months.

Nothing planned or wip about fill pattern sorry.

Maybe something can be done with effects layer, i’ve said maybe! not sure!
You need make research about blending mode / blend mode.

This is a very good idea, but my angle is of 54°

I’m more interested in masks than fill patterns.
I’ve found nothing interesting with bend mode, maybe I will try with layer, but the wiki is incomplete.
I hope your development will work soon!

1 Like

Hi again!
Just a question: is it possible to add an alpha mask using the JavaScript code inside GDevelop?

There is a new extension for this, you need download it manually for now.
Find the repository of GDevelop on GitHub. Go on 4ian profile. Find a repository GDevelop-extension. Go in tab pull request and see the extension, go in commit or the other tab on right and copy the content of the file who don’t have .header in the filename. Sorry I’m on my phone.

1 Like

It works! Thank you very much!

If I could propose a little improvement: giving the choice between “clipping mask” (like it actually is, if something is not in the mask sprite then is cropped) and “hiding mask”(?) (if something is not in the mask sprite then is visible) for making simpler adding an hole without using a sprite as big as the game scene.
It could be very interesting making it compatible with the shape painter too.

I think this mask extension will be very useful, we can get lots of effects using it!

A teleport effect obtained with the mask extension
https://games.gdevelop-app.com/game-5ad8827b-e7bb-46f2-a873-9e6976a0596b/index.html

X-ray effect:
https://games.gdevelop-app.com/game-d6000057-a850-4b6d-b852-5aebbccab290/index.html

EDIT: The first example doesn’t work on my android phone

A sprite of 10000x5000 !
If you exceed 2048px it’s very large, never do what you do, 10000x5000 is abused.
Btw with my internet fiber i can’t load your game, maybe it’s your giant sprites, or the server. idk but 10000x5000 :o

Yes, I did it in hurry starting from an high resolution image. But it was a black and white mask, so not so big.

Now it works on the the mobile too: https://games.gdevelop-app.com/game-f25fd432-295f-488b-8752-537ab2ae3534/index.html

How I install these extensions? There are not any file to download.

https://github.com/4ian/GDevelop/tree/master/Extensions/Effects

This is off topic. Make your own topic next time.
Those are built in extensions. There is nothing to install.