Character image selection?
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
-
- Regular
- Posts: 55
- Joined: Mon Jan 13, 2014 11:46 pm
- Contact:
Character image selection?
Sorry if this is a stupid question, but I wanted the option of choosing a male or female protagonist that will define character images without writing an if statement every time I need to show that character? For example is there any statement I could use to define a specific image command as using a different image depending on a user's choice at the beginning of the game?
Re: Character image selection?
You could save the character image as a variable, and just access the variable whenever you need to display the character.
More specifically:
-User selects a character image (userSelection)
-Store userSelection in a variable (playerImage)
-Display playerImage whenever the player is to be shown.
More specifically:
-User selects a character image (userSelection)
-Store userSelection in a variable (playerImage)
-Display playerImage whenever the player is to be shown.
Re: Character image selection?
I believe you are referring to side images? You can try this:
Code: Select all
$ pov = Character('Player', color="#F8BA87",show_side=ConditionSwitch("povGender == Male", "pov_male.png","povGender == Female", "pov_female.png"))
- OokamiKasumi
- Eileen-Class Veteran
- Posts: 1779
- Joined: Thu Oct 14, 2010 3:53 am
- Completed: 14 games released -- and Counting.
- Organization: DarkErotica Games
- Deviantart: OokamiKasumi
- Location: NC, USA
- Contact:
Re: Character image selection?
This is exactly what I did in my most recent game "Trap!"lemonokashi wrote:...I wanted the option of choosing a male or female protagonist that will define character images without writing an if statement every time I need to show that character? For example is there any statement I could use to define a specific image command as using a different image depending on a user's choice at the beginning of the game?
-- I accomplished this by way of a ConditionSwitch in the image definitions.
First, you'll need to define ALL versions of your PC images with ConditionSwitch.
-- I only had 3 versions of each image: Neutral, Annoyed, and Concerned in Left & Right, making 6 total images in both male & female.
Code: Select all
init:
image pc = "ch/male/mConR.png"
# ----------------------------------------------------
image pc neuR = ConditionSwitch(
"gender == 'female' ", Image ("ch/fem/fNeuR.png"),
"gender == 'male' ", Image ("ch/male/mNeuR.png"),
"True", Image ("ch/male/mNeuR.png"),
)
image pc neuL = ConditionSwitch(
"gender == 'female' ", Image ("ch/fem/fNeuL.png"),
"gender == 'male' ", Image ("ch/male/mNeuL.png"),
"True", Image ("ch/male/mNeuL.png"),
)
Next, in script.rpy define your character so that it can be named.
Code: Select all
init:
$ e = DynamicCharacter("pc_name",
color="#ffffcc",
outlines = [(1, "#333300", 0, 0)],
drop_shadow = (2, 2,),
what_prefix="\"",
what_suffix="\"",
show_two_window = True,
ctc="ctc_blink",
ctc_position="fixed",)
$ e_side = DynamicCharacter("pc_name",
color="#ffffcc",
outlines = [(1, "#333300", 0, 0)],
drop_shadow = (2, 2,),
show_side_image=ConditionSwitch(
"gender == 'female' ", "ch/fem/f_side.png",
"gender == 'male' ", "ch/male/m_side.png",
xalign=0.0, yalign=1.0),
what_prefix="\"",
what_suffix="\"",
show_two_window = True,
ctc="ctc_blink",
ctc_position="fixed",)
Code: Select all
# -----------------------------------------
label start:
$ pc = " "
$ gender = " "
Code: Select all
#################################################
scene bg_02
show gal at right
show guy at left
with fade
menu:
"Would you like a Male Lead character?":
$ gender = 'male'
hide gal with dissolve
show guy at center with move
"Or a Female Lead character?":
$ gender = 'female'
hide guy with dissolve
show gal at center with move
label name:
$ pc_name = renpy.input("What would you like to name your character? \n{i}{color=#cccc99} -- Backspace to erase the current name. When you're done, hit Enter.{/color}{/i}\n", "Chris", length=15)
$ pc_name = pc_name.strip()
scene black with fade
Done this way, you can simply show, hide, and transition your character image just like any other image -- without the need of any extra flags.
Code: Select all
show pc neuL at right with moveinright
Ookami Kasumi ~ Purveyor of fine Smut.
Most recent Games Completed:
"No amount of great animation will save a bad story." -- John Lasseter of Pixar
Most recent Games Completed:
- The Walk[Psychological][NanoWinter] ~ PG New!
- Trap! [ModernFantasy][VN] ~ PG16
- The Adventures of Prince Ivan [Fant/Adv/VN] ~ PG
"No amount of great animation will save a bad story." -- John Lasseter of Pixar
Re: Character image selection?
There are to many ways of doing this... best way is to sort all of the images in two folders (male/female), bulkload them into the game and allow player to pic one.lemonokashi wrote:Sorry if this is a stupid question, but I wanted the option of choosing a male or female protagonist that will define character images without writing an if statement every time I need to show that character? For example is there any statement I could use to define a specific image command as using a different image depending on a user's choice at the beginning of the game?
-
- Regular
- Posts: 55
- Joined: Mon Jan 13, 2014 11:46 pm
- Contact:
Re: Character image selection?
That is so helpful! Thank you very much!
Who is online
Users browsing this forum: Google [Bot]