Room system added
This commit is contained in:
@@ -118,7 +118,8 @@ func _physics_process(delta: float) -> void:
|
||||
|
||||
var next_pos := _selected_unit.position + dir * dl_map.TILE_SIZE
|
||||
var grid_coords := dl_map.world_to_coords(next_pos)
|
||||
if dl_map.is_wall(grid_coords):
|
||||
var current_coords := dl_map.world_to_coords(_selected_unit.position)
|
||||
if not dl_map.is_tile_passable(current_coords, grid_coords):
|
||||
_goal_pos = _selected_unit.position
|
||||
return
|
||||
|
||||
@@ -139,7 +140,7 @@ func _handle_left_click(screen_pos: Vector2) -> void:
|
||||
elif _selected_unit:
|
||||
var snapped_pos := dl_map.snap_to_grid(world_pos)
|
||||
var grid_coords := dl_map.world_to_coords(world_pos)
|
||||
if dl_map.is_wall(grid_coords):
|
||||
if not dl_map.is_tile_valid(grid_coords):
|
||||
return
|
||||
_goal_pos = snapped_pos
|
||||
get_viewport().set_input_as_handled()
|
||||
|
||||
Reference in New Issue
Block a user