This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

How does one place tiles that are invisible or run-time? I plan to have it visible whilst editing the project, but upon running, it becomes invisible, but its collision still works. It works somehow like the barrier block in Minecraft. Its the closest example I can think of.
enter image description here
The tile I'm planning to make invisible is the red void tile highlighted. Its there on the 2nd floor to prevent manually controlled entities from walking of the edge of the raised platform.

in Engine by (26 points)

2 Answers

0 votes

You can add a script to the tilemap:

func _ready():
  tile_set.tile_set_region(invisible_tile_id, a_transparent_region)

Should be possible with modulate too but looks like is not exposed to gdscript, not on 3.0 at least but may be accesible via set.

by (7,954 points)

I made it a different way, I separated the void tiles into a different tilemap, had them hidden and their collisions still appear. I usually end up solving majority of my own problems with hints from others or similar instances I find online.

0 votes

If someone is still scrambling his/her brain in this I came up with solution.

extends TileMap

const BARRIER_ID := 22

func _ready() -> void:
    for cell in get_used_cells_by_id(BARRIER_ID):
        set_cell(cell[0], cell[1], INVISIBLE_BARRIER_ID)
by (22 points)
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.