[SOLVED] Ideas on how to have a BnW world but see colors in a radius around the player

The player has a distance around itself where the color is normal and black/white on the outside.

this is a gif from Construct 3 (NOT Gdevelop):

I can achieve this in Construct 3 by placing a gray box over the entire area, then having a round objects blend mode to: “Destination out” and then placing it under the gray box with Z-order so it will “cut a whole” in the gray box because of its blend mode.
trying to do the same in Gdevelop but I can’t find any blend mode that lets me do this effect.

I tried messing with the Object Masking addon but never figured out how to achieve the effect I wanted.

I obviously might have overlooked some things here, but I would appreciate it if someone could take the time to help me out. Thanks!

and no, I rather use Gdevelop than pay for Construct 3.

Solution here.

here is a “Xray/ masking” if that is more inline of what you are looking for. <-for people in the future.

This may sound annoying, but you might have to make the gray scale effect a sprite, and then use the object masking. you can automate that in gdevelop though using the screenshot extension, it allows to take a screenshot of your game and then set it to the sprite of an object.

good idea, but the game world is not static so I guess that wouldn’t be a good solution in the long run.

oof, lemme try some stuff

i had a silly idea, why not just make moving objects have the mask too?

true, but seems like a way roundabout way of doing it.
According to this post, GDevelop uses PixiJS witch from the looks of it have the src_out option. soo is there any way with code I can make that a filter for a sprite?

sadly i dont know a lick of javascript, so someone else is gonna have to help with this.

PixiJS webGL does not support src_out.

As mentioned in the thread you linked, it supports Normal (no blending), additive, multiply, and screen.

I’m not too familiar with the filters but there are layer filters, object filters, some objects like sprites have both tint and blend modes. Plus as you said there’s masking and there might be other helpful extension.

The only issue is I believe some filters require a lot of process time.

You might be able to do it as you envision. You might need to adjust your strategy. Maybe mask the background or some other method and then add/remove the color on the entire object.

Unfortunately, you.cant create negative mask not that I know if that would help. Athough, the Marching Squares extension somehow creates irregular masks. There are marching square examples. They might help. IDK.

so… Guess I would need to change to another engine then…
there is no way of making a custom extension/Java code that achieves this effect?

Java and javascript are not the same thing. GDevelop uses Javascript.

Object Masking is already a javascript extension that does what you want, there would be no point in writting a whole new extension just to realize that it acts the same as Object Masking, you probably did not know how to setup your events to achieve that effect, but it is possible and not hard.

I will replicate this construct thing in a project here

if you could take the time that would be great!

Here: I actually spent more time in the art than the events itself.



nice work!! Thanks. I see you have created a “notColor” / “color” version of everything, could you elaborate on how this is set up?

Once the game loads up, all uncolored objects will create and apply a link to a colored version of them with a ZOrder of "NotColor.ZOrder() - 1 " (meaning that they will be created behind the uncolored objects)

Once the red circle enters in collision with an uncolored object, it takes the color object it is linked to, and move its ZOrder + 1, meaning that they will be displayed above the uncolored object.

Then, it applies the object masking using the red circle as the mask, so the colored object is only visible through the red circle.

1 Like

Thanks for the explanation and again for the zip file! I should be able with this information to make what I have envisioned. Thanks allot!