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
|
import config
|
||||||
from queue import PriorityQueue
|
from queue import PriorityQueue
|
||||||
|
|
||||||
|
|
||||||
def quit():
|
def quit():
|
||||||
print("Zamykanie...")
|
print("Zamykanie...")
|
||||||
pygame.quit()
|
pygame.quit()
|
||||||
@ -141,16 +142,17 @@ def pathfinding():
|
|||||||
else:
|
else:
|
||||||
route = a_star(start_position,end_point)
|
route = a_star(start_position,end_point)
|
||||||
for i in route[::-1]:
|
for i in route[::-1]:
|
||||||
poz = config.TRAKTOR_POZ
|
poz = [int(((config.TRAKTOR_POZ[1]-5)/70)-1), int(((config.TRAKTOR_POZ[0]-5)/70)-1)]
|
||||||
if i[0]< poz[0]:
|
if i[0]> poz[0]:
|
||||||
move_down()
|
move_down()
|
||||||
elif i[0]> poz[0]:
|
elif i[0]< poz[0]:
|
||||||
move_up()
|
move_up()
|
||||||
elif i[1]> poz[1]:
|
elif i[1]> poz[1]:
|
||||||
move_right()
|
move_right()
|
||||||
elif i[1]< poz[1]:
|
elif i[1]< poz[1]:
|
||||||
move_left()
|
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)])
|
work([int(((config.TRAKTOR_POZ[1]-5)/70)-1), int(((config.TRAKTOR_POZ[0]-5)/70)-1)])
|
||||||
|
|
||||||
def a_star(start, end):
|
def a_star(start, end):
|
||||||
|
2
main.py
2
main.py
@ -60,8 +60,6 @@ while True:
|
|||||||
font = pygame.font.Font('freesansbold.ttf', 24)
|
font = pygame.font.Font('freesansbold.ttf', 24)
|
||||||
text = font.render(text_value, True, (0, 0, 0), COL)
|
text = font.render(text_value, True, (0, 0, 0), COL)
|
||||||
okno.blit(text, text_rect)
|
okno.blit(text, text_rect)
|
||||||
|
|
||||||
# pole_surf.blit(images[4], (0,0))
|
|
||||||
for i in range(0,700,70):
|
for i in range(0,700,70):
|
||||||
for j 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))
|
pole_surf.blit(images[POLE_STAN[int(i/70),int(j/70)]],(j,i))
|
||||||
|
Loading…
Reference in New Issue
Block a user