kolejna poprawa astara
This commit is contained in:
parent
c96e45bd08
commit
a373633571
20
modele.py
20
modele.py
@ -59,16 +59,16 @@ class Smieciarka(pygame.sprite.Sprite):
|
|||||||
def astar_move(self, obiekty):
|
def astar_move(self, obiekty):
|
||||||
sciezka = astar.astar(obiekty, self.pozycja, (random.randrange(15), random.randrange(15)))
|
sciezka = astar.astar(obiekty, self.pozycja, (random.randrange(15), random.randrange(15)))
|
||||||
print(sciezka)
|
print(sciezka)
|
||||||
for koord in sciezka:
|
if sciezka:
|
||||||
if koord[0] == self.x - 1 and koord[1] == self.y:
|
for koord in sciezka:
|
||||||
self.w_lewo()
|
if koord[0] == self.x - 1 and koord[1] == self.y:
|
||||||
elif koord[0] == self.x + 1 and koord[1] == self.y:
|
self.w_lewo()
|
||||||
self.w_prawo()
|
elif koord[0] == self.x + 1 and koord[1] == self.y:
|
||||||
elif koord[0] == self.x and koord[1] + 1 == self.y:
|
self.w_prawo()
|
||||||
self.w_gore()
|
elif koord[0] == self.x and koord[1] + 1 == self.y:
|
||||||
elif koord[0] == self.x and koord[1] - 1 == self.y:
|
self.w_gore()
|
||||||
self.w_dol()
|
elif koord[0] == self.x and koord[1] - 1 == self.y:
|
||||||
print("skonczylem")
|
self.w_dol()
|
||||||
|
|
||||||
def w_lewo(self):
|
def w_lewo(self):
|
||||||
if self.x > 0:
|
if self.x > 0:
|
||||||
|
Loading…
Reference in New Issue
Block a user