mirror of
https://git.cavemanon.xyz/Cavemanon/SnootGame.git
synced 2025-02-02 06:46:34 +01:00
Add improved chapter_selection
This commit is contained in:
parent
b65ed32b14
commit
84ccfc1b13
2 changed files with 46 additions and 46 deletions
|
@ -26,7 +26,7 @@ default selected_tuple = None
|
|||
init python:
|
||||
|
||||
def select_chapter():
|
||||
global selected_tuple, current_chapter
|
||||
global selected_tuple, current_chapter, is_end_reached
|
||||
|
||||
while True:
|
||||
selected_tuple = renpy.display_menu(tuples_index + [("Go Back", "go_back")])
|
||||
|
@ -39,17 +39,35 @@ init python:
|
|||
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 set_stats():
|
||||
global chapter_list_length, chapter_list_index, ending_route_number, is_end_reached
|
||||
global chapter_list_length, ending_route_number, is_end_reached, lock_scores
|
||||
|
||||
chapter_list_length = len(chapter_list) - 1
|
||||
# chapter_list_length = get_chapter_list_length()
|
||||
ending_route_number = get_ending()
|
||||
|
||||
lock_scores = True # Prevents scores from increasing when using the chapter selection tool
|
||||
|
||||
find_chapter_in_array()
|
||||
|
||||
if not is_end_reached:
|
||||
add_ending_chapters() # From storyline
|
||||
|
||||
update_ending_variables() # From storyline
|
||||
|
||||
renpy.call(current_chapter)
|
||||
|
||||
def set_scores(anon_score, fang_score):
|
||||
global anonscore, fangscore
|
||||
|
||||
anonscore = anon_score
|
||||
fangscore = fang_score
|
||||
|
||||
|
||||
def find_chapter_in_array():
|
||||
|
@ -62,6 +80,14 @@ init python:
|
|||
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:
|
||||
scene black
|
||||
stop sound
|
||||
|
@ -71,27 +97,19 @@ label chapter_select:
|
|||
"Initialize scores:"
|
||||
|
||||
"Ending 1":
|
||||
$ anon_score = 0
|
||||
$ fang_score = 0
|
||||
$ ending_route_number = 1
|
||||
$ set_scores(0, 0)
|
||||
"Ending 2":
|
||||
$ anon_score = 0
|
||||
$ fang_score = 4
|
||||
$ ending_route_number = 2
|
||||
$ set_scores(0, 4)
|
||||
"Ending 3":
|
||||
$ anon_score = 4
|
||||
$ fang_score = 0
|
||||
$ ending_route_number = 3
|
||||
$ set_scores(4, 0)
|
||||
"Ending 4":
|
||||
$ anon_score = 4
|
||||
$ fang_score = 4
|
||||
$ ending_route_number = 4
|
||||
$ set_scores(4, 4)
|
||||
"Exit to main menu":
|
||||
return
|
||||
|
||||
$ lock_scores = True
|
||||
call initstats(anon_score, fang_score) from _call_initstats_2
|
||||
|
||||
|
||||
if not is_end_reached:
|
||||
call reset_chapter_list from _call_reset_chapter_list
|
||||
|
||||
$ select_chapter()
|
||||
|
||||
|
||||
|
|
|
@ -1,26 +1,3 @@
|
|||
# Store the general chapters inside an array for easy manipulation
|
||||
default chapter_list = [
|
||||
"chapter_1", "chapter_2", "chapter_3", "chapter_4", "chapter_5",
|
||||
"chapter_6", "chapter_7", "chapter_8", "chapter_9", "chapter_10", "chapter_11"
|
||||
]
|
||||
|
||||
define ending_routes = {
|
||||
4: ["chapter_11D", "chapter_12D", "chapter_12_5D", "chapter_13D", "chapter_14D"],
|
||||
3: ["chapter_11C", "chapter_12C", "chapter_12_5C", "chapter_13C", "chapter_14C"],
|
||||
2: ["chapter_11B", "chapter_12B", "chapter_13B", "chapter_14B"],
|
||||
1: ["chapter_11A", "chapter_12A", "chapter_12_5D", "chapter_13A", "chapter_14A"]
|
||||
}
|
||||
|
||||
# Chapter related variables
|
||||
default chapter_list_length = len(chapter_list) - 1
|
||||
default chapter_list_index = 0 # Index number for the current position of the chapter_list array
|
||||
default current_chapter = chapter_list[chapter_list_index] # Store the name of the label as a string
|
||||
|
||||
# Ending related variables
|
||||
default ending_route_number = None
|
||||
default is_end_reached = False # consider moving variables out of here
|
||||
|
||||
|
||||
init -1 python:
|
||||
def ending_image():
|
||||
#0b0000, DCBA, flash the bits with |=, check with &
|
||||
|
@ -35,7 +12,7 @@ init -1 python:
|
|||
|
||||
|
||||
init python:
|
||||
# test comment
|
||||
|
||||
def next_story_chapter():
|
||||
global chapter_list_index, current_chapter, ending_route_number
|
||||
|
||||
|
@ -67,7 +44,7 @@ init python:
|
|||
global chapter_list
|
||||
|
||||
if ending_route_number in ending_routes:
|
||||
chapter_list.extend(ending_routes[ending_route_number])
|
||||
chapter_list.extend(ending_routes[ending_route_number])
|
||||
|
||||
|
||||
def update_ending_variables():
|
||||
|
@ -75,10 +52,15 @@ init python:
|
|||
global is_end_reached
|
||||
|
||||
# chapter_list_length is updated to reflect the addition to the chapter_list array
|
||||
chapter_list_length = len(chapter_list) - 1
|
||||
chapter_list_length = get_chapter_list_length()
|
||||
is_end_reached = True
|
||||
|
||||
|
||||
def get_chapter_list_length():
|
||||
return len(chapter_list) - 1
|
||||
|
||||
|
||||
|
||||
def end_story():
|
||||
ending_image()
|
||||
renpy.call("lending")
|
||||
|
|
Loading…
Reference in a new issue