Code optimizations

This commit is contained in:
Iggy 2024-08-22 23:18:23 -03:00
parent 84ccfc1b13
commit 0fbff1b81b

View file

@ -29,24 +29,26 @@ init python:
global selected_tuple, current_chapter, is_end_reached
while True:
selected_tuple = renpy.display_menu(tuples_index + [("Go Back", "go_back")])
selected_tuple = display_tuple_menu(tuples_index)
if selected_tuple == "go_back":
renpy.jump("chapter_select")
current_chapter = renpy.display_menu(selected_tuple + [("Go Back", "go_back")])
current_chapter = display_tuple_menu(selected_tuple)
if current_chapter == "go_back":
continue
else:
break
is_end_reached = False # Reset this for when the tool is used more than once
set_stats()
toggle_debug()
renpy.call(current_chapter)
def display_tuple_menu(options):
return renpy.display_menu(options + [("Go Back", "go_back")])
def set_stats():
global chapter_list_length, ending_route_number, is_end_reached, lock_scores
@ -89,9 +91,9 @@ label reset_chapter_list:
label chapter_select:
scene black
stop sound
stop music
stop music fadeout 2
scene black with dissolve
menu:
"Initialize scores:"
@ -105,7 +107,12 @@ label chapter_select:
"Ending 4":
$ set_scores(4, 4)
"Exit to main menu":
scene black with dissolve
return
$ is_end_reached = False # Reset this for when the tool is used more than once
window hide
if not is_end_reached:
call reset_chapter_list from _call_reset_chapter_list