Change how map loading works
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user