Page 1 of 1

Is it still OK to use LiveComposite for blinking sprites?

Posted: Tue Apr 20, 2021 7:07 am
by thirstyoctopus
Hey everyone

I was considering implementing a blinking aesthetic to my character sprites in the game I'm working on and doing some searching I could only find the deprecated page referring to LiveComposite for Blinking and Lip Flap. I don't need the lip flap as my game is voice markers only but I wondered if there was another way to have automatic random blinking for sprites that are on screen? I currently use layeredimages in my project and each sprite has a blank face body with a set of expressions, so if I were to separate the eyes from the mouth would it be possible to implement this feature easily?

Any advice on this that steers away from the LiveComposite option would be appreciated, thank you.

Re: Is it still OK to use LiveComposite for blinking sprites?

Posted: Tue Apr 20, 2021 7:36 am
by Ocelot
You can define an ATL animation for your eyes and use that animated image in layeredimage. For example following will create animation with randomly blinking eyes:

Code: Select all

image blinking_eyes:
    "eyes_open"
    choice:
        pause 8.0
    choice:
        pause 12.0
    choice 0.5:
        pause 4.0
    choice 0.2:
        pause 0.8
    "eyes_closed"
    pause 0.5
    repeat

Re: Is it still OK to use LiveComposite for blinking sprites?

Posted: Tue Apr 20, 2021 9:04 am
by thirstyoctopus
Ocelot wrote:
Tue Apr 20, 2021 7:36 am
You can define an ATL animation for your eyes and use that animated image in layeredimage. For example following will create animation with randomly blinking eyes:

Code: Select all

image blinking_eyes:
    "eyes_open"
    choice:
        pause 8.0
    choice:
        pause 12.0
    choice 0.5:
        pause 4.0
    choice 0.2:
        pause 0.8
    "eyes_closed"
    pause 0.5
    repeat
Thanks for the suggestion. Would you be able to explain how to implement this though? I was hoping I wouldn't have to go through every line I'd included a sprite to be able to make this work.

Currently, my layeredimages are set up as follows, with a set of poses and a set of expressions which are assigned automatically based on file name:

Code: Select all

layeredimage l:
    group pose auto:
        attribute u1 default
    group face auto
And I would reference them in the script like this:

Code: Select all

show l u1 s1 at position

Re: Is it still OK to use LiveComposite for blinking sprites?

Posted: Tue Apr 20, 2021 4:09 pm
by Imperf3kt
Note that "LiveComposite" was replaced with just "Composite" a few years ago

Re: Is it still OK to use LiveComposite for blinking sprites?

Posted: Wed Apr 21, 2021 3:17 am
by Syrale
Not sure if you can combine the "auto" method with defining stuff on your own, but if you can, this should work:

Code: Select all

layeredimage l:
    group pose auto:
        attribute u1 default
    group face auto
    group eyes:
    	attribute open_eyes default "blinking_eyes"
    	attribute closed_eyes "images/character/closed_eyes.png"
Basically: For the animated eyes, you add the name of the image you defined. For all other eyes (aka those that don't blink), you have to add the file path instead.

Re: Is it still OK to use LiveComposite for blinking sprites?

Posted: Wed Apr 21, 2021 5:27 am
by thirstyoctopus
Syrale wrote:
Wed Apr 21, 2021 3:17 am
Not sure if you can combine the "auto" method with defining stuff on your own, but if you can, this should work:

Code: Select all

layeredimage l:
    group pose auto:
        attribute u1 default
    group face auto
    group eyes:
    	attribute open_eyes default "blinking_eyes"
    	attribute closed_eyes "images/character/closed_eyes.png"
Basically: For the animated eyes, you add the name of the image you defined. For all other eyes (aka those that don't blink), you have to add the file path instead.
I ended up trying a few things and finally got it work this way:

Code: Select all

image l_face_os1:
    "lily/pose_1/l_face_os1.png"
    choice:
        8
    choice:
        10
    choice:
        4
    choice:
        .2
    "lily/pose_1/l_face_cs1.png"
    pause .5
    repeat
And left my layeredimage definitions as is. Basically the auto on face means that if I choose to display the 'open smile' (os1) on pose 1, it will instead inherit the above ATL block which switches the open eyes to the closed eyes version. I just will need to do this for the other relevant expressions and this way I don't need to add code within the chapters, just define it once