Blinking character with full body image and close eye image

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
felisselita
Newbie
Posts: 16
Joined: Thu Jul 21, 2011 12:26 am
Completed: "Starstorm", a BL visual novel game
Tumblr: felisselita
Deviantart: felisselita
itch: felis-selita
Contact:

Blinking character with full body image and close eye image

#1 Post by felisselita » Tue Jul 16, 2013 4:51 am

Hello. This is my first time posting a question. I hope I'm doing this right, and I hope this hasn't been asked. If it is, please help me find the thread :)

My question is, how to show a blinking character but with a set of .png image that shows full body with eyes open and a .png image that only shows his/her closed eyes? Is it possible or not? I've tried using the code that the tutorial has, but the images wouldn't overlap (so it only shows full body - pause - closed eyes - pause - full body, not full body - fullbody+closedeyes - full body).

It might be difficult to imagine what I was talking about, so I attached two images, one of full body (eyes open) and one of only the eyes (closed).

What I'm trying to do is to make the character blink.

According to the tutorial the code would be:

init:
image leona:
"leona.png"
pause 4.0
"leona close.png"
pause 2.0
repeat

But the image won't overlap. Is it possible to overlap the images like in this way?

I'm sorry if this is a stupid question. I just thought that if I can do this, I can save a lot of space and make the game size smaller. :) Once again, I hope this hasn't been asked. If it is, please help me find the thread :)

Thank you very much :D
Attachments
Leona.png
Image of Leona's full body with opened eyes.
Leona close.png
Image of Leona's closed eyes.
Leona close.png (3.85 KiB) Viewed 2329 times

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Blinking character with full body image and close eye im

#2 Post by trooper6 » Tue Jul 16, 2013 8:41 am

I am no expert at this as I haven't done it yet myself, but here are three pages that seem to be relevant.

OokamiKasumi's LiveComposite Template
http://lemmasoft.renai.us/forums/viewto ... 51&t=21840

Lip Flap Cookbook
http://www.renpy.org/wiki/renpy/doc/cookbook/Lip_Flap

Blink and Lip Flap Cookbook
http://www.renpy.org/wiki/renpy/doc/coo ... d_Lip_Flap
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

User avatar
Greeny
Miko-Class Veteran
Posts: 921
Joined: Sun Dec 20, 2009 10:15 am
Completed: The Loop, The Madness
Projects: In Orbit, TBA
Organization: Gliese Productions
Location: Cantankerous Castle
Contact:

Re: Blinking character with full body image and close eye im

#3 Post by Greeny » Tue Jul 16, 2013 8:48 am

It's a lot easier than that.

Code: Select all

image leona:
    contains:
        "leona.png"
    contains:
        "leona close.png"
        block:
            alpha 0.0
            4.0
            linear 0.2 alpha 1.0
            1.0
            linear 0.2 alpha 0.0
            repeat
The above tutorials looks like they're from before ATL, so they're a bit outdated.
In Orbit [WIP] | Gliese is now doing weekly erratic VN reviews! The latest: Halloween Otome!
Gliese Productions | Facebook | Twitter
Image

User avatar
felisselita
Newbie
Posts: 16
Joined: Thu Jul 21, 2011 12:26 am
Completed: "Starstorm", a BL visual novel game
Tumblr: felisselita
Deviantart: felisselita
itch: felis-selita
Contact:

Re: Blinking character with full body image and close eye im

#4 Post by felisselita » Fri Jul 19, 2013 12:50 am

@ Trooper6: I've read those before, and I say it didn't really fit what I had in mind. So I asked it in this forum. Thank you anyway for helping :)

@ Greeny: Thank you very much! I tried it and it works. However, when I tried to show the image in a position, somehow it won't show in such position. I used Position(xpos=, xanchor=, ypos=, yanchor=). Is it outdated, too? Is there some reason those two won't work together? Thank you again, sorry if I asked too much ^^;
Image
Starstorm by felisselita, a BL visual novel with minigames! Get it here: https://felis-selita.itch.io/starstorm

User avatar
Greeny
Miko-Class Veteran
Posts: 921
Joined: Sun Dec 20, 2009 10:15 am
Completed: The Loop, The Madness
Projects: In Orbit, TBA
Organization: Gliese Productions
Location: Cantankerous Castle
Contact:

Re: Blinking character with full body image and close eye im

#5 Post by Greeny » Fri Jul 19, 2013 6:15 am

As it happens, I myself ran into this the other day.
I'm still trying to figure out an easier way to do it (or why it simply ignores position transforms), but for now the following works:

Code: Select all

image leona:
    contains:
        "leona.png"
        pos (0.5, 1.0)
        anchor (0.5, 1.0)
    contains:
        "leona close.png"
        pos (0.5, 1.0)
        anchor (0.5, 1.0)
        block:
            alpha 0.0
            4.0
            linear 0.2 alpha 1.0
            1.0
            linear 0.2 alpha 0.0
            repeat
When using pos (,) and anchor (,) remember that the first element is X, the second is Y.

EDIT:
I figured out a way to tackle the issue.

Code: Select all

image leona_blink:
    "leona close.png"
    block:
       alpha 0.0
        4.0
        linear 0.2 alpha 1.0
        1.0
        linear 0.2 alpha 0.0
        repeat

image leona:
    Fixed("leona.png", "leona_blink", fit_first=True)

...

show leona at center
In Orbit [WIP] | Gliese is now doing weekly erratic VN reviews! The latest: Halloween Otome!
Gliese Productions | Facebook | Twitter
Image

imazariuz
Newbie
Posts: 6
Joined: Sun Dec 27, 2020 3:19 pm
Contact:

Re: Blinking character with full body image and close eye image

#6 Post by imazariuz » Mon Dec 28, 2020 4:48 am

This thread saved my life. Thanks a lot to you all :D

User avatar
_ticlock_
Veteran
Posts: 393
Joined: Mon Oct 26, 2020 5:41 pm
Contact:

Re: Blinking character with full body image and close eye image

#7 Post by _ticlock_ » Mon Dec 28, 2020 12:42 pm

imazariuz wrote:
Mon Dec 28, 2020 4:48 am
This thread saved my life. Thanks a lot to you all :D
That is a pretty old topic. I struggled with a similar problem some time ago. I found two ways to solve it. Based on the previous posts (using leona blinking ATL):

The image with contains does NOT ignore position transforms. The reason why it is has no effect is because the size of an image (with contains) is full screen, thus align properties do not change anything. Using Fixed is not very convenient and it is hard to grasp the code later(at least for me).

Instead, you can specify the size of the image with size property.

Option 1

Code: Select all

image leona:
    contains:
        "leona.png"
    contains:
        "leona close.png"
        block:
            alpha 0.0
            4.0
            linear 0.2 alpha 1.0
            1.0
            linear 0.2 alpha 0.0
            repeat
    size (500,400)
Specifying the size of the image sometimes is not convenient as well. Alternatively, you can use Layered Images with transform. It can be useful if you would like to apply a similar effect to a bunch of images:

Option 2

Code: Select all

transform blink:
    alpha 0.0
    4.0
    linear 0.2 alpha 1.0
    1.0
    linear 0.2 alpha 0.0
    repeat

layeredimage leona:
    always:
        "leona.png"
    always:
        "leona close.png" at blink

imazariuz
Newbie
Posts: 6
Joined: Sun Dec 27, 2020 3:19 pm
Contact:

Re: Blinking character with full body image and close eye image

#8 Post by imazariuz » Thu Jan 07, 2021 9:33 am

I don't know how layeredimage works. But right now the anchor thingy code works just well

Post Reply

Who is online

Users browsing this forum: Google [Bot]