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.
-
Exiscoming
- Regular
- Posts: 127
- Joined: Tue Apr 29, 2014 5:37 pm
-
Contact:
#1
Post
by Exiscoming » Mon Dec 24, 2018 11:12 am
So I know it's possible to flip images horizontally with
Code: Select all
define bob= im.Flip("bob.png", horizontal=True)
However, is this also possible for screens?
For example:
Code: Select all
screen bob:
add "bob.png"
if bobHat == True:
add "bob_hat.png"
How would you flip the above screen I made for bob horizontally?
I've considered making it a layered image where it should be possible, but so far I find it much more convoluted and difficult to use.
-
Kia
- Eileen-Class Veteran
- Posts: 1011
- Joined: Fri Aug 01, 2014 7:49 am
- Deviantart: KiaAzad
- Discord: Kia#6810
-
Contact:
#2
Post
by Kia » Mon Dec 24, 2018 12:57 pm
try
Code: Select all
transform flip:
xzoom -1
screen flip_test:
frame:
at flip
add "gui/window_icon.png"
-
Exiscoming
- Regular
- Posts: 127
- Joined: Tue Apr 29, 2014 5:37 pm
-
Contact:
#3
Post
by Exiscoming » Mon Dec 24, 2018 1:27 pm
Kia wrote: ↑Mon Dec 24, 2018 12:57 pm
try
Code: Select all
transform flip:
xzoom -1
screen flip_test:
frame:
at flip
add "gui/window_icon.png"
Oh that's really interesting. I works, BUT, it doesn't maintain its transparency, causing a large white background to be added to the image.
Example:

-
trooper6
- Lemma-Class Veteran
- Posts: 3712
- Joined: Sat Jul 09, 2011 10:33 pm
- Projects: A Close Shave
- Location: Medford, MA
-
Contact:
#4
Post
by trooper6 » Mon Dec 24, 2018 1:41 pm
looking at what you are doing...where you want to layer images on top of each other...you should just use a layered image. That is what they are there for!
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe:
http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
-
Exiscoming
- Regular
- Posts: 127
- Joined: Tue Apr 29, 2014 5:37 pm
-
Contact:
#5
Post
by Exiscoming » Mon Dec 24, 2018 2:38 pm
trooper6 wrote: ↑Mon Dec 24, 2018 1:41 pm
looking at what you are doing...where you want to layer images on top of each other...you should just use a layered image. That is what they are there for!
Hi there trooper, yeah you're right, but it's something new and I'm still trying to figure out how it works exactly...
Maybe you'd be able to help me. For example:
Code: Select all
layeredimage character:
always:
"baseModel.png"
if activeCharacter == 1:
"outfit1.png"
if activeCharacter == 1:
"hair.png"
if activeCharacter == 1:
"face.png"
This seems so over the top. Is there a way for me to just make it into a single if statement?
I tried
Code: Select all
if activeCharacter == 1:
"outfit1.png"
"hair.png"
"face.png"
But that returns an error.
-
thebackup
- Veteran
- Posts: 317
- Joined: Fri Mar 27, 2009 7:36 pm
- Completed: Final Week, CardioQuiz, Cafe Memoria, All I Want for Christmas is a Girlfriend, Dating Sim! Re:Mastered
- Projects: Memoria (on hiatus), Cafe Memoria Deux
- Organization: PixaelSoft
- Location: Southern CA
-
Contact:
#6
Post
by thebackup » Mon Dec 24, 2018 3:23 pm
Exiscoming wrote: ↑Mon Dec 24, 2018 2:38 pm
This seems so over the top. Is there a way for me to just make it into a single if statement?
I tried
Code: Select all
if activeCharacter == 1:
"outfit1.png"
"hair.png"
"face.png"
But that returns an error.
What does the error message say?
-
Exiscoming
- Regular
- Posts: 127
- Joined: Tue Apr 29, 2014 5:37 pm
-
Contact:
#7
Post
by Exiscoming » Mon Dec 24, 2018 3:46 pm
thebackup wrote: ↑Mon Dec 24, 2018 3:23 pm
What does the error message say?
"A condition can only have one displayable, two found."
-
thebackup
- Veteran
- Posts: 317
- Joined: Fri Mar 27, 2009 7:36 pm
- Completed: Final Week, CardioQuiz, Cafe Memoria, All I Want for Christmas is a Girlfriend, Dating Sim! Re:Mastered
- Projects: Memoria (on hiatus), Cafe Memoria Deux
- Organization: PixaelSoft
- Location: Southern CA
-
Contact:
#8
Post
by thebackup » Mon Dec 24, 2018 7:11 pm
Try this:
Rename your base, outfit, hair and face files to something like for example (will allow for automatic image attributes):
chara_base.png
chara_outfit_casual.png <- replace "casual" with the name of outfit
chara_hair_normal.png <- replace "normal" with name of hairstyle
chara_face_neutral.png <- ditto
Then write your code to something like this:
Code: Select all
layeredimage chara:
always "chara_base" # don't add extension
group outfit auto # auto define any outfits you have, in this example it will find "chara_outfit_casual"
group hair auto # auto define any hairstyles you have
group face auto # ditto
That's probably as simple as it gets (the "if" statement seemingly doesn't allow more than 1 displayable). I hope that meets your needs!
-
Exiscoming
- Regular
- Posts: 127
- Joined: Tue Apr 29, 2014 5:37 pm
-
Contact:
#9
Post
by Exiscoming » Mon Dec 24, 2018 8:18 pm
thebackup wrote: ↑Mon Dec 24, 2018 7:11 pm
Try this:
Rename your base, outfit, hair and face files to something like for example (will allow for automatic image attributes):
chara_base.png
chara_outfit_casual.png <- replace "casual" with the name of outfit
chara_hair_normal.png <- replace "normal" with name of hairstyle
chara_face_neutral.png <- ditto
Then write your code to something like this:
Code: Select all
layeredimage chara:
always "chara_base" # don't add extension
group outfit auto # auto define any outfits you have, in this example it will find "chara_outfit_casual"
group hair auto # auto define any hairstyles you have
group face auto # ditto
That's probably as simple as it gets (the "if" statement seemingly doesn't allow more than 1 displayable). I hope that meets your needs!
Thank you thebackup,
It ended up being too difficult to make work, so I've just added mirrored pngs (shame on me I know), but I'll try again tomorrow!
Merry Christmas and thank you all for your help!
-
trooper6
- Lemma-Class Veteran
- Posts: 3712
- Joined: Sat Jul 09, 2011 10:33 pm
- Projects: A Close Shave
- Location: Medford, MA
-
Contact:
#10
Post
by trooper6 » Mon Dec 24, 2018 10:43 pm
Exiscoming wrote: ↑Mon Dec 24, 2018 2:38 pm
trooper6 wrote: ↑Mon Dec 24, 2018 1:41 pm
looking at what you are doing...where you want to layer images on top of each other...you should just use a layered image. That is what they are there for!
Hi there trooper, yeah you're right, but it's something new and I'm still trying to figure out how it works exactly...
Maybe you'd be able to help me. For example:
Code: Select all
layeredimage character:
always:
"baseModel.png"
if activeCharacter == 1:
"outfit1.png"
if activeCharacter == 1:
"hair.png"
if activeCharacter == 1:
"face.png"
This seems so over the top. Is there a way for me to just make it into a single if statement?
I tried
Code: Select all
if activeCharacter == 1:
"outfit1.png"
"hair.png"
"face.png"
But that returns an error.
For me to help, I need to understand a bit more about how your images are put together.
You have a character that has a base model.
If activeCharacter is 1, then she has outfit #1, and she has hair and and a face. What happens if active character isn't 1? Then the character has no face and no hair? She has not outfit? I thought the only difference you were dealing with was if the character had a baseball cap on or not.
What are the layers you plan on having? What variations are you dealing with?
Can you explain your image layers a bit more?
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe:
http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
-
Exiscoming
- Regular
- Posts: 127
- Joined: Tue Apr 29, 2014 5:37 pm
-
Contact:
#11
Post
by Exiscoming » Tue Dec 25, 2018 4:52 pm
Hey there trooper6, sorry for the late reply.
Okay, so it's actually part of a much larger thing I'm putting together.
I'm hoping to create a dungeon crawler that the player can move through.
First I need a random background.
Then the random background will figure out what props will be located in the room.
Then your character is loaded. You can play 1 of 3 characters, all with the same base body.
You navigate through the room by clicking on cover, for which I'm using imagebuttons (click on the crate and your character jumps there.)
So far it's going relatively well, but I am struggling with some things. For example, for a character to move from point A to point B, I'd like an animation to play.
However, animations are done as an image, and thus show up 'underneath' the screens (I'm unaware of any ways to have movies play on top of screens).
I didn't want to use layered images because you can't have more than one image per if statement. It's complicated and I know I'm in way over my head, but I feel like I should push myself to get this to work somehow.
-
philat
- Eileen-Class Veteran
- Posts: 1853
- Joined: Wed Dec 04, 2013 12:33 pm
-
Contact:
#12
Post
by philat » Tue Dec 25, 2018 9:47 pm
The entire point of layered images is NOT using conditionals. You're supposed to name the files with the relevant attributes and use the attributes (not conditions) to control the image. That said, it's perfectly fine to simply use ConditionSwitches or other methods if that is easier for you to understand/implement.
The actual answer to your question is simply xzoom -1 (as demonstrated above). The white in the image you added is probably just the frame background, not the image -- xzoom -1 does not inherently change the image in any way other than flipping it. You can also apply xzoom -1 to any individual element rather than the container (i.e., you could simply write add "bob_hat.png" at flip).
Users browsing this forum: Bing [Bot]