Files
SnootGame/game/src/chapter_select.rpy
2024-08-30 15:02:24 -03:00

124 lines
3.1 KiB
Plaintext

define chapter_tuple_1 = [
("1. Anon meets Fang.", "chapter_1"),
("2. Fourth day of school.", "chapter_2"),
("3. Showing up at band practice.", "chapter_3"),
("4. Anon needs help during music period.", "chapter_4"),
("5. Fang and Anon cut class to talk on the roof.", "chapter_5"),
("6. Anon helps Fang find a venue for the band.", "chapter_6")
]
define chapter_tuple_2 = [
("7. Concert day.", "chapter_7"),
("8. Anon and Fang study together.", "chapter_8"),
("9. Trish ridicules Anon in front of the school.", "chapter_9"),
("10. Fang goes to Anon's apartment.", "chapter_10"),
("11. School assignment and route lock.", "chapter_11")
]
define tuples_index = [
("Chapters 1 to 6", chapter_tuple_1),
("Chapters 7 to 11", chapter_tuple_2)
]
init python:
def select_chapter():
global current_chapter, is_end_reached, quick_menu
selected_tuple = ()
while True:
selected_tuple = display_tuple_menu(tuples_index)
if selected_tuple == "go_back":
renpy.jump("chapter_select")
current_chapter = display_tuple_menu(selected_tuple)
if current_chapter == "go_back":
continue
else:
break
set_stats()
toggle_debug()
quick_menu = True
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
ending_route_number = get_ending()
find_chapter_in_array()
if not is_end_reached:
add_ending_chapters(ending_route_number)
update_ending_variables() # Updates variables for newly extended 'chapter_list' with ending chapters
def set_scores(anon_score, fang_score):
global anonscore, fangscore
anonscore = anon_score
fangscore = fang_score
def find_chapter_in_array():
global chapter_list_index, current_chapter
try:
chapter_list_index = chapter_list.index(current_chapter)
except ValueError:
chapter_list_index = -1
current_chapter = ""
label reset_chapter_list:
$ chapter_list = [
"chapter_1", "chapter_2", "chapter_3", "chapter_4", "chapter_5",
"chapter_6", "chapter_7", "chapter_8", "chapter_9", "chapter_10", "chapter_11"
]
return
label chapter_select:
$ quick_menu = False
stop sound
stop music fadeout 2
scene black with dissolve
menu:
"Initialize scores:"
"Ending 1":
$ set_scores(0, 0)
"Ending 2":
$ set_scores(0, 4)
"Ending 3":
$ set_scores(4, 0)
"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
$ select_chapter()