Game now knows the abs path of the program
This commit is contained in:
parent
c080816908
commit
479c6eece7
5
Run.py
5
Run.py
@ -1,3 +1,6 @@
|
||||
from pathlib import Path
|
||||
|
||||
from src.game.Game import Game
|
||||
|
||||
game = Game()
|
||||
programPath = Path(".").resolve()
|
||||
game = Game(programPath)
|
||||
|
@ -12,12 +12,12 @@ from src.game.Timer import Timer
|
||||
|
||||
|
||||
class Game:
|
||||
def __init__(self):
|
||||
def __init__(self, filesPath):
|
||||
self.running = True
|
||||
print("Loading configuration...", end=" ")
|
||||
|
||||
try:
|
||||
configFolder = Path("../data/config/")
|
||||
configFolder = Path(str(filesPath) + "/data/config/")
|
||||
configFile = configFolder / "mainConfig.json"
|
||||
|
||||
self.config = json.loads(configFile.read_text())
|
||||
@ -47,8 +47,8 @@ class Game:
|
||||
self.screen = Screen(self, self.config["window"])
|
||||
print("OK")
|
||||
|
||||
self.mapDataFolder = path.dirname("../data/mapdata/")
|
||||
self.map = Map(path.join(self.mapDataFolder, 'map.txt'), self.screen)
|
||||
mapFile = Path(str(filesPath) + "/data/mapdata/")
|
||||
self.map = Map(path.join(mapFile, 'map.txt'), self.screen)
|
||||
self.player = Player((6, 2), self.map.tileSize)
|
||||
self.map.addEntity(self.player)
|
||||
self.eventManager = EventManager(self, self.player)
|
||||
|
Loading…
Reference in New Issue
Block a user