💚 Fix pipeline
This commit is contained in:
@ -11,17 +11,19 @@ class Map:
|
||||
self.tiles = tiles
|
||||
|
||||
@staticmethod
|
||||
def load(filename):
|
||||
def load(filename: str):
|
||||
with open(filename, "r") as f:
|
||||
file = f.read()
|
||||
return Map.load_from_string(file)
|
||||
|
||||
@staticmethod
|
||||
def load_from_string(content):
|
||||
def load_from_string(content: str):
|
||||
lines = content.split("\n")
|
||||
lines = [line for line in lines if line]
|
||||
height = len(lines)
|
||||
width = len(lines[0]) - 1
|
||||
chars = [[Tile.from_char(c, x, y) for x, c in enumerate(line)] for y, line in enumerate(lines)]
|
||||
width = len(lines[0])
|
||||
chars = [[Tile.from_char(c, x, y)
|
||||
for x, c in enumerate(line)] for y, line in enumerate(lines)]
|
||||
return Map(width, height, chars)
|
||||
|
||||
|
||||
@ -42,6 +44,6 @@ class Tile:
|
||||
class Entity:
|
||||
tile: Tile
|
||||
|
||||
def move(self, x, y):
|
||||
def move(self, x: int, y: int) -> None:
|
||||
self.tile.x = x
|
||||
self.tile.y = y
|
||||
|
Reference in New Issue
Block a user