0 votes

Is it possible to hide or make some cells invisible in one Tilemap? Similar to Project Zomboid when you are indoors, you can only see those tiles inside the room, and not those of the room behind the wall for instance.

In this example the door is open and so are the windows allowing you to see outside the room and house

In here however, since there is no open door or window, everything else but the room is dark.

I am looking forward to implement something similar to the second picture, having those tiles that compose a room, how would I end up doing this in Godot? Is there any gamedev magic i'm missing?

Godot version 3.3.4
in Engine by (41 points)

1 Answer

+1 vote
Best answer

I've played that game and know what you're talking about, and here's what I would do. I would create a second tilemap that is rendered after the main tilemap and this second tilemap would have a single all-black tile that goes over any tile you want to darken. Another way to do this would be to use the shadow occlusion system for tiles. You could also set the light2d to reveal things rather than cast shadows, although this is more complicated it means that everything outside of the light is completely black. Also, I'm assuming you're working in 2d and don't have a custom tile system. And another way to do this would be using shaders but I don't know much about them.

EDIT: I believe that project zomboid simply doesn't render those tiles which would make the whole system more complicated if you want to do it exactly as they did.

by (663 points)
selected by

Thanks for the proposal, while I do have my data tile system (my game has its own building system integrated in it), I do use tilemaps to reflect the data to the visual port. I will implement the first proposal and see how it goes.

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 Frequently asked questions and 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 [email protected] with your username.