2D silhouette visible throw walls

Hi GDevs! I want my 2D character’s silhouette to be visible through walls and objects. Does anyone know how to do this?

image

Currently that’s impossible. I tried it too. but the best thing I came up with was just lower the opacity on the walls when the character was behind it. It’s the closest thing to the thing you want.

1 Like

Okay, thanks for the tip with opacity!

@OB3RAL try to use the YSort extension

Can you describe in more detail?

GDevelop_CzNiJCPxxx

1 Like

3:42 {------

Is it possible to change opacity not for whole sprite, but for certain shape inside sprite? Like this

No its not possible, if it was i’d already know im waiting for this feature 7 months

This actually not too difficult to accomplish using the “Sprite Masking” extension, although it does require extra objects.

Here’s what you’d do:

  1. Create a duplicate object of your character (name it “CharacterWallShadow” or something). Recolor them to be flat red, either on the assets themselves, or by using the “Adjustment” object effect, and setting red to 5, blue/green/contrast to 0, and then saturation/gamma to 5. Make sure the Z order is the highest Z order on the scene (or put it on it’s own layer above the normal layer)
  2. Create a duplicate of your walls. Recolor them to be any flat color. Put these duplicates in a group named “ShadowMask” or something similar.
  3. Set up an event that keeps your duplicate sprite positioned with your character’s normal sprite, and mimics the animations. (Basically, one event that keeps the position set to the main sprite’s position, one event that says “Set animation of CharacterWallShadow = CharacterNamerHere.Animation()”, one event that says “if character flipped, flip CharacterWallShadow”, etc).
  4. Place your wall duplicates on the map exactly on top of the walls.
  5. Mask the CharacterWallShadow with the “ShadowMask” group.

Here’s a super quick and rough example (I haven’t aligned the animations or flipping or anything): https://game-previews.gdevelop-app.com/1656181165482-516391/index.html


image
image

7 Likes

wait really?! I didn’t know that! You even helped me! Thanks!

1 Like