Issue with layered images

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
Sugar_and_rice
Newbie
Posts: 12
Joined: Tue Feb 21, 2017 2:57 pm
Contact:

Issue with layered images

#1 Post by Sugar_and_rice »

Hey guys! For some reason, I am having trouble making layered images work. I've read through the documentation on this but I must be messing up how I set it up somehow as it just isn't working for me. Any combination of attributes result in some form of "Exception: Image 'kazuki eyes_mad' does not accept attributes 'mouth_happy'." I would really appreciate anyone taking a quick look over this and seeing where I must have messed up. Thank you so much!

Code: Select all

define k = Character("Kazuki", color="#6D6D6D", callback=[high_beep,name_callback], cb_name='kazuki', image='kazuki')

layeredimage kazuki:
    at sprite_highlight('kazuki')
    attribute base default:
        "kazuki/kazuki_base1.png"
    group eyes:
        attribute eyes_confused_closed:
            "kazuki/kazuki_base1_eyes_confused_closed.png"
        attribute eyes_confused_open:
            "kazuki/kazuki_base1_eyes_confused_open.png"
        attribute eyes_distorted_open:
            "kazuki/kazuki_base1_eyes_distorted_open.png"
        attribute eyes_embarrassed_open:
            "kazuki/kazuki_base1_eyes_embarrassed_open.png"
        attribute eyes_happy_open:
            "kazuki/kazuki_base1_eyes_happy_open.png"
        attribute eyes_jaded_open:
            "kazuki/kazuki_base1_eyes_jaded_open.png"
        attribute eyes_mad:
            "kazuki/kazuki_base1_eyes_mad.png"
        attribute eyes_neutral_open default:
            "kazuki/kazuki_base1_eyes_neutral_open.png"
        attribute eyes_neautralhappy_open:
            "kazuki/kazuki_base1_eyes_neutralhappy_closed.png"
        attribute eyes_sad_closed:
            "kazuki/kazuki_base1_eyes_sad_closed.png"
        attribute eyes_sad_open:
            "kazuki/kazuki_base1_eyes_sad_open.png"
    group eyebrows:
        attribute eyebrows_confused:
            "kazuki/kazuki_base1_eyebrows_confused.png"
        attribute eyebrows_distorted:
            "kazuki/kazuki_base1_eyebrows_distorted.png"
        attribute eyebrows_embarrassed:
            "kazuki/kazuki_base1_eyebrows_embarrassed.png"
        attribute eyebrows_embarrassed2:
            "kazuki/kazuki_base1_eyebrows_embarrassed2.png"
        attribute eyebrows_happy:
            "kazuki/kazuki_base1_eyebrows_happy.png"
        attribute eyebrows_jaded:
            "kazuki/kazuki_base1_eyebrows_jaded.png"
        attribute eyebrows_mad:
            "kazuki/kazuki_base1_eyebrows_mad.png"
        attribute eyebrows_neutral default:
            "kazuki/kazuki_base1_eyebrows_neutral.png"
        attribute eyebrows_sad:
            "kazuki/kazuki_base1_eyebrows_sad.png"
    group mouth:
        attribute mouth_confused:
            "kazuki/kazuki_base1_mouth_confused.png"
        attribute mouth_distorted:
            "kazuki/kazuki_base1_mouth_distorted.png"
        attribute mouth_embarrassed:
            "kazuki/kazuki_base1_mouth_embarrassed.png"
        attribute mouth_happy:
            "kazuki/kazuki_base1_mouth_happy.png"
        attribute mouth_jaded:
            "kazuki/kazuki_base1_mouth_jaded.png"
        attribute mouth_mad:
            "kazuki/kazuki_base1_mouth_mad.png"
        attribute mouth_neutral default:
            "kazuki/kazuki_base1_mouth_neutral.png"
        attribute mouth_sad:
            "kazuki/kazuki_base1_mouth_sad.png"
            
 label start:
 	#both of these give exceptions
 	show kazuki eyes_mad mouth_happy at spr2
 	k eyes_confused_open eyebrows_distorted mouth_mad "Hello."

User avatar
m_from_space
Miko-Class Veteran
Posts: 985
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: Issue with layered images

#2 Post by m_from_space »

Sugar_and_rice wrote: Wed Apr 24, 2024 7:24 pm Hey guys! For some reason, I am having trouble making layered images work. I've read through the documentation on this but I must be messing up how I set it up somehow as it just isn't working for me. Any combination of attributes result in some form of "Exception: Image 'kazuki eyes_mad' does not accept attributes 'mouth_happy'." I would really appreciate anyone taking a quick look over this and seeing where I must have messed up. Thank you so much!
I cannot spot any problems in the code you provided. The following works for me (you can strip all those relative paths, maybe it has something to do with it but I don't think so). For test reasons I did not include a transform in the layered image.

Code: Select all

layeredimage kazuki:
    # did you mean "always" here?
    attribute base default:
        "kazuki_base1"
    group eyes:
        attribute eyes_confused_closed:
            "kazuki_base1_eyes_confused_closed"
        attribute eyes_confused_open:
            "kazuki_base1_eyes_confused_open"
        attribute eyes_distorted_open:
            "kazuki_base1_eyes_distorted_open"
        attribute eyes_embarrassed_open:
            "kazuki_base1_eyes_embarrassed_open"
        attribute eyes_happy_open:
            "kazuki_base1_eyes_happy_open"
        attribute eyes_jaded_open:
            "kazuki_base1_eyes_jaded_open"
        attribute eyes_mad:
            "kazuki_base1_eyes_mad"
        attribute eyes_neutral_open default:
            "kazuki_base1_eyes_neutral_open"
        attribute eyes_neautralhappy_open:
            "kazuki_base1_eyes_neutralhappy_closed"
        attribute eyes_sad_closed:
            "kazuki_base1_eyes_sad_closed"
        attribute eyes_sad_open:
            "kazuki_base1_eyes_sad_open"
    group eyebrows:
        attribute eyebrows_confused:
            "kazuki_base1_eyebrows_confused"
        attribute eyebrows_distorted:
            "kazuki_base1_eyebrows_distorted"
        attribute eyebrows_embarrassed:
            "kazuki_base1_eyebrows_embarrassed"
        attribute eyebrows_embarrassed2:
            "kazuki_base1_eyebrows_embarrassed2"
        attribute eyebrows_happy:
            "kazuki_base1_eyebrows_happy"
        attribute eyebrows_jaded:
            "kazuki_base1_eyebrows_jaded"
        attribute eyebrows_mad:
            "kazuki_base1_eyebrows_mad"
        attribute eyebrows_neutral default:
            "kazuki_base1_eyebrows_neutral"
        attribute eyebrows_sad:
            "kazuki_base1_eyebrows_sad"
    group mouth:
        attribute mouth_confused:
            "kazuki_base1_mouth_confused"
        attribute mouth_distorted:
            "kazuki_base1_mouth_distorted"
        attribute mouth_embarrassed:
            "kazuki_base1_mouth_embarrassed"
        attribute mouth_happy:
            "kazuki_base1_mouth_happy"
        attribute mouth_jaded:
            "kazuki_base1_mouth_jaded"
        attribute mouth_mad:
            "kazuki_base1_mouth_mad"
        attribute mouth_neutral default:
            "kazuki_base1_mouth_neutral"
        attribute mouth_sad:
            "kazuki_base1_mouth_sad"

label start:
    # does not throw an error
    show kazuki eyes_mad mouth_happy
    "..."

Post Reply

Who is online

Users browsing this forum: Google [Bot], nightflower