From ff69cac10973e524f4a1ffe6f2fb63d9693129ba Mon Sep 17 00:00:00 2001 From: Marcin Date: Mon, 27 Apr 2020 21:52:56 +0200 Subject: [PATCH] Kolejne poprawki --- functions.py | 10 ++++++---- main.py | 2 -- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/functions.py b/functions.py index 285ff72..2f0fc60 100644 --- a/functions.py +++ b/functions.py @@ -4,6 +4,7 @@ from pygame.locals import * import config from queue import PriorityQueue + def quit(): print("Zamykanie...") pygame.quit() @@ -141,16 +142,17 @@ def pathfinding(): else: route = a_star(start_position,end_point) for i in route[::-1]: - poz = config.TRAKTOR_POZ - if i[0]< poz[0]: + poz = [int(((config.TRAKTOR_POZ[1]-5)/70)-1), int(((config.TRAKTOR_POZ[0]-5)/70)-1)] + if i[0]> poz[0]: move_down() - elif i[0]> poz[0]: + elif i[0]< poz[0]: move_up() elif i[1]> poz[1]: move_right() elif i[1]< poz[1]: move_left() - time.sleep(0.2) + pygame.display.update() + time.sleep(2) work([int(((config.TRAKTOR_POZ[1]-5)/70)-1), int(((config.TRAKTOR_POZ[0]-5)/70)-1)]) def a_star(start, end): diff --git a/main.py b/main.py index 0f5c64b..49080f8 100644 --- a/main.py +++ b/main.py @@ -60,8 +60,6 @@ while True: font = pygame.font.Font('freesansbold.ttf', 24) text = font.render(text_value, True, (0, 0, 0), COL) okno.blit(text, text_rect) - - # pole_surf.blit(images[4], (0,0)) for i in range(0,700,70): for j in range(0,700,70): pole_surf.blit(images[POLE_STAN[int(i/70),int(j/70)]],(j,i))