SterowanieManualnePrzeniesione

This commit is contained in:
secret_dude 2021-04-13 18:40:58 +02:00
parent e121af6630
commit ac55e5bf57
4 changed files with 6 additions and 6 deletions

View File

@ -98,7 +98,6 @@ class Tractor:
self.__direction = direction self.__direction = direction
def drive(self): def drive(self):
mRange = 1 mRange = 1
if not self.__engineWorking: if not self.__engineWorking:

View File

@ -29,7 +29,7 @@ TRACTOR_WIDTH = TILE_SIZE
TRACTOR_HEIGHT = TILE_SIZE TRACTOR_HEIGHT = TILE_SIZE
#FRAMES PER SECOND #FRAMES PER SECOND
FPS = 10 FPS = 1
#ANIMATION_PART #ANIMATION_PART

View File

@ -9,8 +9,6 @@ from TractorLoad import TillageUnit
from constants import * from constants import *
from manualSteering import manualSteeringDriver from manualSteering import manualSteeringDriver
# wersja 1.05
pygame.init() pygame.init()
display = pygame.display.set_mode((DISPLAY_SIZE_HORIZONTAL, DISPLAY_SIZE_VERTICAL)) display = pygame.display.set_mode((DISPLAY_SIZE_HORIZONTAL, DISPLAY_SIZE_VERTICAL))
@ -49,14 +47,15 @@ while working:
if autoAction: if autoAction:
tractor, tillageUnit, toolCounter = TractorAction.autoAction(tractor, tillageUnit, toolCounter) tractor, tillageUnit, toolCounter = TractorAction.autoAction(tractor, tillageUnit, toolCounter)
field.state = action(field, tractor) field.state = action(field, tractor)
if tractor.engineWorking:
tractor.reduce_fuel()
tractor.drive() tractor.drive()
drawUI.drawUI(board, display, tractor, tractor.direction, tillageUnit, field, animationSpeed) drawUI.drawUI(board, display, tractor, tractor.direction, tillageUnit, field, animationSpeed)
clock.tick(FPS) clock.tick(FPS)
if tractor.engineWorking:
tractor.reduce_fuel()
pygame.quit() pygame.quit()
quit() quit()

View File

@ -33,8 +33,10 @@ def manualSteeringDriver(event, board, tractor, hitchCounter, tillageUnit, loadC
if event.key == pygame.K_r: if event.key == pygame.K_r:
if tractor.engineWorking: if tractor.engineWorking:
tractor.turnOffEngine() tractor.turnOffEngine()
animationSpeed = 1
else: else:
tractor.turnOnEngine() tractor.turnOnEngine()
animationSpeed = ANIMATION_PART
if event.key == pygame.K_t: if event.key == pygame.K_t:
if tractor.autodrive: if tractor.autodrive:
tractor.autodrive = False tractor.autodrive = False