Merge pull request 'positions_adjustment' (#2) from premain into main
Reviewed-on: #2
This commit is contained in:
commit
ea81fa9d1c
8
main.py
8
main.py
@ -51,7 +51,7 @@ for i in range(5):
|
||||
trashcans.append(trashcan)
|
||||
|
||||
houses = []
|
||||
house_positions = [(100, 200), (400, 400), (150, 600), (800, 800), (1000, 200), (1200, 700), (700, 100), (500, 800)]
|
||||
house_positions = [(450, 100), (250, 250), (200, 700), (850, 800), (1000, 200), (1050, 700), (800, 100), (400, 850)]
|
||||
|
||||
for i in range(8):
|
||||
house_image = pygame.image.load(f'house_{i}.jpg')
|
||||
@ -65,8 +65,9 @@ for i in range(len(houses)):
|
||||
else:
|
||||
neigh = chooseNeighbours(3, i)
|
||||
for num in neigh:
|
||||
houses[i].addNeighbour(houses[num])
|
||||
houses[num].addNeighbour(houses[i])
|
||||
if len(houses[i].getNeighbours()) < 3 and len(houses[num].getNeighbours()) < 3:
|
||||
houses[i].addNeighbour(houses[num])
|
||||
houses[num].addNeighbour(houses[i])
|
||||
if i == 7 or i == 1:
|
||||
houses[i].addNeighbour(junkyard)
|
||||
junkyard.addNeighbour(houses[i])
|
||||
@ -89,6 +90,7 @@ while running:
|
||||
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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user