This commit is contained in:
v7eZ3t 2021-03-29 20:30:21 +02:00
parent a5d9403a07
commit 3fe181efa0
4 changed files with 3 additions and 8 deletions

View File

@ -35,7 +35,7 @@ class Tractor:
@hitch.setter @hitch.setter
def hitch(self, hitch): def hitch(self, hitch):
if hitch == "Tillage unit" or hitch == "Crop Trailer" or isinstance(hitch, TillageUnit) or hitch == "Nothing": if hitch == "Crop Trailer" or isinstance(hitch, TillageUnit) or hitch == "Nothing":
self.__hitch = hitch self.__hitch = hitch
@property @property
@ -78,7 +78,6 @@ class Tractor:
self.__engineWorking = False self.__engineWorking = False
def drive(self, direction): def drive(self, direction):
mRange = 1 mRange = 1
if direction == "UP" and self.vertical_index > 0: if direction == "UP" and self.vertical_index > 0:
self.__vertical_index += - mRange self.__vertical_index += - mRange

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 = 100 FPS = 5

View File

@ -20,7 +20,7 @@ def manualTurning(event, tractor):
elif event.key == pygame.K_DOWN and tractor.vertical_index < VERTICAL_TILES_NUMBER - 1: elif event.key == pygame.K_DOWN and tractor.vertical_index < VERTICAL_TILES_NUMBER - 1:
direction = "DOWN" direction = "DOWN"
tractor.drive(direction) # tractor.drive(direction)
return direction return direction

View File

@ -48,8 +48,6 @@ while working:
if hitchCounter == 0: if hitchCounter == 0:
tractor.hitch = "Crop Trailer" tractor.hitch = "Crop Trailer"
if hitchCounter == 1: if hitchCounter == 1:
print(type(tillageUnit))
print(isinstance(tillageUnit, TillageUnit))
tractor.hitch = tillageUnit tractor.hitch = tillageUnit
if hitchCounter == 2: if hitchCounter == 2:
tractor.hitch = "Nothing" tractor.hitch = "Nothing"
@ -71,8 +69,6 @@ while working:
direction = driving.manualTurning(event, tractor) direction = driving.manualTurning(event, tractor)
print(tractor.horizontal_index, " ", tractor.vertical_index) print(tractor.horizontal_index, " ", tractor.vertical_index)
field = board[tractor.horizontal_index][tractor.vertical_index] field = board[tractor.horizontal_index][tractor.vertical_index]