Change how map loading works

This commit is contained in:
gamer147
2026-04-01 17:48:47 -04:00
parent 0233cb6f46
commit 470e89b15b
6 changed files with 84 additions and 56 deletions

View File

@@ -72,9 +72,8 @@ func _select_unit(unit: Unit) -> void:
func _get_unit_at(world_pos: Vector2) -> Unit:
var snapped := dl_map.snap_to_grid(world_pos)
for child in get_parent().get_children():
if child is Unit:
var unit_snapped := dl_map.snap_to_grid(child.global_position)
if unit_snapped == snapped:
return child
for unit: Unit in get_tree().get_nodes_in_group("units"):
var unit_snapped := dl_map.snap_to_grid(unit.global_position)
if unit_snapped == snapped:
return unit
return null