This repository has been archived on 2026-06-15. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
The-Adventure-Game/classes/Map.py
T

23 lines
560 B
Python

from json import load as json_load
import os
class Map:
def __init__(self, path):
self.path = path
self.story = {}
def make_file(self, story:dict={}):
for file in os.listdir(self.path):
if file.endswith("json"):
with open(f"{self.path}/{file}", "r") as f:
filename = os.path.splitext(os.path.basename(file))[0]
story[filename] = json_load(f)
self.story = story
def __str__(self):
return f"{self.__class__.__name__} | Story: {self.story}"
def __getitem__(self, key):
return self.story[key]