This commit is contained in:
Torsten 2025-11-21 08:45:55 +01:00
parent c52c98d73e
commit 0c0ed298d7
2 changed files with 18 additions and 0 deletions

View file

@ -0,0 +1,18 @@
Kamera Begrenzung:
```
camera.limit_left = 0
camera.limit_top = 0
camera.limit_right = 100 * tile_size
camera.limit_bottom = 100 * tile_size
```
Setzen von weit entfernten tiles:
```
for x in range(0, 100):
for y in range(0, 100):
tilemap.set_cell(x, y, tile_id)
```

View file

@ -0,0 +1,30 @@
Hexmap Settings:
![[Pasted image 20250413094820.png]]
GDScript on the layer:
```python
extends TileMapLayer
func _unhandled_input(event):
if event is InputEventMouseButton:
var mouse_pos = get_local_mouse_position()
var cell_pos = local_to_map(mouse_pos)
print("Clicked cell: ", cell_pos)
var source_id = get_cell_source_id(cell_pos)
print("source_id:", source_id)
if source_id > -1:
print("Atlas coords:")
var atlas_coords = get_cell_atlas_coords(cell_pos)
print(atlas_coords)
#Example: Place/erase tile on click
if event.button_index == MOUSE_BUTTON_LEFT:
pass
#set_cell(cell_pos, 51, Vector2i(6, 1)) # Place tile
elif event.button_index == MOUSE_BUTTON_RIGHT:
set_cell(cell_pos, -1) # Erase tile
```