SMAnimations and Show Side Image issue

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
(Guest) Phylon

SMAnimations and Show Side Image issue

#1 Post by (Guest) Phylon »

Hey Everyone,

I am a long time reader, first time poster here (yay my first game related post!). I have been working on some game display tests for a while now and I have run into a problem that I cant figure out. I am trying to make an animated Character Image appear beside the text box. (Thank You very much for adding in the show_side_image function!). I have made a blinking animation for this image as an animation, which works but dosen't feel random enough. I have been trying out SMAnimation and here is the the problem that I am running into. When I add the SMAnimation to the side_image, the image appears in the top right of the screen and not in the position of the side image.
Here is the code I am using to do this.

Code: Select all

    $ eside = Character('Eileen',
                        color="#c8ffc8", what_slow_cps=20,
                        ctc=anim.Filmstrip("sakura.png", (20, 20), (2, 1), .30, xpos=760, ypos=560, xanchor=0, yanchor=0),
                        ctc_position="fixed",
                        window_left_padding=160,
                        #show_side_image=Animation("eileen_h_side_1.png", 1.0, "eileen_h_side_2.png", 0.1, xalign=0.0, yalign=1.0))
                        show_side_image=anim.SMAnimation("open", anim.State("open", "eileen_h_side_1.png"), anim.State("close", "eileen_h_side_2.png"), anim.Edge("open", 1.0, "open", prob=4), anim.Edge("open", 0.25, "close"), anim.Edge("close", 0.25, "open"), xalign=0.0, yalign=1.0))
Can someone please let me know what I am doing wrong with this? or if this is an engine limitation that I am running into?

Thanks

Phylon

P.S. Thank you So much for your Ren'py work PyTom, I have been looking for this type of editors for Years! you have made one Professional Game Developer very happy!

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

#2 Post by monele »

the wiki wrote:The displayable should set its position properties in a way to place it where the user wants it.
So I suppose your Animation lacks xpos and ypos properties (just as you gave it xalign/yalign). (I'm not sure Animation supports these properties, but I'll suppose it does ^^)

Phylon
Newbie
Posts: 5
Joined: Thu Feb 16, 2006 6:48 pm
Location: California
Contact:

Xpos + Ypos

#3 Post by Phylon »

I tried to add this into the script along with the x/yalign as well but it did not alter the position of the SMAnimation, it still remained in the top right corner.

EDIT: sorry I should correct myself in both the OP and this response, The SMAnimation appeared in the Top Left corner of the window, not the top right

User avatar
DaFool
Lemma-Class Veteran
Posts: 4171
Joined: Tue Aug 01, 2006 12:39 pm
Contact:

#4 Post by DaFool »

I am curious to the solution to this.

One workaround (which doesn't really consume much more resources and doesn't really slow down the system much) is to just expand the character sprite so it has the full vertical width (i.e. 600 pixels), mostly filled with transparency on top. I usually just expand the canvas size whenever I couldn't be bothered to figure out exact positioning with animations.

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:

#5 Post by PyTom »

SMAnimation is weird, because the placement in the SMAnimation doesn't work. Instead, it takes the placement of the images you're showing. So you have to write something like:

Code: Select all


    $ eside = Character('Eileen',
                        show_side_image=anim.SMAnimation(
    "open", 
    anim.State("open", Image("eileen_h_side_1.png", xalign=0.0, yalign=1.0)), 
    anim.State("close", Image("eileen_h_side_2.png", xalign=0.0, yalign=1.0)), 

    anim.Edge("open", 1.0, "open", prob=4), 
    anim.Edge("open", 0.25, "close"), 
    anim.Edge("close", 0.25, "open")
    )) 
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

Phylon
Newbie
Posts: 5
Joined: Thu Feb 16, 2006 6:48 pm
Location: California
Contact:

it works

#6 Post by Phylon »

I adjusted the script and that worked beautifully. Thanks again PyTom.

Currently, for each character, it looks like I would have to make a seperate 'eside' setup per emotion type. Would this same idea of the animated picture at the side work if I was using a LiveComposite to do speech and expressions to save space?

NOTE: if anyone finds these script tests useful, please feel free to copy them.

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:

#7 Post by PyTom »

I'm not sure what you're asking here. You can use LiveComposite for a number of things, including with show_side_image.
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

Phylon
Newbie
Posts: 5
Joined: Thu Feb 16, 2006 6:48 pm
Location: California
Contact:

LiveComposite

#8 Post by Phylon »

I am trying to figure out a way to do the same effect as the above script, but with multiple characters with multiple emotions withough making a large number of scripts. (i.e. talking while "happy" vs talking while "sad" etc) The thought was to split the facial features off of the face. 1 layer for the head, 1 for the eyes, and 1 for the mouth. then using the LiveComposite function in conjunction with the show_side_image to combine the elements back and make a character that animates in many emotions .

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

#9 Post by monele »

Not sure if I got it right but hm... I'd suggest storing SMAnimations in variables during the init block... then use them as the show_side_image parameter. And to avoid repeating values for each face, use the copy() function and only change the show_side_image.

Non-tested example :

Code: Select all

init:
    $ happyface = anim.SMAnimation("open",
    anim.State("open", Image("eileen_h_side_1.png", xalign=0.0, yalign=1.0)),
    anim.State("close", Image("eileen_h_side_2.png", xalign=0.0, yalign=1.0)),

    anim.Edge("open", 1.0, "open", prob=4),
    anim.Edge("open", 0.25, "close"),
    anim.Edge("close", 0.25, "open")
    )

    $ sadface = anim.SMAnimations(....) # same kind of stuff

    $ eside = Character('Eileen', show_side_image=happyface)
    $ esidesad = eside.copy(show_side_image=sadface)

Glazed Donuts
Regular
Posts: 121
Joined: Thu Aug 12, 2010 11:47 am
Contact:

Re: SMAnimations and Show Side Image issue

#10 Post by Glazed Donuts »

I was playing around with Ren'Py this weekend and I checked out this code. Is it possible to make it so that the eyes will blink like the above code has, but once the character's dialog is finished being completely displayed in the textbox, then the animation will stop until the user presses the mouse/advance button?

Jake
Support Hero
Posts: 3826
Joined: Sat Jun 17, 2006 7:28 pm
Contact:

Re: SMAnimations and Show Side Image issue

#11 Post by Jake »

Glazed Donuts wrote:I was playing around with Ren'Py this weekend and I checked out this code. Is it possible to make it so that the eyes will blink like the above code has, but once the character's dialog is finished being completely displayed in the textbox, then the animation will stop until the user presses the mouse/advance button?
You should probably check out the Lip Flap and Blink and Lip Flap recipes in the cookbook, which do more or less what you're asking.

The Blink and Lip Flap is a nicer example, IMO, since it uses a character callback to time the show/no-show of the lip-flap. Left to my own devices I'd probably have done something pretty similar - set up a variable to hold True/False depending on whether a particular character is speaking, set that variable using the character callback with events of 'show' and 'show_done', or maybe 'begin' and 'slow_done', and then use a ConditionSwitch displayable to show my character in one state or another depending on the value of that variable.
Server error: user 'Jake' not found

Post Reply

Who is online

Users browsing this forum: Dark12ose