SterowanieManualnePrzeniesione

This commit is contained in:
secret_dude 2021-04-13 18:09:27 +02:00
parent 7dc8362f1d
commit e121af6630
2 changed files with 4 additions and 6 deletions

View File

@ -41,7 +41,8 @@ while working:
if event.type == pygame.QUIT: if event.type == pygame.QUIT:
working = False working = False
if event.type == pygame.KEYDOWN: if event.type == pygame.KEYDOWN:
manualSteeringDriver(event, board, tractor, hitchCounter, tillageUnit, loadCounter, ANIMATION_PART) hitchCounter, loadCounter, animationSpeed = \
manualSteeringDriver(event, board, tractor, hitchCounter, tillageUnit, loadCounter, animationSpeed)
field = board[tractor.horizontal_index][tractor.vertical_index] field = board[tractor.horizontal_index][tractor.vertical_index]

View File

@ -3,7 +3,7 @@ from constants import *
from TractorAction import action from TractorAction import action
import pygame import pygame
def manualSteeringDriver(event, board, tractor, hitchCounter, tillageUnit, loadCounter, ANIMATION_PART): def manualSteeringDriver(event, board, tractor, hitchCounter, tillageUnit, loadCounter, animationSpeed):
if event.key == pygame.K_SPACE: if event.key == pygame.K_SPACE:
field = board[tractor.horizontal_index][tractor.vertical_index] field = board[tractor.horizontal_index][tractor.vertical_index]
field.state = action(field, tractor) field.state = action(field, tractor)
@ -38,17 +38,14 @@ def manualSteeringDriver(event, board, tractor, hitchCounter, tillageUnit, loadC
if event.key == pygame.K_t: if event.key == pygame.K_t:
if tractor.autodrive: if tractor.autodrive:
tractor.autodrive = False tractor.autodrive = False
cruiseControl = False
autoAction = False
animationSpeed = 1 animationSpeed = 1
else: else:
tractor.autodrive = True tractor.autodrive = True
animationSpeed = ANIMATION_PART animationSpeed = ANIMATION_PART
cruiseControl = True
autoAction = True
manualTurning(event, tractor) manualTurning(event, tractor)
return hitchCounter, loadCounter, animationSpeed
def manualTurning(event, tractor): def manualTurning(event, tractor):
tractor.direction = "STOP" tractor.direction = "STOP"