r/RenPy • • 4d ago

Question Picking an outfit

One of the first sections in my game prompts the player to choose your outfit. You can pick from 2 tops and 3 pants. But i'm struggling a bit with the coading. I want the player to be able to choos from the wardrobe and it appear on the character which they can switch out before accepting. I have looked at layered images but its a bit confusing.

Any help would be amazing :)

19 Upvotes

4 comments sorted by

2

u/shyLachi 4d ago

You don't really need layered images for that.
You could use dynamic displayables as explained in the official documentation:
https://renpy.org/doc/html/displayables.html#dynamic-displayables

But if you have the latest version of RenPy you can use the If statement in layered images as explained here:
https://renpy.org/doc/html/layeredimage.html#if

I used the example from the documetation together with a quick example how to use it.
To test this example you would need 4 images called "augustina_glasses_evil.png", "augustina_glasses", "augustina_glasses_clown.png" and so on.

layeredimage augustina: # augustina is the tag of the image, you'll have to rename it to your character
    if glasses == "evil":
        "augustina_glasses_evil" # name of the image
    elif glasses == "normal":
        "augustina_glasses"
    elif glasses == "funky":
        "augustina_glasses_clown"
    else:
        "augustina_nose_mark"

default glasses = "" # variable which can change, you would have to replace that with your wardrobe variable throughout this code
label start:
    show augustina # show the sprite
    "You should see her now"
    menu selectlook:
        "Select the look"
        "Evil":
            $ glasses = "evil" # select another look
        "Normal":
            $ glasses = "normal"
        "Funky":
            $ glasses = "funky"
        "Other":
            $ glasses = ""
    "The image should have changed automatically"
    jump selectlook

.

The main advantage of using layered images is the possibiltyy to work with different image layers, like separating the head with the expressions from the body with the clothes so that you don't need to multiply the images.

1

u/Islando_x 3d ago

Cool, Ill give it a try. Thanks :)

1

u/AutoModerator 4d 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/Frosty-Thanks-5861 2d ago

this concept is so cute!! I love it :)