From ac55e5bf574ed2e184712ee81144ea97bd806c3b Mon Sep 17 00:00:00 2001 From: secret_dude Date: Tue, 13 Apr 2021 18:40:58 +0200 Subject: [PATCH] SterowanieManualnePrzeniesione --- Tractor.py | 1 - constants.py | 2 +- main.py | 7 +++---- manualSteering.py | 2 ++ 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Tractor.py b/Tractor.py index 194f70f..48e053e 100644 --- a/Tractor.py +++ b/Tractor.py @@ -98,7 +98,6 @@ class Tractor: self.__direction = direction - def drive(self): mRange = 1 if not self.__engineWorking: diff --git a/constants.py b/constants.py index 3ca4a9f..c5f70b9 100644 --- a/constants.py +++ b/constants.py @@ -29,7 +29,7 @@ TRACTOR_WIDTH = TILE_SIZE TRACTOR_HEIGHT = TILE_SIZE #FRAMES PER SECOND -FPS = 10 +FPS = 1 #ANIMATION_PART diff --git a/main.py b/main.py index 02435e3..8ab98c7 100644 --- a/main.py +++ b/main.py @@ -9,8 +9,6 @@ from TractorLoad import TillageUnit from constants import * from manualSteering import manualSteeringDriver -# wersja 1.05 - pygame.init() display = pygame.display.set_mode((DISPLAY_SIZE_HORIZONTAL, DISPLAY_SIZE_VERTICAL)) @@ -49,14 +47,15 @@ while working: if autoAction: tractor, tillageUnit, toolCounter = TractorAction.autoAction(tractor, tillageUnit, toolCounter) field.state = action(field, tractor) + if tractor.engineWorking: + tractor.reduce_fuel() tractor.drive() drawUI.drawUI(board, display, tractor, tractor.direction, tillageUnit, field, animationSpeed) clock.tick(FPS) - if tractor.engineWorking: - tractor.reduce_fuel() + pygame.quit() quit() diff --git a/manualSteering.py b/manualSteering.py index fae065c..3208b91 100644 --- a/manualSteering.py +++ b/manualSteering.py @@ -33,8 +33,10 @@ def manualSteeringDriver(event, board, tractor, hitchCounter, tillageUnit, loadC if event.key == pygame.K_r: if tractor.engineWorking: tractor.turnOffEngine() + animationSpeed = 1 else: tractor.turnOnEngine() + animationSpeed = ANIMATION_PART if event.key == pygame.K_t: if tractor.autodrive: tractor.autodrive = False