How do you turn off a specific tiles visibility?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By javrocks

extends RayCast2D

func _ready():
pass

func _process(delta):

if is_colliding():
	var collider = get_collider()
	var tile_map = collider
	var tile_pos = tile_map.world_to_map(get_collision_point())
	var tile_id = tile_map.get_cellv(tile_pos)
	tile_id.visible = false
	
pass

#I need to turn off a specific tile’s visbility on/off but tile_id.visible = false dosen’t work
#Can this even be done?

i think tile_id.visible = false doesn’t work. try to do tile.id.set_visible(false) or tile.id.hide() if it exist.
If you are going for aesthetic purpose, just change the tile’s alpha to 0

Mrpaolosarino | 2021-04-07 01:10

It says that the functions are non-existent so how would u set tile’s alpha to 0 with code

javrocks | 2021-04-07 03:48

:bust_in_silhouette: Reply From: exuin

The tile id you’re getting is just an integer. It’s not possible set a specific tile to invisible. You can use this method to make all tiles with the same id disappear by giving it a color with an alpha value of zero, but that affects all tiles with the same id and not just one specific tile.