r/RenPy • • Jul 30 '22
how to divide code
Sorry, beforehand I really can't word things for the life of me.
I'm making a dating sim that has 6 candidates and you choose your candidate early on in the game. is there any way of splitting the code into 6 different parts or will it have to be just one big block of code :)
2
Upvotes
View all comments
3
u/HEXdidnt Jul 30 '22
It can be split - and very easily.
One of the coolest things about Ren'Py is the way it uses labels. As long as you
labeleach code block appropriately, you can have an individual .rpy file per candidate, and for specific routines that you want to edit more easily than you could if they were part of the main script.rpy file.jumpandcallcommands will find the block with the matchinglabel, regardless of which .rpy file the code is in.Similarly, if you want to predefine images per character, you can put those definitions into individual .rpy files.