Randomly place exit ladder
This commit is contained in:
		@@ -205,4 +205,11 @@ class Generator:
 | 
			
		||||
        # post-processing
 | 
			
		||||
        self.place_walls(level)
 | 
			
		||||
 | 
			
		||||
        # place an exit ladder
 | 
			
		||||
        y, x = randint(0, height - 1), randint(0, width - 1)
 | 
			
		||||
        while level[y][x] != Tile.FLOOR or \
 | 
			
		||||
                sum([t.can_walk() for t in Map.neighbourhood(level, y, x, large=True)]) < 5:
 | 
			
		||||
            y, x = randint(0, height - 1), randint(0, width - 1)
 | 
			
		||||
        level[sy][sx] = Tile.LADDER
 | 
			
		||||
 | 
			
		||||
        return Map(width, height, level, sy, sx)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user