Assigning Specific Animation to Specific Image Attribute?

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
gimyosan
Newbie
Posts: 2
Joined: Sun Jan 05, 2020 3:50 am
Tumblr: gimyosan
Contact:

Assigning Specific Animation to Specific Image Attribute?

#1 Post by gimyosan » Sun Jan 05, 2020 4:28 am

Hi! I'm new to Ren'Py and the forums, and I'm currently trying to implement a set of dynamic character sprites.

What I'm trying to do right now is get blinks implemented. Originally, I had blinks implemented like this:

Code: Select all

    
image npc sad:
    
    contains:
        "npc_sad.png"
        
    contains:
        "npc_sad_blink.png"
        block:

            alpha 0.0
            getNumber() #RNG
            linear 0.05 alpha 1.0
            0.05
            linear 0.05 alpha 1.0

            repeat
But I needed a system that would support dynamic images, so I switched to using Layered Image Attributes. The dynamic system is working like a charm, but I have a problem: I need unique blink animations to be paired with specific expression sprites.

First, I tried adding an ATL directly to the attribute, but this doesn't work because image attributes don't support multiple images per attribute.

Code: Select all

    
init -1:

    layeredimage npc:

        always:
            "npc_default"

        group head:
            attribute sad:
                "npc_head_sad"
                "npc_head_sad_blink"

return
Next, I tried defining the ATL directly in the attribute, but this doesn't work either.

Code: Select all

    
init -1:

    layeredimage npc:

        always:
            "npc_default"

        group head:
            attribute sad:
                contains:
                    "npc_sad.png"
                contains:
                    "npc_sad_blink.png"
                    block:

                        alpha 0.0
                        getNumber() #RNG
                        linear 0.05 alpha 1.0 
                        0.05 
                        linear 0.05 alpha 1.0
         
                        repeat

return
I'm a bit lost as how to do this. I could of course bruteforce the issue and create unique the expression attributes for each blink, but that seems clumsy and I'd like to see if there's any way to implement the system I have in mind still using layered image attributes.

Thanks so much!

User avatar
Wudgeous
Regular
Posts: 37
Joined: Tue Apr 30, 2019 5:59 am
itch: wudgeous
Contact:

Re: Assigning Specific Animation to Specific Image Attribute?

#2 Post by Wudgeous » Thu Jan 09, 2020 12:13 pm

This video on advanced displayables might help!

It does require you to save a unique set of eyes in specifically marked folders, so you can have as many unique blinks as you need.
Have confidence. Let go of perfectionism. I love you!
Image
A superhero dating sim in fresh hot development!


You can also keep up with me on Twitter and Itch!

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], H Lenin, Mikasa01