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:
working = False
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]

View File

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