Layered image if statement transition

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
rivvil
Regular
Posts: 26
Joined: Fri Feb 20, 2015 3:05 pm
Location: Russia
Contact:

Layered image if statement transition

#1 Post by rivvil » Tue Sep 06, 2022 5:31 am

Hello. Lets say, I have a following character and an associated layered image:

Code: Select all

define char = Character('Char', image='char')
default char_hat = True

layeredimage char:
  always "char_body"

  attribute smile

  if char_hat:
    "char_hat"
And I have the following code:

Code: Select all

show char
char 'Hello. I'm taking off a hat.'
$ char_hat = False
char smile "That's it!"
I set config.say_attribute_transition to animate smile appearance and it works fine, but a hat dissappears instantly. Is there a way to dissolve it when char_hat value changes?

Yare-yare
Newbie
Posts: 4
Joined: Fri Sep 02, 2022 9:42 am
Contact:

Re: Layered image if statement transition

#2 Post by Yare-yare » Mon Sep 12, 2022 12:00 pm

I think better and cleaner would be to add a nohat attribute and separate them into groups like this:

Code: Select all

layeredimage char:
    group pose:
        always "char_body"

    group mood:
        attribute smile:
            "char_smile"

    group clothes:
        attribute hat:
            "char_hat"
        attribute nohat:
            "char_nohat"

Code: Select all

show char hat
char 'Hello. I'm taking off a hat.'
char smile nohat "That's it!"
That's how I do it and it works like a charm I guess :v

Post Reply

Who is online

Users browsing this forum: Google [Bot], Majestic-12 [Bot]