Modualerize!

This commit is contained in:
Joe S 2021-02-22 20:17:54 -05:00
parent 5ba6a20f13
commit 832e26232b
2 changed files with 11 additions and 3 deletions

View File

@ -17,5 +17,5 @@ class MainMenu(npyscreen.Form):
self.add(npyscreen.FixedText, value='You cannot select a file yet! Just hit OK', editable=False)
self.playerSaveLocation = self.add(npyscreen.TitleFilenameCombo, name="Your save file:")
self.parentApp.player = Player('playerdata/defaults/default_player.yaml')
self.parentApp.player = Player(self.parentApp.mainPath / 'playerdata/defaults/default_player.yaml')
self.add(npyscreen.MultiLineEdit, value=self.parentApp.gamelib['menu']['graphics']['logo'], editable=False)

View File

@ -1,3 +1,4 @@
import pathlib
import npyscreen
from npyscreen import NotEnoughSpaceForWidget
from os import system
@ -21,10 +22,17 @@ class AdventureGame(npyscreen.NPSAppManaged):
# Do on creation
def onStart(self):
# Setup some important 'global' values we'll need later
# Set the path all other files will follow
self.mainPath = pathlib.Path(__file__).parent
# Parse world
self.gamelib = parse(
'gamedata/gamelib.yaml') # parse this data first (since it includes graphics for the main menu
self.mainPath / 'gamedata/gamelib.yaml') # parse this data first (since it includes graphics for the main menu
# Intalize the player as none, the player will be created in the main menu.
self.player = None
self.player = None # Intalize the player as none, the player will be created in the main menu.
# Set screen size before drawing windows
dimensions = self.gamelib['menu']['graphics']['dimensions']