SMAnimation

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
monele
Lemma-Class Veteran
Posts: 4101
Joined: Sat Oct 08, 2005 7:57 am
Location: France
Contact:

SMAnimation

#1 Post by monele »

I had already used this successfully but I realize I might not have used its full power :). I'm trying to understand how position and movement work with this...

Code: Select all

style.mm_root_window.background = anim.SMAnimation("a",
        anim.State("a", "c_amy.png", left),
        anim.State("b", "c_katania_buste.png", Position(ypos=1.0, yanchor='top')),
        anim.Edge("a", 1.0, "b"),
        anim.Edge("b", 1.0, "a")
This just a test but I realize changing the position parameters doesn't do anything... sprites are always displayed at the top left of the screen.

My real goal is to have a single picture animated by a looping Move (scrolling space field on the main menu :P).
If it doesn't work, I'll settle with a slideshow of pictures with dissolves.

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: SMAnimation

#2 Post by PyTom »

monele wrote:I had already used this successfully but I realize I might not have used its full power :). I'm trying to understand how position and movement work with this...

Code: Select all

style.mm_root_window.background = anim.SMAnimation("a",
        anim.State("a", "c_amy.png", left),
        anim.State("b", "c_katania_buste.png", Position(ypos=1.0, yanchor='top')),
        anim.Edge("a", 1.0, "b"),
        anim.Edge("b", 1.0, "a")
This just a test but I realize changing the position parameters doesn't do anything... sprites are always displayed at the top left of the screen.
No, images should be displayed wherever the position parameter brings them. The following code:

Code: Select all

   image smanim2 = anim.SMAnimation(
        "a",
        anim.State("a", "cyan.png", left),
        anim.State("b", "cyan.png", Position(ypos=1.0, yanchor='top')),
        anim.Edge("a", 1.0, "b", move),
        anim.Edge("b", 1.0, "a", move),
        )
Slides an image between the lower-left of the screen, and off the bottom-center of the screen. (At least in the latest version of Ren'Py.)
Your code should do roughly the same... does it not?
My real goal is to have a single picture animated by a looping Move (scrolling space field on the main menu :P).
If it doesn't work, I'll settle with a slideshow of pictures with dissolves.
Why not just use Move or Pan?
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

monele
Lemma-Class Veteran
Posts: 4101
Joined: Sat Oct 08, 2005 7:57 am
Location: France
Contact:

#3 Post by monele »

Works if shown using "show". Doesn't work when assigned to style.mm_root.background :/

(I've switched to 5.5.2b yesterday btw)

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

#4 Post by PyTom »

Okay, I just fixed this in my codebase... even though I'm not convinced it actually was a bug. Basically, the background of a window didn't participate in movement or other layout activities.

Anyway, until the new version comes out, you can work around this using code like:

Code: Select all

$ style.mm_root_window.background = Fixed(anim.SMAnimation("a",
        anim.State("a", "c_amy.png", left),
        anim.State("b", "c_katania_buste.png", Position(ypos=1.0, yanchor='top')),
        anim.Edge("a", 1.0, "b"),
        anim.Edge("b", 1.0, "a")
        ))
The extra Fixed will take care of the layout for you.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

monele
Lemma-Class Veteran
Posts: 4101
Joined: Sat Oct 08, 2005 7:57 am
Location: France
Contact:

#5 Post by monele »

Probably not a bug no... I consider this a new feature ^.^. Big thanks for this :). Might let me have some longer intro while letting the use access the main menu at anytime ^.^

Post Reply

Who is online

Users browsing this forum: No registered users