From ff49c10c8f032eea7c56145a5b9e06ee0ba56e29 Mon Sep 17 00:00:00 2001 From: Torsten Date: Wed, 5 Nov 2025 05:29:07 +0100 Subject: [PATCH] Bugfix: Use actual atlas source id instead of a fixed static integer value --- hexmapper/scenes/MainMap/map/map_layer_logic.gd | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hexmapper/scenes/MainMap/map/map_layer_logic.gd b/hexmapper/scenes/MainMap/map/map_layer_logic.gd index 536c9b5..ed3d5f2 100644 --- a/hexmapper/scenes/MainMap/map/map_layer_logic.gd +++ b/hexmapper/scenes/MainMap/map/map_layer_logic.gd @@ -4,6 +4,7 @@ signal hex_clicked(cell_pos:Vector2, atlas_coords:Vector2) func _ready(): print("TileMapLayer is alive") + func _input(event: InputEvent): #print("Unhandled input") @@ -21,10 +22,9 @@ func _input(event: InputEvent): #Example: Place/erase tile on click if event.button_index == MOUSE_BUTTON_LEFT: - print("Click left") - #pass - #set_cell(cell_pos, 51, Vector2i(6, 1)) # Place tile - set_cell(cell_pos, 0, Vector2i(1, 2)) # Place tile + print("Click left") + var atlas_source_id = self.tile_set.get_source_id(0) # source id of first atlas in TileMapLayer + set_cell(cell_pos, atlas_source_id, Vector2i(1, 2)) # Place tile elif event.button_index == MOUSE_BUTTON_RIGHT: print("Click right") set_cell(cell_pos, -1) # Erase tile