poprawa obrotu traktora

This commit is contained in:
tafit0902 2024-04-14 00:13:27 +02:00
parent 1578dd28f9
commit fbe6a7e386
2 changed files with 6 additions and 3 deletions

2
App.py
View File

@ -41,7 +41,7 @@ def init_demo(): #Demo purpose
bfsRoot.reverse()
print(bfsRoot)
# ui.render_text(string_to_print="traktor porusza się ścieżką bfs")
traktor.move_by_root(bfsRoot, pole, traktor.irrigateSlot)
traktor.move_by_root(bfsRoot, pole, [traktor.irrigateSlot])
start_flag=False
# demo_move()
old_info=get_info(old_info)

View File

@ -207,15 +207,18 @@ class Tractor:
for event in pygame.event.get():
if event.type == pygame.QUIT:
quit()
def move_by_root(self, root, pole, action):
def move_by_root(self, root, pole, actions = None):
for move in root:
self.slot.redraw_image()
if move == 'forward':
self.move_forward(pole)
if move == 'right':
self.turn_right()
if move == 'left':
self.turn_left()
action()
for a in actions:
a()
self.clock.tick(3)
#to tak zrobiłam już na później, może się przyda