diff --git a/tiles.py b/tiles.py index 0564140..b6d6098 100644 --- a/tiles.py +++ b/tiles.py @@ -344,7 +344,6 @@ def astar(map, start, end): continue open_list.append(child) - map = Map() waiter = Waiter([32, 32]) tables = [] @@ -363,7 +362,6 @@ for i in range(16): for table in tables: map.add_table(table.loc) - def main(): direction = [] while True: @@ -393,9 +391,11 @@ def main(): left, middle, right = pygame.mouse.get_pressed() if left: waiterGo(mouseToNum()) - elif right: - goal = (18, 18) + x = pygame.mouse.get_pos()[1] + y = pygame.mouse.get_pos()[0] + goal = (x//32, y//32) + #goal = (18,18) route = astar(map.get_arr(), (waiter.loc[1] // 32, waiter.loc[0] // 32), goal) direction = [(x[1] - y[1], x[0] - y[0]) for x, y in zip(route[1:], route)] if len(direction) > 0: