AI_PROJECT/main.py

40 lines
1010 B
Python
Raw Normal View History

2024-03-08 20:21:45 +01:00
import pygame
2024-03-08 19:58:18 +01:00
2024-03-08 20:21:45 +01:00
pygame.init()
2024-03-08 19:58:18 +01:00
2024-03-08 20:21:45 +01:00
CUBE_SIZE = 128
NUM_X = 8
NUM_Y = 4
WIDTH = 1024
HEIGHT = 512
screen = pygame.display.set_mode((WIDTH, HEIGHT))
WHITE = (255, 255, 255)
screen.fill(WHITE)
pygame.display.update()
BLACK = (0, 0, 0)
BROWN = (139, 69, 19)
2024-03-08 19:58:18 +01:00
2024-03-08 20:21:45 +01:00
def draw_grid():
for x in range(NUM_X):
for y in range(NUM_Y):
pygame.draw.rect(screen, BROWN, (x * CUBE_SIZE, y * CUBE_SIZE, CUBE_SIZE, CUBE_SIZE))
2024-03-08 19:58:18 +01:00
2024-03-08 20:21:45 +01:00
for x in range(0, WIDTH, CUBE_SIZE):
pygame.draw.line(screen, BLACK, (x, 0), (x, HEIGHT))
for y in range(0, HEIGHT, CUBE_SIZE):
pygame.draw.line(screen, BLACK, (0, y), (WIDTH, y))
2024-03-08 19:58:18 +01:00
2024-03-08 20:21:45 +01:00
# Draw tractor
tractor_image = pygame.image.load('images/traktor.png')
tractor_image = pygame.transform.scale(tractor_image, (CUBE_SIZE, CUBE_SIZE))
screen.blit(tractor_image, (CUBE_SIZE - 128, CUBE_SIZE - 128))
2024-03-08 19:58:18 +01:00
2024-03-08 20:21:45 +01:00
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
quit()
draw_grid()
pygame.display.update()