V. 12
This commit is contained in:
parent
b32d77fe3f
commit
19e42bbdf9
39
drawUI.py
39
drawUI.py
@ -5,12 +5,12 @@ import pygame
|
|||||||
|
|
||||||
|
|
||||||
def drawUI(board, display, tractor, direction, tillageUnit, field):
|
def drawUI(board, display, tractor, direction, tillageUnit, field):
|
||||||
display.fill(WHITE)
|
for i in range(1, 11):
|
||||||
makeField(board, display)
|
display.fill(WHITE)
|
||||||
drawTractor(display, tractor.horizontal_index, tractor.vertical_index, direction)
|
makeField(board, display)
|
||||||
drawInfo(display, tractor, tillageUnit, field)
|
drawTractor(display, tractor.horizontal_index, tractor.vertical_index, direction, i)
|
||||||
|
drawInfo(display, tractor, tillageUnit, field)
|
||||||
pygame.display.update()
|
pygame.display.update()
|
||||||
|
|
||||||
|
|
||||||
def drawInfo(display, tractor, tillageUnit, field):
|
def drawInfo(display, tractor, tillageUnit, field):
|
||||||
@ -54,14 +54,21 @@ def makeField(board, screen: pygame.Surface):
|
|||||||
screen.blit(do_zebrania, do_zebrania_rect)
|
screen.blit(do_zebrania, do_zebrania_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
|
||||||
if direction == "UP":
|
if direction == "UP":
|
||||||
screen.blit(tractor_up, (tractor_horizontal_index * TILE_SIZE, tractor_vertical_index * TILE_SIZE))
|
tractor_pic = tractor_up
|
||||||
elif direction == "DOWN":
|
vertical = vertical + (TILE_SIZE / i)
|
||||||
screen.blit(tractor_down, (tractor_horizontal_index * TILE_SIZE, tractor_vertical_index * TILE_SIZE))
|
if direction == "DOWN":
|
||||||
elif direction == "LEFT":
|
tractor_pic = tractor_down
|
||||||
screen.blit(tractor_left, (tractor_horizontal_index * TILE_SIZE, tractor_vertical_index * TILE_SIZE))
|
vertical = vertical - (TILE_SIZE / i)
|
||||||
elif direction == "RIGHT":
|
if direction == "LEFT":
|
||||||
screen.blit(tractor_right, (tractor_horizontal_index * TILE_SIZE, tractor_vertical_index * TILE_SIZE))
|
tractor_pic = tractor_left
|
||||||
else:
|
horizontal = horizontal + (TILE_SIZE/i)
|
||||||
screen.blit(tractor_right, (tractor_horizontal_index * TILE_SIZE, tractor_vertical_index * TILE_SIZE))
|
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