From eb1e125d4e6afd7349c07e920b52d795529fe7ce Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Fri, 16 Oct 2020 14:00:38 +0200 Subject: [PATCH] Draw a map in a string to make the render in the screen easier --- dungeonbattle/interfaces.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dungeonbattle/interfaces.py b/dungeonbattle/interfaces.py index 507ebde..ae4937c 100644 --- a/dungeonbattle/interfaces.py +++ b/dungeonbattle/interfaces.py @@ -30,6 +30,9 @@ class Map: for x, c in enumerate(line)] for y, line in enumerate(lines)] return Map(width, height, tiles) + def draw_string(self) -> str: + return "\n".join("".join(tile.char for tile in line) for line in self.tiles) + class Tile(Enum): EMPTY = auto()