Ren'Py Flipping a character

astare

Newbie
Aug 15, 2020
17
116
In ren'py I used xzoom -1 to flip the image. It works OK but now I have encounterd a problem. When using the following code:

show alice at left with Dissolve
alice "says sth"
show alice at left with Dissolve:
xzoom -1

the image does not appear flipped.

What am I doing wrong?
 

osanaiko

Engaged Member
Modder
Jul 4, 2017
2,297
3,960
The "at" part of "at left" is the "apply transform operator". Transforms are bits of renpy code that can modify displayables. And then on the resulting displayable a "with" will apply a "transition".

To get your "alice" displayable flipped AND on the left, you need to first define a "flipped" transform outside of the label scope, and then combine the two transforms on your show statement.

Code:
# define the transform
transform flipped:
    xzoom -1

label start:
    scene bg washington
    window show
    show eileen vhappy

    # this is using the built-in transition "dissolve"
    e "Hi! My name is Eileen, and I'd like to welcome you to the Ren'Py tutorial."
    show eileen happy with dissolve

    # this is a built in transform "left",  and uses the "Dissolve(time)" class for a user-defined transition time
    e " now i'm gonna go left"
    show eileen happy at left with Dissolve(1.0)

    # note that this transform does not reset the previous position transform, just applies the additional xzoom
    e " now i'm gonna flip"
    show eileen happy at flipped with Dissolve(2.0)

    # you can then combine multiple transforms with commas after the "at"
    e " now i'm gonna go right flipped"
    show eileen happy at right, flipped with Dissolve(3.0)
Also, the way you used "with Dissolve" is not correct. "dissolve" (small d) is the built-in transition that has a 0.5 second effect time. If you use "Dissolve" it is calling the underlying class and that requires the parentheses and the required "time" parameter to make it a proper function call.

Links to renpy doco:
  • Transforms
  • pre-defined "dissolve"
  • Dissolve class
 
Last edited: