0 votes

Hi there, I have an isometric game I'm working on. One problem I have is that the player and enemies can get hidden from view by the walls on my TileMap. The pictures below shows what I have currently, as you can see the wall is partially covering the player sprite.

What I have

But I want to have something like the picture below instead (I just did this in Photoshop). As you can see, the player sprite is visible through the wall, essentially making it look like the opacity of the wall is lowered for that specific section where it intersects with the player sprite.
What I want

I tried changing the z-index of my sprite which does get the player to show above the wall TileMap at all times but then it just looks broken.

An outline effect would also work for my use case. Any ideas on how to implement this in Godot?

Thanks!

Godot version 3.4
in Engine by (23 points)

1 Answer

0 votes

Create a separate sprite which is the same sprite but mostly see through. Write a script so that the new sprite exactly equals the position and animation state of the player (you will need signals between the sprite and the player so that the new sprite can change animations with the main sprite). Once you have this have the new sprite on the z-axis above all the backgrounds. When you can see both it will just look like the player but when you go behind a wall you will only see the transparent sprite above the wall.

by (1,417 points)

Actually I have thought about it a bit more and you might find it easier to add an area 2D to your wall and then add an animation which just makes the wall turn partly translucent (add alpha to the sprite). When a player or enemy comes into contact with the area 2d trigger the animation and when they leave that area have the animation reverse back.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.