v 1.23
This commit is contained in:
parent
9b75da63ac
commit
087cb6031d
@ -63,7 +63,7 @@ class Tractor:
|
|||||||
|
|
||||||
@header.setter
|
@header.setter
|
||||||
def header(self, header):
|
def header(self, header):
|
||||||
if header is True or False:
|
if header is True or header is False:
|
||||||
self.__header = header
|
self.__header = header
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
14
main.py
14
main.py
@ -18,7 +18,7 @@ lastDirection = "RIGHT"
|
|||||||
|
|
||||||
horizontal_change = 0
|
horizontal_change = 0
|
||||||
vertical_change = 0
|
vertical_change = 0
|
||||||
|
hitchCounter = 0
|
||||||
board = Board.generate()
|
board = Board.generate()
|
||||||
|
|
||||||
tractor = Tractor(horizontal_index=0, vertical_index=0, hitch="nothing", header=False)
|
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.type == pygame.KEYDOWN:
|
||||||
if event.key == pygame.K_SPACE:
|
if event.key == pygame.K_SPACE:
|
||||||
field = board[tractor.horizontal_index][tractor.vertical_index]
|
field = board[tractor.horizontal_index][tractor.vertical_index]
|
||||||
print(action(field, tractor))
|
|
||||||
field.state = action(field, tractor)
|
field.state = action(field, tractor)
|
||||||
#print(field.state)
|
|
||||||
if event.key == pygame.K_q:
|
if event.key == pygame.K_q:
|
||||||
|
hitchCounter = (hitchCounter + 1) % 3
|
||||||
|
if hitchCounter == 0:
|
||||||
tractor.hitch = "Crop Trailer"
|
tractor.hitch = "Crop Trailer"
|
||||||
|
if hitchCounter == 1:
|
||||||
|
tractor.hitch = "Tillage Unit"
|
||||||
|
if hitchCounter == 2:
|
||||||
|
tractor.hitch = "Nothing"
|
||||||
if event.key == pygame.K_w:
|
if event.key == pygame.K_w:
|
||||||
|
if tractor.header:
|
||||||
|
tractor.header = False
|
||||||
|
else:
|
||||||
tractor.header = True
|
tractor.header = True
|
||||||
|
|
||||||
horizontal_change, vertical_change = driving.manualTurning(event, tractor.horizontal_index,
|
horizontal_change, vertical_change = driving.manualTurning(event, tractor.horizontal_index,
|
||||||
tractor.vertical_index, horizontal_change,
|
tractor.vertical_index, horizontal_change,
|
||||||
vertical_change)
|
vertical_change)
|
||||||
|
Loading…
Reference in New Issue
Block a user