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