From 45a3ff671189e28ab7fc3e679393863b70a12885 Mon Sep 17 00:00:00 2001 From: czorekk Date: Tue, 10 May 2022 01:06:39 +0200 Subject: [PATCH] [trashbin-rendering] deleted unused file 'camera', little change in a* about tiles processing --- map/camera.py | 24 ------------------------ path_search_algorthms/a_star_utils.py | 5 ++--- 2 files changed, 2 insertions(+), 27 deletions(-) delete mode 100644 map/camera.py diff --git a/map/camera.py b/map/camera.py deleted file mode 100644 index ee229f7..0000000 --- a/map/camera.py +++ /dev/null @@ -1,24 +0,0 @@ -from settings import * - -class Camera: - def __init__(self,width,height): - self.camera = pg.Rect(0,0, width, height) - self.width = width - self.height = height - - def apply(self,entity): - return entity.rect.move(self.camera.topleft) - - def apply_rect(self, rect): - return rect.move(self.camera.topleft) - - def update(self,target): - x = -target.rect.x + int(WIDTH/2) - y = -target.rect.y + int(HEIGHT / 2) - - # limit scrolling to map size - x = min(0, x) # left - y = min(0, y) # top - x = max(-(self.width - WIDTH), x) # right - y = max(-(self.height - HEIGHT), y) # bottom - self.camera = pg.Rect(x, y, self.width, self.height) \ No newline at end of file diff --git a/path_search_algorthms/a_star_utils.py b/path_search_algorthms/a_star_utils.py index 20caee1..ee24f61 100644 --- a/path_search_algorthms/a_star_utils.py +++ b/path_search_algorthms/a_star_utils.py @@ -1,9 +1,8 @@ from enum import Enum +from map import map_utils from settings import * -ROAD_TILE = 0 - class Rotation(Enum): UP = 0 RIGHT = 1 @@ -36,7 +35,7 @@ def get_neighbours(node, searched_list, array): y = node.y + offset_y # prevent out of map coords if (x >= 0 and x < MAP_WIDTH and y >= 0 and y < MAP_HEIGHT): - if(array[y][x] == ROAD_TILE and (x, y) not in searched_list): + if(map_utils.isRoadTile(array[y][x]) and (x, y) not in searched_list): neighbour = Node(x, y, Rotation.NONE) neighbour.rotation = get_needed_rotation(node, neighbour) neighbours.append(neighbour)