Hi. New guy here. First post, not sure if I'm in the right place, here goes. This tilemap code takes a collision signal and changes any tile it collides with, and I want to specify some sort of if statement that only changes a specific set of tile names, see line 7 below. I'm stumped. Any idea's appreciated. |edited|
func _on_character_collision(collision)
if collision.collider is TileMap: #receives the collision signal and notifies
# the tilemap activating a result
var tile_pos = collision.collider.world_to_map(position) # variable of method
# finding vector2 coordinates of sprite collision shape
tile_pos -= collision.normal # sends variable method the direction the
# collision is signaling
var tile_id = collision.collider.get_cellv(tile_pos) #variable of method connector
# takes collision direction and vector2 coordinates and identifies tilemap index coordinates
var tile_name = collision.collider.tile_set.tile_get_name(tile_id) # variable of
# method connector gets the tilemap index coordinates and finds the specific
# tile name in the tileset editor
collision.collider.set_cellv(tile_pos, 05) # method takes all that info and installs
# the tile from the tile set in place of another tile of choosing