How to make custom transform: small animation (SOLVED)

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
Geckos
Veteran
Posts: 471
Joined: Fri Aug 17, 2012 8:33 am
Completed: Brilliant Shadows, Perceptions of the Dead, The Phantom Icecream Truck
Projects: Embers of Magic, Pale Spectrum, Perceptions of the Dead
Organization: Ithaqua Labs
Tumblr: geckosart
Deviantart: sitaart
Contact:

How to make custom transform: small animation (SOLVED)

#1 Post by Geckos »

For my sprite I use this code

Code: Select all

image nshim = LiveComposite(
        (384, 864),
        (0, 0), "char/sn/new/ner_1.png",
        (0, 0), "char/sn/new/ner_1_hair.png",
        (0, 0), Animation("char/es/blink/es_blink0.png", 3, "char/sn/new/ner_1_hair2.png", .1, "char/sn/new/ner_1_hair3.png", .1, "char/sn/new/ner_1_hair4.png",),)
Which is the body of the sprite(ner_1.png), the hair of the sprite(ner_1_hair.png) and then an animation that plays on the hair (A shimmer.) Ideally I only want the hair shimmer animation to play when I change her from sprite pose 1 to sprite pose 2, or back.
Is there a way to either stop the Animation (hair shimmer) part from playing repeatedly, or to create a transform that only plays once?

I can just tell the animation to sit on its blank/transparent frame for a long period of time like 20 minutes which would help with not having the animation play unless I switch to a different sprite pose, but then the animation is just going to be running in the background when it doesn't need to be.

Alternately, another more jurryrigged approach is to simply make a separate LiveComposite which is only the hair shimmer and set it up to go:
show nshim
show nshim_hairshimmer
with dissolve
pause .5
hide nshim_hairshimmer

But that also seems overly complicated.

Any thoughts? Let me know if I'm not making any sense.
Last edited by Geckos on Sun Feb 16, 2014 4:54 am, edited 1 time in total.
Image ImageImage

bg_nocturnal
Regular
Posts: 25
Joined: Thu Feb 13, 2014 9:45 am
Contact:

Re: How to make custom transform: small animation

#2 Post by bg_nocturnal »

Try this:

Code: Select all

image nshim = LiveComposite(
        (384, 864),
        (0, 0), "char/sn/new/ner_1.png",
        (0, 0), "char/sn/new/ner_1_hair.png",
        (0, 0), Animation("char/es/blink/es_blink0.png", 3, "char/sn/new/ner_1_hair2.png", .1, "char/sn/new/ner_1_hair3.png", .1, "char/sn/new/ner_1_hair4.png"),)
It's exactly the same as your code, I've just removed a single comma near the end. I don't think you need the one between the two closing brackets, too.

My reasoning was that according to the Animation() page on the wiki "If the number of arguments is odd, the animation will stop with the last image". You have exactly seven, but maybe that last comma made it think that you've got eight?

If that doesn't work, replace the above with this:

Code: Select all

image nshim = LiveComposite(
        (384, 864),
        (0, 0), "char/sn/new/ner_1.png",
        (0, 0), "char/sn/new/ner_1_hair.png",
        (0, 0), "hair_shimmer")

image hair_shimmer:
    "char/es/blink/es_blink0.png"
    3.0
    "char/sn/new/ner_1_hair2.png"
    .1
    "char/sn/new/ner_1_hair3.png"
    .1
    "char/sn/new/ner_1_hair4.png"
It should do exactly the same thing, but using an image statement with an ATL block instead of Animation().
Read up on ATL here, I believe it's the newer and more flexible way to do things like these.

This should go through the animation once every time you show "nshim" and then stay on "hair4.png", by the way. I don't know if that's what you want. You might need to hide "hair4.png" by adding the following code at the end, so you're only left with "char/sn/new/ner_1_hair.png" visible:

Code: Select all

    .1
    alpha 0.0

User avatar
Geckos
Veteran
Posts: 471
Joined: Fri Aug 17, 2012 8:33 am
Completed: Brilliant Shadows, Perceptions of the Dead, The Phantom Icecream Truck
Projects: Embers of Magic, Pale Spectrum, Perceptions of the Dead
Organization: Ithaqua Labs
Tumblr: geckosart
Deviantart: sitaart
Contact:

Re: How to make custom transform: small animation

#3 Post by Geckos »

It's exactly the same as your code, I've just removed a single comma near the end. I don't think you need the one between the two closing brackets, too.

My reasoning was that according to the Animation() page on the wiki "If the number of arguments is odd, the animation will stop with the last image". You have exactly seven, but maybe that last comma made it think that you've got eight?
That is super interesting. It does sit on the last image in the animation without looping without that comma. Thanks so much for taking the time to help me out! I will likely experiment with all methods just for learning purposes.
Image ImageImage

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Alex, Sirifys-Al