Character select screen using imagebuttons
Posted: Thu Apr 07, 2022 1:02 pm
I saw an older post for making a character select screen using image maps. I made one using imagebuttons that might be better and more flexible in the long run.
Here is the code for the main screen
Here is the code for the confirmation screen
Here is the code for the images
Here is the code for the variables for each character.
And this the code you need to add to your main script.
Feedback is always appreciated.
Here is the code for the main screen
Code: Select all
screen CharacterSelect():
tag CharSelection
label "Choose your Character" xalign 0.5
hbox:
yalign 0.70
xalign 0.5
imagebutton auto "Eileen %s" yalign 1.0 action Call("EileenDes")
imagebutton auto "Sylvie %s" yalign 1.0 action Call("SylvieDes")
Code: Select all
screen CharacterProfile(pic, name, gender, orientation, description):
tag CharSelection
style_prefix "CharProfile"
default Pronoun = "Her"
if gender == "Male":
$ Pronoun = "Him"
hbox:
yalign 0.5
xalign 0.5
spacing 40
add pic
vbox:
yalign 0.25
xmaximum 0.25
grid 2 3:
text "Name:"
text name
text "Gender:"
text gender
text "Orientation:"
text orientation
text "Description: [description]"
text "Do you want to choose [Pronoun]?"
hbox:
textbutton "Yes" action Return()
textbutton "No" action Jump("Selection")
Code: Select all
layeredimage Eileen:
<Insert image data>
image Eileen idle = At("Eileen", darken)
image Eileen hover = "Eileen"
layeredimage Sylvie:
<Insert image data>
image Sylvie idle = At("Sylvie", darken)
image Sylvie hover = "Sylvie"
Code: Select all
define EileenName = "Eileen"
define EileenGender = "Female"
define EileenOrientation = "Unknown"
define EileenDescription = "Ren'py's Mascot."
define SylvieName = "Sylvie"
define SylvieGender = "Female"
define SylvieOrientation = "Unknown"
define SylvieDescription = "a girl from The Question."
Code: Select all
label Selection:
$ show_quick_menu = False
call screen CharacterSelect
jump
label EileenDes:
$ show_quick_menu = True
hide screen CharacterSelect
call screen CharacterProfile("Eileen", EileenName, EileenGender, EileenOrientation, EileenDescription)
$ Playing = "Eileen"
jump objectives
label SylvieDes:
$ show_quick_menu = True
hide screen CharacterSelect
call screen CharacterProfile("Sylvie", SylvieName, SylvieGender, SylvieOrientation, SylvieDescription)
$ Playing = "Sylvie"
jump objectives
label objectives:
hide screen CharacterProfile
if Playing == "Eileen":
show Eileen
"Eileen's goal is to show you how to make a VN."
elif Playing == "Sylvie":
show Sylvie
"Sylvie's goal is to be an artist for a VN."
return