[SOLVED] Best practices of animation images that are already displayed

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
tanakeiQ
Newbie
Posts: 5
Joined: Mon May 21, 2018 9:33 am
Github: tanakeiQ
Location: Japan
Contact:

[SOLVED] Best practices of animation images that are already displayed

#1 Post by tanakeiQ » Mon May 21, 2018 10:23 am

Hi All.

I'm tried zoom character that is already displayed.

Code: Select all

    show sakuya maid default at center as sakuya_center:
    with dissolve
    
    pause
    
    show sakuya maid default at center as sakuya_center:
        linear 1.0 zoom 0.5
Its works, but very redundant.

For example, I want to write like this.

Code: Select all

    show sakuya maid default at center as sakuya_center:
    with dissolve
    
    pause
    
    sakuya_center:
        linear 1.0 zoom 0.5
Is there any simple way of writing like this?
Last edited by tanakeiQ on Wed May 23, 2018 12:41 pm, edited 2 times in total.

kivik
Miko-Class Veteran
Posts: 784
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Best practices of animation images that are already displayed

#2 Post by kivik » Mon May 21, 2018 10:41 am

You need to create a transform with linear 1.0 zoom 0.5, and apply it.

Code: Select all

transform zoom_out:
    linear 1.0 zoom 0.5

...

    show sakuya maid default at center as sakuya_center with dissolve
    pause
    show sakuya maid default at zoom_out
Any particular reason you're renaming sakuya to sakuya_center? Unless you're showing sakuya again somewhere else on your screen, you could have shorten it:

Code: Select all

    show sakuya maid default at center with dissolve
    pause
    show sakuya at zoom_out

User avatar
tanakeiQ
Newbie
Posts: 5
Joined: Mon May 21, 2018 9:33 am
Github: tanakeiQ
Location: Japan
Contact:

Re: Best practices of animation images that are already displayed

#3 Post by tanakeiQ » Tue May 22, 2018 8:06 am

thanks kivik!
Any particular reason you're renaming sakuya to sakuya_center?
I want to display the same character with the setting called Doppelganger.

Actually it will be as follows.

Code: Select all

transform zoom_out:
    linear 1.0 zoom 0.5
    
    ...
    
    show sakuya maid default at right as sakuya_right with dissolve
    
    pause    
    
    show sakuya maid default at center as sakuya_center with dissolve
    
    pause
    
    # appy `zoom_out` to sakuya_center

kivik
Miko-Class Veteran
Posts: 784
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Best practices of animation images that are already displayed

#4 Post by kivik » Tue May 22, 2018 9:41 am

How often are you going to do this?

If it's just for a brief part of the game, just don't bother re-naming the image you want to transform:

Code: Select all

    show sakuya maid default at right as sakuya_right with dissolve
    pause    
    show sakuya maid default at center with dissolve
    pause
    show sakuya at zoom_out
From what I understand, giving your image a different image tag doesn't create a handle on it, so you can't directly manipulate it by that name besides hiding it. The only other thing I can see you can do is to do with other images in relation to said image tag (show something else behind image_tag)

When you try to manipulate sakuya_center - it assumes that there's an image declared call sakuya_center, and when it's not found shows the default grey missing portrait image.


If you want to use the doppelganger lots of times, it's probably better to define a separate set of images with a different image tag:

Code: Select all

sakuya2 = "sakuya.png"
sakuya2 happy = "sakuya_happy.png"
etc
Then you can actually reference sakuya2 with the transforms and not waste time renaming the image tag each time you show the image.

User avatar
tanakeiQ
Newbie
Posts: 5
Joined: Mon May 21, 2018 9:33 am
Github: tanakeiQ
Location: Japan
Contact:

Re: Best practices of animation images that are already displayed

#5 Post by tanakeiQ » Wed May 23, 2018 3:55 am

thanks! understood.
From what I understand, giving your image a different image tag doesn't create a handle on it, so you can't directly manipulate it by that name besides hiding it.
I see.
I'd like you to be able to specify animation for aliases in future updates...

Code: Select all

sakuya2 = "sakuya.png"
sakuya2 happy = "sakuya_happy.png"
etc
it's good. I try it.

kivik
Miko-Class Veteran
Posts: 784
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Best practices of animation images that are already displayed [RESOLVED]

#6 Post by kivik » Wed May 23, 2018 7:06 am

Btw, I just saw this in the documentation:

https://www.renpy.org/doc/html/displayi ... opy_images

This can save you time duplicating all the images. Just make sure you run it at a later init than your sakuya image declarations.

User avatar
tanakeiQ
Newbie
Posts: 5
Joined: Mon May 21, 2018 9:33 am
Github: tanakeiQ
Location: Japan
Contact:

Re: Best practices of animation images that are already displayed [RESOLVED]

#7 Post by tanakeiQ » Wed May 23, 2018 12:39 pm

Its nice.

Code: Select all

image sakuya = "sakuya maid default.png"
    ...
    
    "Show sakuya"

    show sakuya at center with dissolve:
        zoom 0.5 yoffset 150


    "Copy"

    $ renpy.copy_images(old="sakuya", new="copy1")

    "Show copy"

    show copy1 at right  with dissolve:
        zoom 0.5 yoffset 150

    "Apply to sakura only"

    show sakuya:
        easeout 0.5 xoffset -100

    "Apply to copy only"

    show copy1:
        easeout 0.5 xoffset -100
It became a code that is easy to understand personally.

Thank you.

kivik
Miko-Class Veteran
Posts: 784
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: [SOLVED] Best practices of animation images that are already displayed

#8 Post by kivik » Wed May 23, 2018 1:01 pm

Probably want to use a different name than copy1 though :P But glad that's working for you!

P.S. remember to use transforms to create more shorthands instead of doing zoom 0.5 yoffset 150 and easeout 0.5 xoffset -100 each time.

User avatar
tanakeiQ
Newbie
Posts: 5
Joined: Mon May 21, 2018 9:33 am
Github: tanakeiQ
Location: Japan
Contact:

Re: [SOLVED] Best practices of animation images that are already displayed

#9 Post by tanakeiQ » Wed May 23, 2018 1:41 pm

Or the following code is also good.

Code: Select all

    "Show sakuya"

    show sakuya maid default at center as original with dissolve:
        zoom 0.5 yoffset 150


    "Show copy"

    show sakuya maid default at right as copy with dissolve:
        zoom 0.5 yoffset 150

    "Apply to sakura"

    show sakuya as original:
        easeout 0.5 xoffset -100

    "Apply to copy"

    show sakuya as copy:
        easeout 0.5 xoffset -100

    "Change to copy's face"

    show sakuya maid cry as copy with dissolve
With the previous code(viewtopic.php?p=487422#p487422), need to redefine to change face.
P.S. remember to use transforms to create more shorthands instead of doing zoom 0.5 yoffset 150 and easeout 0.5 xoffset -100 each time.
Okay. Thanks kivik!

NOTE:

Code: Select all

transform zoom_out:
    linear 1.0 zoom 0.5
transform move_left:
    easeout 0.5 xoffset -100

Post Reply

Who is online

Users browsing this forum: DragoonHP