SterowanieManualnePrzeniesione
This commit is contained in:
parent
7dc8362f1d
commit
e121af6630
3
main.py
3
main.py
@ -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]
|
||||
|
||||
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user