The code below allows you to have control on the thing and to adapt it to your needs.
Starting with Ren'py itself but old in general coding, I thought it was a bit bothering sometimes to have to write exactly the same thing in the pictures names and then in the code. Like "image Satria embarassed = 'img/Satria/embarassed.png" : two time nearly the same thing, in coding, is bad... it needs to be improved.
Data path and variable names looking that similar... a lot of time can surely be earned.
Code: Select all
init python hide:
for file in renpy.list_files():
if file.startswith('img/'):
if file.endswith('.png'):
name = file.replace('img/','').replace('/', ' ').replace('.png','')
renpy.image(name, Image(file, yanchor=400))
continue
continue
In short: it takes every files in the directory you want, and see if they are PNG files (you can change the extension too). Then it takes the path of the file and build the image variable from it. "img/Satria/upside_down.png" wille create a "Satria upside_down", "img/CG/black_night.png" will do a "CG black_night".
With that in your directory : http://puu.sh/MfYT http://puu.sh/MfV0
It will avoid you to write these lines :
Code: Select all
image Satria embarassed = 'img/Satria/embarassed.png"
image Satria upside_down = 'img/Satria/upside_down.png"
etc...
An other advantage is that you just have to add a picture to your directory and you can already use it in your code.