Hello All!
I am new to RenPy and I am trying to create a new menu item to show a list of thumbnails so the user can select which chapter they want to play:
Code:
"chapter_selection" code:
"chapters" code:
My "chapter_list" will have a list of images with the Chapter covers (I'm adding duplicate images just to add more images, I only have 3 chapters so far):
And this is what it shows:
So far, so good. When I click one of the first 3 chapters, these actions are executed:
This is my "warning" code:
So, when I click in one of the chapters, the selected chapter starts. However, when the chapter ends, the game automatically starts, as if I had clicked the "Start" menu option.
This is what I have in the end of each of my chapter labels:
So that is my problem, I don't want the game automatically starting after the chapter is played. Ideally, the game should go back to the chapter selection menu or to the main screen. Can anyone provide some insight, please? Thanks in advance!
I am new to RenPy and I am trying to create a new menu item to show a list of thumbnails so the user can select which chapter they want to play:
Code:
Python:
screen navigation():
vbox:
style_prefix "navigation"
xpos gui.navigation_xpos
yalign 0.5
spacing gui.navigation_spacing
if main_menu:
textbutton _("Start") action Start()
textbutton _("Chapters") action ShowMenu("chapter_selection")
else:
Python:
screen chapter_selection():
tag menu
use chapters
textbutton _("Return"):
style "return_button"
action Return()
Python:
screen chapters():
$ chapter_index = 1
frame:
vpgrid:
cols 3
spacing 10
draggable True mousewheel True
allow_underfull True
xsize 780
ysize 540
scrollbars "vertical"
side_xalign 0.5
for q in chapter_list:
$ lb_image = im.Scale(q, 234, 187)
imagebutton:
idle lb_image
hover lb_image
action [SetVariable("triggered_by", "chapter"), SetVariable("start_chapter", chapter_index), Jump("warning")]
selected False
$ chapter_index = chapter_index + 1
Python:
default chapter_list = ["001/000000-01.webp", "002/000000-01.webp", "003/000000-01.webp","001/000000-01.webp", "002/000000-01.webp", "003/000000-01.webp", "001/000000-01.webp", "002/000000-01.webp", "003/000000-01.webp", "001/000000-01.webp", "002/000000-01.webp", "003/000000-01.webp"]
default chapter_index = 1
So far, so good. When I click one of the first 3 chapters, these actions are executed:
Python:
action [SetVariable("triggered_by", "chapter"), SetVariable("start_chapter", chapter_index), Jump("warning")]
Python:
label start:
$ triggered_by = "start"
$ start_chapter = 1
label warning:
scene black
"{b}You must be at least 18 years old to play this game. If you are under 18 you should close the game immediately!{/b}"
menu:
"Do you confirm that you are 18 years or older?"
"Yes: I am at least 18 years old" if True:
pause (0.5)
"No: Please close the game" if True:
$ renpy.quit()
if start_chapter == 1:
jump chapter_001
elif start_chapter == 2:
jump chapter_002
elif start_chapter == 3:
jump chapter_003
This is what I have in the end of each of my chapter labels:
Python:
if triggered_by != "start":
jump the_end
#######################################################################
# The end
#######################################################################
label the_end:
return
Last edited: