wybór punktu w A*

This commit is contained in:
Michał Szuszert 2022-04-28 18:34:54 +02:00
parent 84e66ab30f
commit 6244a2832f

View File

@ -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: