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