Merge branch 'main' of https://github.com/hernikplays/texty
This commit is contained in:
commit
bd4d04e06f
2 changed files with 5 additions and 5 deletions
|
@ -10,7 +10,7 @@ game: # here goes all the game logic
|
||||||
- sit
|
- sit
|
||||||
wave:
|
wave:
|
||||||
description: "Wave" # this appears in the selection box, if no description is supplied
|
description: "Wave" # this appears in the selection box, if no description is supplied
|
||||||
text: "You wave at the customers to signal your arrival. They all ignore you and look away."
|
text: "&bYou wave at the customers to signal your arrival. &rThey all ignore you and look away."
|
||||||
sit: # if no `actions` are supplied, the game exits
|
sit: # if no `actions` are supplied, the game exits
|
||||||
description: "Sit down"
|
description: "Sit down"
|
||||||
text: "You quietly sit down and check the menu."
|
text: "You quietly sit down and check the menu."
|
||||||
|
|
|
@ -30,7 +30,7 @@ class Game:
|
||||||
if(animated != None):
|
if(animated != None):
|
||||||
self.print_animated(animated.group(0))
|
self.print_animated(animated.group(0))
|
||||||
self.nodes[self.current]["text"] = self.nodes[self.current]["text"].replace(animated.group(0),"") # remove the animated text from the text prompt
|
self.nodes[self.current]["text"] = self.nodes[self.current]["text"].replace(animated.group(0),"") # remove the animated text from the text prompt
|
||||||
print(self.nodes[self.current]["text"])
|
print(self.parse_colors(self.nodes[self.current]["text"]))
|
||||||
print("")
|
print("")
|
||||||
ostring = ""
|
ostring = ""
|
||||||
if("actions" in self.nodes[self.current].keys()):
|
if("actions" in self.nodes[self.current].keys()):
|
||||||
|
@ -60,7 +60,7 @@ class Game:
|
||||||
'''
|
'''
|
||||||
Used to convert color codes in string to colors from the colorama lib
|
Used to convert color codes in string to colors from the colorama lib
|
||||||
'''
|
'''
|
||||||
newText = text.replace("&b",Fore.CYAN).replace("\n",Fore.RESET + "\n") # replace color codes and newlines with colorama
|
newText = text.replace("&b",Fore.CYAN).replace("&c",Fore.RED).replace("&e", Fore.YELLOW).replace("&a",Fore.GREEN).replace("&9",Fore.BLUE).replace("&r",Fore.RESET).replace("&f",Fore.WHITE).replace("&5",Fore.MAGENTA).replace("\n",Fore.RESET + "\n") # replace color codes and newlines with colorama
|
||||||
newText += Fore.RESET # reset color at the end of the text
|
newText += Fore.RESET # reset color at the end of the text
|
||||||
return newText
|
return newText
|
||||||
|
|
||||||
|
@ -73,6 +73,6 @@ def load(file_path):
|
||||||
g = Game(data)
|
g = Game(data)
|
||||||
return g
|
return g
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("An exception has occured while loading the game from the YAML file:")
|
print(f"{Back.RED}{Fore.WHITE}An exception has occured while loading the game from the YAML file:{Fore.RESET}{Back.RESET}")
|
||||||
print(e)
|
print(e)
|
||||||
return None
|
return None
|
Reference in a new issue