v. 1.06
This commit is contained in:
parent
ba447abfb9
commit
f72df6eac1
@ -1,6 +1,9 @@
|
|||||||
from Main.constants import *
|
from Main.constants import *
|
||||||
import pygame
|
import pygame
|
||||||
|
|
||||||
|
def drawUI(board, display, tractor_horizontal_index, tractor_vertical_index):
|
||||||
|
makeField(board, display)
|
||||||
|
drawTractor(display, tractor_horizontal_index, tractor_vertical_index)
|
||||||
|
|
||||||
def makeField(board, display):
|
def makeField(board, display):
|
||||||
color = BLACK
|
color = BLACK
|
||||||
@ -22,7 +25,7 @@ def makeField(board, display):
|
|||||||
[i * TILE_SIZE, j * TILE_SIZE, TILE_SIZE, TILE_SIZE])
|
[i * TILE_SIZE, j * TILE_SIZE, TILE_SIZE, TILE_SIZE])
|
||||||
|
|
||||||
|
|
||||||
def drawTractor(board, display, tractor_horizontal_index, tractor_vertical_index):
|
def drawTractor(display, tractor_horizontal_index, tractor_vertical_index):
|
||||||
pygame.draw.rect(display, BLACK,
|
pygame.draw.rect(display, BLACK,
|
||||||
[tractor_horizontal_index * TILE_SIZE, tractor_vertical_index * TILE_SIZE, TRACTOR_WIDTH,
|
[tractor_horizontal_index * TILE_SIZE, tractor_vertical_index * TILE_SIZE, TRACTOR_WIDTH,
|
||||||
TRACTOR_HEIGHT])
|
TRACTOR_HEIGHT])
|
||||||
|
5
main.py
5
main.py
@ -28,7 +28,6 @@ tractor_vertical_index = 0
|
|||||||
|
|
||||||
while working:
|
while working:
|
||||||
for event in pygame.event.get():
|
for event in pygame.event.get():
|
||||||
|
|
||||||
if event.type == pygame.QUIT:
|
if event.type == pygame.QUIT:
|
||||||
working = False
|
working = False
|
||||||
if event.type == pygame.KEYDOWN:
|
if event.type == pygame.KEYDOWN:
|
||||||
@ -42,9 +41,7 @@ while working:
|
|||||||
|
|
||||||
tractor_vertical_index += vertical_change
|
tractor_vertical_index += vertical_change
|
||||||
display.fill(WHITE)
|
display.fill(WHITE)
|
||||||
drawUI.makeField(board, display)
|
drawUI.drawUI(board, display, tractor_horizontal_index, tractor_vertical_index)
|
||||||
|
|
||||||
drawUI.drawTractor(board, display, tractor_horizontal_index, tractor_vertical_index)
|
|
||||||
|
|
||||||
pygame.display.update()
|
pygame.display.update()
|
||||||
clock.tick(FPS)
|
clock.tick(FPS)
|
||||||
|
Loading…
Reference in New Issue
Block a user