diff --git a/game.py b/game.py index 86bdd4e..ae48433 100644 --- a/game.py +++ b/game.py @@ -74,10 +74,7 @@ class Game: self.tilemap: Tilemap = Tilemap(game=self, tile_size=16) - try: - self.tilemap.load(path="map.json") - except FileNotFoundError: - pass + self.load_level(0) self.leaf_spawners: list[pygame.Rect] = [] self.enemys: list[Enemy] = [] @@ -101,6 +98,12 @@ class Game: self.scroll: list[float] = [0, 0] # self.boost: bool = False + def load_level(self, map_id: int): + try: + self.tilemap.load(path="data/maps/" + str(map_id) + ".json") + except FileNotFoundError: + pass + def run(self) -> None: while self.running: self.display.blit(self.assets["background"], (0, 0))