Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Insignificant |
I’m making a multiplayer tank game, where you are able to shoot projectiles at certain tiles, which results in the individual tile getting changed. It seems to work for my authority, but I can’t get it to synchronize on the clients. Tiles don’t get destroyed. My bullet is responsible for sending the “cell” value at the point of contact, which works. Here’s my code for the TileMap.
@export var tile : Vector2i = Vector2i.ZERO
@export var tile_id : int = 0
@export var destructing : bool = false
func destruct(cell):
tile = local_to_map(cell)
tile_id = get_cell_source_id(0, tile)
if tile_id <= 2:
destructing = true
func _process(delta):
if destructing == true:
set_cell(0, tile, tile_id - 1, get_cell_atlas_coords(0, tile))
destructing = false
the variables (tile, tile_id, and destructing) are all assigned in my MultiplayerSynchronizer node, which is the only child node of my TileMap scene. Despite not knowing what it does, I’ve also added the script to the MultiplayerSynchronizer out of desperation. That doesn’t work either.