[Solved] How to modify layered images off screen?

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
healermain
Newbie
Posts: 4
Joined: Mon Aug 03, 2020 10:12 am
Contact:

[Solved] How to modify layered images off screen?

#1 Post by healermain » Wed Mar 03, 2021 1:18 am

I'm using LayeredImageProxy() as my side image for characters which works great when they're actually on screen. However I have some examples when a sprite won't actually be in the scene but is still talking to the MC (like behind a wall or something). In these cases, the LayeredImageProxy() does build the image but because I didn't define any show statements for outfits, he's naked :-\

I'm not sure on exactly what's happening in the background to make LayeredImageProxy() work but was hoping I could solve this in a couple ways, I'm just not sure what's possible:
  1. Use a show statement to define the layered image but with a transparency command so they don't appear on screen but Layered Image ignores the transparency command
  2. Define a new layer that is 'hidden' and show the layered image on that layer instead
  3. Directly define what the side image should be using in these instances with different code
For reference, here's the code I'm using to define the side image currently:

Code: Select all

image side bear = LayeredImageProxy("bear",Transform(crop=(0,0,750,650), zoom=0.7, xoffset=-30, xzoom=-1.0))

define r = Character("Bear Name", color = "#057ef0", image="bear")
Last edited by healermain on Thu Mar 04, 2021 5:00 pm, edited 1 time in total.

cheonbyeol
Regular
Posts: 37
Joined: Thu Feb 04, 2021 9:04 am
Contact:

Re: How to modify layered images off screen?

#2 Post by cheonbyeol » Wed Mar 03, 2021 4:18 am

From what I understand, LayeredImageProxy() shares all its attributes with the original layeredimage, back and forth-- if you have the full sprite and the side image on at once, and you change expression, both should change.
So you can pass attributes to the image in the say statement:

Code: Select all

## in dialogue
r shirt smile "I should be wearing my shirt outfit now and smiling."
By the way, you can make your life easier by making the most common (or only) outfit attribute default, and you don't have to specify it everytime, only when you want another one.

Since you asked about "off screen" changing a layaredimage, there is also a built-in function renpy.set_tag_attributes() for setting side image attributes. But I usually use this one when I have mc's image as constant side image and want to change their expression without them saying anything. I suggest the other two options for your case!

healermain
Newbie
Posts: 4
Joined: Mon Aug 03, 2020 10:12 am
Contact:

Re: How to modify layered images off screen?

#3 Post by healermain » Thu Mar 04, 2021 4:59 pm

Weee thank you Cheonbyeol! The set_tag_attributes() fucntion works perfectly :)

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]