diff --git a/Tractor.py b/Tractor.py index 0dc074a..13fcf0a 100644 --- a/Tractor.py +++ b/Tractor.py @@ -63,7 +63,7 @@ class Tractor: @header.setter def header(self, header): - if header is True or False: + if header is True or header is False: self.__header = header @property diff --git a/main.py b/main.py index 7afa8b3..a18a9ff 100644 --- a/main.py +++ b/main.py @@ -18,7 +18,7 @@ lastDirection = "RIGHT" horizontal_change = 0 vertical_change = 0 - +hitchCounter = 0 board = Board.generate() tractor = Tractor(horizontal_index=0, vertical_index=0, hitch="nothing", header=False) @@ -33,13 +33,21 @@ while working: if event.type == pygame.KEYDOWN: if event.key == pygame.K_SPACE: field = board[tractor.horizontal_index][tractor.vertical_index] - print(action(field, tractor)) field.state = action(field, tractor) - #print(field.state) if event.key == pygame.K_q: - tractor.hitch = "Crop Trailer" + hitchCounter = (hitchCounter + 1) % 3 + if hitchCounter == 0: + tractor.hitch = "Crop Trailer" + if hitchCounter == 1: + tractor.hitch = "Tillage Unit" + if hitchCounter == 2: + tractor.hitch = "Nothing" if event.key == pygame.K_w: - tractor.header = True + if tractor.header: + tractor.header = False + else: + tractor.header = True + horizontal_change, vertical_change = driving.manualTurning(event, tractor.horizontal_index, tractor.vertical_index, horizontal_change, vertical_change)