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:
|
init python:
|
||||||
|
|
||||||
def select_chapter():
|
def select_chapter():
|
||||||
global selected_tuple, current_chapter
|
global selected_tuple, current_chapter, is_end_reached
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
selected_tuple = renpy.display_menu(tuples_index + [("Go Back", "go_back")])
|
selected_tuple = renpy.display_menu(tuples_index + [("Go Back", "go_back")])
|
||||||
|
@ -39,17 +39,35 @@ init python:
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
is_end_reached = False # Reset this for when the tool is used more than once
|
||||||
|
|
||||||
set_stats()
|
set_stats()
|
||||||
|
toggle_debug()
|
||||||
|
|
||||||
|
renpy.call(current_chapter)
|
||||||
|
|
||||||
|
|
||||||
def set_stats():
|
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()
|
find_chapter_in_array()
|
||||||
|
|
||||||
renpy.call(current_chapter)
|
if not is_end_reached:
|
||||||
|
add_ending_chapters() # From storyline
|
||||||
|
|
||||||
|
update_ending_variables() # From storyline
|
||||||
|
|
||||||
|
|
||||||
|
def set_scores(anon_score, fang_score):
|
||||||
|
global anonscore, fangscore
|
||||||
|
|
||||||
|
anonscore = anon_score
|
||||||
|
fangscore = fang_score
|
||||||
|
|
||||||
|
|
||||||
def find_chapter_in_array():
|
def find_chapter_in_array():
|
||||||
|
@ -62,6 +80,14 @@ init python:
|
||||||
current_chapter = ""
|
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:
|
label chapter_select:
|
||||||
scene black
|
scene black
|
||||||
stop sound
|
stop sound
|
||||||
|
@ -71,26 +97,18 @@ label chapter_select:
|
||||||
"Initialize scores:"
|
"Initialize scores:"
|
||||||
|
|
||||||
"Ending 1":
|
"Ending 1":
|
||||||
$ anon_score = 0
|
$ set_scores(0, 0)
|
||||||
$ fang_score = 0
|
|
||||||
$ ending_route_number = 1
|
|
||||||
"Ending 2":
|
"Ending 2":
|
||||||
$ anon_score = 0
|
$ set_scores(0, 4)
|
||||||
$ fang_score = 4
|
|
||||||
$ ending_route_number = 2
|
|
||||||
"Ending 3":
|
"Ending 3":
|
||||||
$ anon_score = 4
|
$ set_scores(4, 0)
|
||||||
$ fang_score = 0
|
|
||||||
$ ending_route_number = 3
|
|
||||||
"Ending 4":
|
"Ending 4":
|
||||||
$ anon_score = 4
|
$ set_scores(4, 4)
|
||||||
$ fang_score = 4
|
|
||||||
$ ending_route_number = 4
|
|
||||||
"Exit to main menu":
|
"Exit to main menu":
|
||||||
return
|
return
|
||||||
|
|
||||||
$ lock_scores = True
|
if not is_end_reached:
|
||||||
call initstats(anon_score, fang_score) from _call_initstats_2
|
call reset_chapter_list from _call_reset_chapter_list
|
||||||
|
|
||||||
$ select_chapter()
|
$ 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:
|
init -1 python:
|
||||||
def ending_image():
|
def ending_image():
|
||||||
#0b0000, DCBA, flash the bits with |=, check with &
|
#0b0000, DCBA, flash the bits with |=, check with &
|
||||||
|
@ -35,7 +12,7 @@ init -1 python:
|
||||||
|
|
||||||
|
|
||||||
init python:
|
init python:
|
||||||
# test comment
|
|
||||||
def next_story_chapter():
|
def next_story_chapter():
|
||||||
global chapter_list_index, current_chapter, ending_route_number
|
global chapter_list_index, current_chapter, ending_route_number
|
||||||
|
|
||||||
|
@ -75,10 +52,15 @@ init python:
|
||||||
global is_end_reached
|
global is_end_reached
|
||||||
|
|
||||||
# chapter_list_length is updated to reflect the addition to the chapter_list array
|
# 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
|
is_end_reached = True
|
||||||
|
|
||||||
|
|
||||||
|
def get_chapter_list_length():
|
||||||
|
return len(chapter_list) - 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def end_story():
|
def end_story():
|
||||||
ending_image()
|
ending_image()
|
||||||
renpy.call("lending")
|
renpy.call("lending")
|
||||||
|
|
Loading…
Reference in a new issue