Fix the end ladder

This commit is contained in:
Yohann D'ANELLO 2021-01-08 19:20:56 +01:00
parent 9e099d0715
commit d8d0bc6190
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
1 changed files with 3 additions and 2 deletions

View File

@ -208,8 +208,9 @@ class Generator:
# place an exit ladder
y, x = randint(0, height - 1), randint(0, width - 1)
while level[y][x] != Tile.FLOOR or \
any([t.is_wall() for t in Map.neighbourhood(level, y, x, large=True)]):
any([level[j][i].is_wall() for j, i
in Map.neighbourhood(level, y, x, large=True)]):
y, x = randint(0, height - 1), randint(0, width - 1)
level[sy][sx] = Tile.LADDER
level[y][x] = Tile.LADDER
return Map(width, height, level, sy, sx)