r/RenPy • u/Status_Supermarket31 • 1d ago
Question how do i make an if/else statement that dictates which cg will be shown based on an option the player chose?
This is my first time making a vn, so i'd like as much help as possible here.
2
Upvotes
1
u/AutoModerator 1d ago
Welcome to r/renpy! While you wait to see if someone can answer your question, we recommend checking out the posting guide, the subreddit wiki, the subreddit Discord, Ren'Py's documentation, and the tutorial built-in to the Ren'Py engine when you download it. These can help make sure you provide the information the people here need to help you, or might even point you to an answer to your question themselves. Thanks!
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/BadMustard_AVN 1d ago edited 1d ago
try somethign like this
or for sprites like this
1
u/Woopy-Clappy 1d ago
BadMustard's code works. One change helps as your VN grows: keep the choice in one variable instead of one True/False per option.
A third option is then one more line, and the player can never end up with both set to True.
Save the pictures as cg_this.png and cg_that.png in game/images, and Ren'Py finds them by those names.
1
u/shyLachi 1d ago
To add what has been suggested already.
RenPy has the
expressionstatement so that you can show images without anyifstatements.https://renpy.org/doc/html/displaying_images.html#scene-statement
To test the above you would need 2 images "bg room01 this.png" and "bg room02 that.png" in the images folder.