Hey geniuses,
Anyone know how to code a simple opacity slider in a renpy screen? The idea would be to let the user play with a character's clothes... make them more and less transparent. Can be a single image with a clothing overlay. Nothing fancy.
Well for the screen it's easy, it's a
You must be registered to see the links
screen statement:
Python:
screen whatever():
bar:
value persistent.transparency
range 100
Then normally it should works if you define the image in two times.
Firstly the piece of clothes that have to have their transparency directly linked to the slider's value. For this you need to rely on the
You must be registered to see the links
(ATL), and more precisely on its
You must be registered to see the links
property.
Python:
image girl1_dress1:
"girl1/clothes/dress1.png"
matrixcolor OpacityMatrix( persistent.transparency )
/!\ WARNING /!\
You need Ren'Py version 7.4.6 or higher for this to works, and you need to enable the model based mode with
You must be registered to see the links
.
Secondly you use
You must be registered to see the links
to the sprite that will use this piece of clothes:
Python:
layeredimage girl1:
always:
"girl1/body.png"
group clothes:
attribute dress1:
"girl1_dress1"
[...]
I haven't tested it, but layered images updates in real time, and normally
matrixcolor
should works follow the usual ATL logic, and therefore accept a variable at value, while updating in real time.
So, it should works.
Edit: ATL stopped updating in real time, you now need to show the image again for it to be updated, will not works :/