Madra_smieciarka/main.py
2024-03-19 21:08:24 +01:00

55 lines
1.6 KiB
Python

from generators import *
pygame.init()
screen = pygame.display.set_mode((1800, 1000))
colors = {
"white": (255, 255, 255),
"black": (0, 0, 0),
"red": (255, 0, 0)
}
garbage_truck_image = pygame.image.load('sprites/garbage_truck.png')
new_garbage_truck_size = (120, 120)
new_house_size = (140, 120)
garbage_truck_image = garbage_truck_image.convert_alpha()
garbage_truck_image = pygame.transform.scale(garbage_truck_image, new_garbage_truck_size)
garbage_truck_position = [800, 500]
junkyard = Junkyard()
trashcans = trashcanGenerator(junkyard)
houses = householdGenerator(junkyard)
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
# garbage_truck_position[0] += random.randint(-4, 4)
# garbage_truck_position[1] += random.randint(-4, 4)
screen.fill(colors["white"])
for trash_can in trashcans:
for neighbour in trash_can.getNeighbours():
pygame.draw.line(screen, colors["black"], trash_can.getPosition(), neighbour.getPosition(), 3)
screen.blit(trash_can.getImage(), trash_can.getPosition())
for house in houses:
for neighbour in house.getNeighbours():
if neighbour.getId() < house.getId():
pygame.draw.line(screen, colors["black"], house.getPosition(), neighbour.getPosition(), 3)
for house in houses:
screen.blit(house.getImage(), house.getPosition())
pygame.draw.circle(screen, colors["red"], junkyard.getPosition(), 10)
screen.blit(garbage_truck_image, junkyard.getPosition())
pygame.display.flip()
pygame.quit()