forked from s452751/AI_PRO
V1.34
This commit is contained in:
parent
e2c69cd3b9
commit
bad695ca49
@ -1,4 +1,3 @@
|
||||
|
||||
from TractorLoad import TillageUnit
|
||||
|
||||
|
||||
@ -18,19 +17,20 @@ def action(field, tractor):
|
||||
elif isinstance(tractor.hitch, TillageUnit) and tractor.hitch.load == "Fertilizer" and field.state == "toFertilize":
|
||||
return "toCut"
|
||||
|
||||
|
||||
def chooseToolset(tractor, tillageUnit, set):
|
||||
if set == 0:
|
||||
tractor.hitch = tillageUnit
|
||||
tractor.hitch.load = "Nothing"
|
||||
if set == 1:
|
||||
tractor.hitch = tillageUnit
|
||||
tractor.hitch.load = "Fertilizer"
|
||||
tractor.hitch.load = "Water"
|
||||
if set == 2:
|
||||
tractor.hitch = tillageUnit
|
||||
tractor.hitch.load = "Seeds"
|
||||
if set == 3:
|
||||
tractor.hitch = tillageUnit
|
||||
tractor.hitch.load = "Water"
|
||||
tractor.hitch.load = "Fertilizer"
|
||||
if set == 4:
|
||||
tractor.header = True
|
||||
tractor.hitch = "Crop Trailer"
|
||||
|
43
drawUI.py
43
drawUI.py
@ -5,12 +5,12 @@ import pygame
|
||||
|
||||
|
||||
def drawUI(board, display, tractor, direction, tillageUnit, field):
|
||||
display.fill(WHITE)
|
||||
makeField(board, display)
|
||||
drawTractor(display, tractor.horizontal_index, tractor.vertical_index, direction)
|
||||
drawInfo(display, tractor, tillageUnit, field)
|
||||
|
||||
pygame.display.update()
|
||||
for i in range(1, 11):
|
||||
display.fill(WHITE)
|
||||
makeField(board, display)
|
||||
drawTractor(display, tractor.horizontal_index, tractor.vertical_index, direction, i)
|
||||
drawInfo(display, tractor, tillageUnit, field)
|
||||
pygame.display.update()
|
||||
|
||||
|
||||
def drawInfo(display, tractor, tillageUnit, field):
|
||||
@ -57,14 +57,25 @@ def makeField(board, screen: pygame.Surface):
|
||||
screen.blit(to_fertilizer, to_fertilizer_rect)
|
||||
|
||||
|
||||
def drawTractor(screen: pygame.Surface, tractor_horizontal_index, tractor_vertical_index, direction):
|
||||
def drawTractor(screen: pygame.Surface, tractor_horizontal_index, tractor_vertical_index, direction, i):
|
||||
tractor_pic = tractor_up
|
||||
horizontal = tractor_horizontal_index * TILE_SIZE
|
||||
vertical = tractor_vertical_index * TILE_SIZE
|
||||
|
||||
|
||||
i = i/10
|
||||
|
||||
if direction == "UP":
|
||||
screen.blit(tractor_up, (tractor_horizontal_index * TILE_SIZE, tractor_vertical_index * TILE_SIZE))
|
||||
elif direction == "DOWN":
|
||||
screen.blit(tractor_down, (tractor_horizontal_index * TILE_SIZE, tractor_vertical_index * TILE_SIZE))
|
||||
elif direction == "LEFT":
|
||||
screen.blit(tractor_left, (tractor_horizontal_index * TILE_SIZE, tractor_vertical_index * TILE_SIZE))
|
||||
elif direction == "RIGHT":
|
||||
screen.blit(tractor_right, (tractor_horizontal_index * TILE_SIZE, tractor_vertical_index * TILE_SIZE))
|
||||
else:
|
||||
screen.blit(tractor_right, (tractor_horizontal_index * TILE_SIZE, tractor_vertical_index * TILE_SIZE))
|
||||
tractor_pic = tractor_up
|
||||
vertical = vertical - (TILE_SIZE * i)
|
||||
if direction == "DOWN":
|
||||
tractor_pic = tractor_down
|
||||
vertical = vertical + (TILE_SIZE * i)
|
||||
if direction == "LEFT":
|
||||
tractor_pic = tractor_left
|
||||
horizontal = horizontal - (TILE_SIZE * i)
|
||||
if direction == "RIGHT":
|
||||
tractor_pic = tractor_right
|
||||
horizontal = horizontal + (TILE_SIZE * i)
|
||||
|
||||
screen.blit(tractor_pic, (horizontal, vertical))
|
||||
|
Loading…
Reference in New Issue
Block a user