Godot Version
4.2 stable
Question
Hi! I fight with this issue for some time and cannot grasp how to do it properly.
First of all I am still very new to Godot and I tried reading through docs, looking for guides regarding this or similiar topic, but I am stuck.
What I want to achieve is that on collision with given tile, I want to edit and change this tile’s Light Mask.
I somewhat managed to achieve it by instantiating scene with rigid body on each tile, then on collision RigidBody2d property was changed. But this way of doing it seems very tedious and is hard to work with later.
Currently i managed to get cords of the tile that CharacterBody2d is colliding (thanks to some guides from previous versions of Godot).
But I can’t access light layer property from it.
func _on_main_collided(collider):
#collider - CharacterBody2d.get_last_slide_collision()
if collider.get_collider() is TileMap:
var tile_collided = collider.get_collider().local_to_map(Global.joe_pos)
var tile_relative_pos = Vector2i(collider.get_normal())
var tile = tile_collided - tile_relative_pos
again what I want is to get tile (Vector2i) cords and use it to change light mask of this one tile only.
thank you!