Can set new sets of sprites with the same name? [SOLVED]

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.
Post Reply
Message
Author
User avatar
GeeSeki
Regular
Posts: 112
Joined: Sat Dec 17, 2016 3:39 am
Projects: A Town Uncovered
itch: geeseki
Contact:

Can set new sets of sprites with the same name? [SOLVED]

#1 Post by GeeSeki »

I don't know if that made sense but basically, I want to know if there's a way to set the character's sprites from one set to another but use the same 'name'?

For example:

Code: Select all

image pov neutral = "character/char_pov_neutral.png"
Somewhere in the game, the player MIGHT get hurt and bruised so the player's character may look beaten up. At the same time, the player MIGHT NOT get hurt and the character doesn't change.

The story will be exactly the same but the character may not be, and I don't want to have double the set of code with 2 different sprite names being used.

I want to use 'pov neutral' to show him looking fine, and him looking beaten up, depending on the player's outcome.

Is there such thing as what I want? If that made ANY sense at all.
Last edited by GeeSeki on Wed May 24, 2017 7:43 pm, edited 1 time in total.

User avatar
Divona
Miko-Class Veteran
Posts: 678
Joined: Sun Jun 05, 2016 8:29 pm
Completed: The Falconers: Moonlight
Organization: Bionic Penguin
itch: bionicpenguin
Contact:

Re: Am I able to set new sets of sprites with the same name?

#2 Post by Divona »

Use ConditionSwitch.

Code: Select all

default pov_wounded = False

image pov neutral = ConditionSwitch(
    "pov_wounded == True", "character/char_pov_wounded_neutral.png",
    "True", "character/char_pov_neutral.png"
)

label start:

    show pov_neutral

    "I have to do something."

    menu:
        "Stab myself.":
            $ pov_wounded = True
            "Ow!"
            with hpunch

        "Stand still.":
            "OK. Let's stand here until it's all over."
            "......"

    "Alright. How do I look?"
Completed:
Image

User avatar
GeeSeki
Regular
Posts: 112
Joined: Sat Dec 17, 2016 3:39 am
Projects: A Town Uncovered
itch: geeseki
Contact:

Re: Am I able to set new sets of sprites with the same name?

#3 Post by GeeSeki »

Divona wrote:Use ConditionSwitch.

Code: Select all

default pov_wounded = False

image pov neutral = ConditionSwitch(
    "pov_wounded == True", "character/char_pov_wounded_neutral.png",
    "True", "character/char_pov_neutral.png"
)

label start:

    show pov_neutral

    "I have to do something."

    menu:
        "Stab myself.":
            $ pov_wounded = True
            "Ow!"
            with hpunch

        "Stand still.":
            "OK. Let's stand here until it's all over."
            "......"

    "Alright. How do I look?"
Thank you so much for that! :D

Post Reply

Who is online

Users browsing this forum: Google [Bot]