How to flip images?

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
Mammon
Miko-Class Veteran
Posts: 712
Joined: Sat Nov 07, 2015 3:09 pm
Completed: Pervert&Yandere, Stalker&Yandere
Projects: Roses Of The Thorn Prince
Contact:

How to flip images?

#1 Post by Mammon »

Hi,

Is there a way to flip images in Ren'py other than the im.Flip method? Preferably one that doesn't require you to define each sprite this way rather than putting something behind the sprite appearing similar to 'at right' or 'with dissolve'. Im.Flip doesn't work for me to begin with because it says I've got 10 variables (while I only have 4), and having to make a flipped image of most or even all combinations of a sprite would be hellish. Even if I wouldn't do it for the main characters, the side characters can easily have 150-200 expression combinations that would require a im.flip on top of their im.composite.

Thanks for your help in advance!
ImageImageImage

Want some CC sprites?

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: How to flip images?

#2 Post by Remix »

xzoom = -1

Inline use would be something like:

Code: Select all

    show expression Transform("eileen_composite", xzoom=-1)
You could, if needed, set the xzoom value as a variable and toggle it between 1 (normal) and -1 (flipped)
Frameworks & Scriptlets:

User avatar
Mammon
Miko-Class Veteran
Posts: 712
Joined: Sat Nov 07, 2015 3:09 pm
Completed: Pervert&Yandere, Stalker&Yandere
Projects: Roses Of The Thorn Prince
Contact:

Re: How to flip images?

#3 Post by Mammon »

Remix wrote: Tue Jun 18, 2019 6:43 am xzoom = -1
Thanks for the fast reply and advice! Much appreciated!

Unfortunately... It refuses to work. When I put it exactly as you say with capitalised T it does nothing at all. When I make it a t ren'py demands an end of the line right before transform. If I add transform etc. in another line they expect an end of the line after transform before (. When I add just xzoom=-1 it says the same about between zoom and =.

I know variables, but I wouldn't know how to combine it with xzoom. At least, not without setting $ xflip = 1 or -1 followed by "image x expression = im.flip(images/etc...) and then having to define each expression after all. And I've tried adding variables to images before for outfits but that didn't work in general (when these contain more than 5 .pngs to combine, causing a too many variables issue).

Might it be a version thing that this works with an older version? I've already experienced that the latest renpy versions no longer allow certain things like zorder, might this be similarly a version issue? I've updated to the latest version for this advise and found it being the same issues as above, except that Transform now made the sprite disappear entirely where before it remained unchanged.

(Isn't it nice, ren'py telling you it wanted to start at the point you were before the update, telling it cannot go there because there's no rollback for it, and then suddenly adding all the languages in your project folder? Updates...)
ImageImageImage

Want some CC sprites?

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: How to flip images?

#4 Post by Remix »

What exact code are you trying? Anything like?

Code: Select all

image composite_image = Composite(
    (300,200),
    (0, 0), Text("Words", size=40, color="#F00"),
    (0, 50), Text("Words", size=40, color="#FFF"),
    (0, 100), Text("Words", size=40, color="#00F"),
    (0, 150), Text("Words", size=40, color="#777") )

label start:

    show expression Transform("composite_image", xzoom = -1)

    "..."
Frameworks & Scriptlets:

mikolajspy
Regular
Posts: 169
Joined: Sun Jun 04, 2017 12:05 pm
Completed: Too many, check signature
Deviantart: mikolajspy
Location: Wrocław, Poland
Contact:

Re: How to flip images?

#5 Post by mikolajspy »

You can define negative xzoom as your own transform and use that. It works without issues in my project.

Somewhere outside labels:

Code: Select all

transform flip:
    xzoom -1
and when you want to show flipped image, just...

Code: Select all

show mycharacter at flip

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: How to flip images?

#6 Post by Remix »

Oh yeah, that's easier. Could also just do:

Code: Select all

show my_composite_image:
    xzoom -1
for the occasional one.
Frameworks & Scriptlets:

User avatar
Mammon
Miko-Class Veteran
Posts: 712
Joined: Sat Nov 07, 2015 3:09 pm
Completed: Pervert&Yandere, Stalker&Yandere
Projects: Roses Of The Thorn Prince
Contact:

Re: How to flip images?

#7 Post by Mammon »

@remix: Jup, something alike your first reaction though without size and color, and using Transform at all didn't seem to work. And similarly to before ren'py doesn't allow show <name>: enter xzoom=-1.

@mikolajspy: Oh, that one works, even when combining it with other at commands. Thanks a lot!
ImageImageImage

Want some CC sprites?

User avatar
xavimat
Eileen-Class Veteran
Posts: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

Re: How to flip images?

#8 Post by xavimat »

For the very, very fussy:
Note that flipping the image of a person that has clothes with buttons on it will change the normal orientation of the buttons. (or has a scar,a tattoo, or a single earring, or any non-symmetrical feature).
I'd never thought about it until an artist pointed it out in this forums some time ago.
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

Post Reply

Who is online

Users browsing this forum: Google [Bot]