Madra_smieciarka/main.py

46 lines
1.3 KiB
Python
Raw Normal View History

2024-03-19 21:08:24 +01:00
from generators import *
2024-03-10 14:32:06 +01:00
pygame.init()
screen = pygame.display.set_mode((1800, 1000))
2024-03-10 21:19:35 +01:00
colors = {
"white": (255, 255, 255),
"black": (0, 0, 0),
"red": (255, 0, 0)
}
2024-03-10 18:04:48 +01:00
new_house_size = (140, 120)
2024-03-10 14:32:06 +01:00
2024-03-25 00:05:56 +01:00
garbagetruck = Garbagetruck()
2024-03-19 21:08:24 +01:00
junkyard = Junkyard()
trashcans = trashcanGenerator(junkyard)
houses = householdGenerator(junkyard)
2024-03-10 18:04:48 +01:00
2024-03-10 21:19:35 +01:00
2024-03-10 14:32:06 +01:00
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
2024-03-10 21:19:35 +01:00
# garbage_truck_position[0] += random.randint(-4, 4)
# garbage_truck_position[1] += random.randint(-4, 4)
2024-03-10 14:32:06 +01:00
2024-03-10 21:19:35 +01:00
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())
2024-03-10 18:04:48 +01:00
for house in houses:
2024-03-10 21:19:35 +01:00
for neighbour in house.getNeighbours():
if neighbour.getId() < house.getId():
pygame.draw.line(screen, colors["black"], house.getPosition(), neighbour.getPosition(), 3)
2024-03-11 14:55:22 +01:00
for house in houses:
2024-03-10 21:19:35 +01:00
screen.blit(house.getImage(), house.getPosition())
pygame.draw.circle(screen, colors["red"], junkyard.getPosition(), 10)
2024-03-10 14:32:06 +01:00
2024-03-25 00:05:56 +01:00
screen.blit(garbagetruck.getImage(), junkyard.getPosition())
2024-03-10 14:32:06 +01:00
pygame.display.flip()
pygame.quit()