diff --git a/asci_lib.py b/asci_lib.py index 9fb7e20..5e59616 100644 --- a/asci_lib.py +++ b/asci_lib.py @@ -164,7 +164,7 @@ class Asci: return current_map, self.data[2], self.data[3] - def mainloop(self, end_game, stat=None, data=[0, 0, 0, 0], player="@", door="^", walkable=" "): + def mainloop(self, end_game, stat=None, data=[0, 0, 0, 0], player="@", door="^", walkable=" ", exit_key=9): # Load save ; data = [XP, map_id, x, y] self.data = data[:] if not stat or type(stat) != list: self.stat = [100] @@ -179,7 +179,7 @@ class Asci: key = key_buffer = 0 - while key != 9 and self.stat[0] > 0 and self.data[0] < end_game: + while key != exit_key and self.stat[0] > 0 and self.data[0] < end_game: self.screen.set_data(self.data[-2:]) self.screen.set_cell(10, 3, player) @@ -212,7 +212,7 @@ class Map: def convert(string): try: return int(string) - except: return 0 + except: return string def text_formater(string, screen_width=21, screen_height=6): diff --git a/samples/sample_1.py b/samples/sample_1.py index beeaca0..02f4bab 100644 --- a/samples/sample_1.py +++ b/samples/sample_1.py @@ -32,16 +32,10 @@ def pnj(data, stat): def affichage_stat(data, stat): - pv, argent, seconds = stat - - minutes = seconds // 60 - hours = minutes // 60 - - time = "{}:{}:{}".format(int(hours % 24), int(minutes % 60), int(seconds % 60)) + pv, argent = stat print("Statistiques") print("PV : {}".format(pv)) print("Argent : {}".format(argent)) - print("{}".format(time)) input() @@ -51,4 +45,4 @@ touche = {6: affichage_stat} def mon_jeu(): rpg_python = Asci(carte_monde, evenements, touche) - rpg_python.mainloop(4, stat=[100, 5, 0]) \ No newline at end of file + rpg_python.mainloop(4, stat=[100, 5]) \ No newline at end of file