Fix formulas in place_room and room_fits
This commit is contained in:
parent
05ccd0e339
commit
abbad0f352
@ -36,8 +36,8 @@ class Generator:
|
||||
rh, rw = len(room), len(room[0])
|
||||
for ry in range(rh):
|
||||
for rx in range(rw):
|
||||
if room[y][x] == Tile.FLOOR:
|
||||
ly, lx = ry - door_y, rx - door_x
|
||||
if room[ry][rx] == Tile.FLOOR:
|
||||
ly, lx = y + ry - door_y, x + rx - door_x
|
||||
if not(0 <= ly <= rh and 0 <= lx <= rw) or \
|
||||
level[ly][lx] == Tile.FLOOR:
|
||||
return False
|
||||
@ -50,8 +50,8 @@ class Generator:
|
||||
level[door_y][door_x] = Tile.FLOOR
|
||||
for ry in range(rh):
|
||||
for rx in range(rw):
|
||||
if room[y][x] == Tile.FLOOR:
|
||||
level[y-door_y][y-door_x] = Tile.FLOOR
|
||||
if room[ry][rx] == Tile.FLOOR:
|
||||
level[y-door_y+ry][y-door_x+rx] = Tile.FLOOR
|
||||
|
||||
@staticmethod
|
||||
def place_walls(level):
|
||||
|
Loading…
Reference in New Issue
Block a user