Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
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.
So, I want to let the player, at the beginning of the game, choose between two playable characters, Sarah and Alexandra. The only difference is the side image. I tried this code:
# The script of the game goes in this file.
# Declare characters used by this game. The color argument colorizes the
# name of the character.
define a = Character("MC", color="#04B4AE", image=ConditionSwitch("who=='2'", "alexandra", "who=='1'", "sarah"), window_left_padding=140)
image side a N = ConditionSwitch(
"who=='2'", "side alexandra neutral.png",
"who=='1'", "side sarah neutral.png")
# The game starts here.
label start:
$ who = 2
menu:
"Who are you?"
"Sarah":
$ who = 1
pass
"Alexandra":
$ who = 2
a N "Test!"
But when I actually try it it doesn't display the side image. What am I doing wrong?
Looking cool, Joker! -Morgana, 2017
----------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------- My dreams dictate my reality
# The script of the game goes in this file.
# Declare characters used by this game. The color argument colorizes the
# name of the character.
define a = Character("MC", color="#04B4AE", image=ConditionSwitch("who==2", "alexandra", "who==1", "sarah"), window_left_padding=140)
image side a N = ConditionSwitch(
"who==2", "side alexandra neutral.png",
"who==1", "side sarah neutral.png")
# The game starts here.
label start:
$ who = 2
menu:
"Who are you?"
"Sarah":
$ who = 1
pass
"Alexandra":
$ who = 2
a N "Test!"
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
You dont need to change both variables. Make the 1 the default character and leave it unchanged in the choice and when choosen the other simply do +1 for them to make it 2. Like this:
#The script of the game goes in this file.
# Declare characters used by this game. The color argument colorizes the
# name of the character.
define a = Character("MC", color="#04B4AE", image=ConditionSwitch("who == 1", "alexandra", "who == 2", "sarah"), window_left_padding=140)
#changed to make alexandra the "default" charcater, hence changed numbers
image side a N = ConditionSwitch(
"who == 1", "side alexandra neutral.png",
"who == 2", "side sarah neutral.png")
#variables should be defined with default outside of the labels. Make the default charcater the 1
default who = 1
# The game starts here.
label start:
menu:
"Who are you?"
"Sarah":
$ who += 1
pass
"Alexandra":
pass
a N "Test!"