Kolejne poprawki
This commit is contained in:
parent
d3214ddeab
commit
ff69cac109
10
functions.py
10
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):
|
||||
|
2
main.py
2
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))
|
||||
|
Loading…
Reference in New Issue
Block a user