Madra_smieciarka/main.py
2024-03-25 00:05:56 +01:00

46 lines
1.3 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)
}
new_house_size = (140, 120)
garbagetruck = Garbagetruck()
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(garbagetruck.getImage(), junkyard.getPosition())
pygame.display.flip()
pygame.quit()