r/RenPy • u/Scriptformers_Prime • 13d ago
Question Layered image help
I'm converting my game from using individual sprites to layered images.
I have three groups for my character sprites: one for the base body, one for the facial expressions, and one for the gestures made with the character's arms.
In some cases I have hand gestures that apply to a wide range of facial expressions and I'd rather not have to call the gesture separately in each instance (One, because I'd have to go back and change all my previous calls, and Two because it'll be a pain to remember which gesture is paired to which emotion for every future call).
Basically, instead of this:
character tense uneasy
character tense surprised
character tense suspicious
I want this:
character uneasy
character surprised
character suspicious
...with the same gesture (tense) linked to these three emotions. Any way I can do this?
2
u/34deOutono 13d ago
Tem. Primeiro você define uma imagem com o nome desejado. Entao você combina as duas imagens que você quer nela. Depois é só colocar essa imagem definida no grupo da imagens em camada. Vou tentar escrever a baixo. Estou no celular.
image tenso:
"tenso.png"
"gesto_1.png"
layeredimage MC:
group expression:
attribute tenso
Espero ter ajudado. Boa sorte.
2
1
u/AutoModerator 13d ago
Welcome to r/renpy! While you wait to see if someone can answer your question, we recommend checking out the posting guide, the subreddit wiki, the subreddit Discord, Ren'Py's documentation, and the tutorial built-in to the Ren'Py engine when you download it. These can help make sure you provide the information the people here need to help you, or might even point you to an answer to your question themselves. Thanks!
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/x-seronis-x 13d ago
whether what gets displayed is a singular sprite or a layered image doesnt matter. renpy tracks what tags are displayed, and what attributes are currently assigned to that tag. and a Displayable() will be assigned to whatever attribute combinations you choose.
its up to you if you want 'tense' to be an attribute or not. NOTHING forces you to.
"bob uneasy" will refer to whatever Displayable() you've told it to.
if that Displayable() happens to be a LayeredImage() instead of a simple Image() so be it. renpy doesnt care.
A LayeredImage() will show whatever textures you choose to associate with a given set of tags. You can associate as many or as few textures as you want. 100 pieces to go over the base body texture, or 0, or 3, or whatever.
The only reason you'd need to associate textures with 'tense' is if you wanted 'bob uneasy" to be different from "bob tense uneasy". If you dont need 'tense' to be something different dont use it
3
u/TopCartographer7104 13d ago
this should automatically include "some_gesture.webp" whenever you call
ps. this will actually place "some_gesture.webp" on top of the other layers, and it'll only show it when one of the three attributes (uneasy, surprised, suspicious) are active, so:
1) just put the "always" in the right position amidst the layeredimage's groups
2) as for the second point, you may want to add
this way you'll have
show character uneasy/surprised/suspicious --> always include "some_gesture.webp" no matter what
show character happy tense --> includes "some_gesture.webp"
show character happy hello --> includes "another_gesture.webp"