XaiJu
Gatobob
Gatobob

patreon


Ren'Py Tutorial: Collection Screens

To make something like my custom collection screens, you'll need to do three things: Make a custom menu screen, add a link to the screen to the game menu, and manipulate persistent variables. So this tutorial will have three parts!

Part 1: Making a Custom Menu Screen

Even though it's kind of a pain, and boring- the first thing you should do is open your 'screens.rpy' file and read through it. It's okay if you don't understand everything, but just look over it and see if you can familiarize yourself with the structure of screens before you continue. This can help with all sorts of projects down the line!

You may have noticed that each screen is separated and labelled like this:

( 1 ) - The top part of the screen, in green, is the description for it. Since all of these lines start with '#', they're just code comments. This is how to write notes in your code without having the page try and read them!

( 2 ) This very important line is what defines and begins the Screen. 'file_picker' is the name of a screen that's built in to the game to begin with. 

When you're making a custom Screen, it's a good idea to have those '#' comments at the top, describing your screen so you can remember what you've been building later.

As you can see above, my custom death collection page looks a lot like the other Screens at the top. I haven't included the design elements inside the screen yet, but we'll get to that!

Part 2: Adding a link to your custom screen in the game's menu

You've created a screen, but right now you have no way to reach it! You'll need to add a link to game's menu.

In the 'screen.rpy' file, you'll also find the Screen called 'Navigation'. This controls the buttons that appear on the side of most of the built in screen pages. As you can see in my image of my custom screen above, I also make sure to include it there!

On the Navigation screen, add a new textbutton that leads to your custom Screen. The red text on the left of the textbutton is what the button will say on it. The red text on the right needs to be the exact name that you gave to your custom Screen.

Once you've done that, you should be able to reach your custom Screen from any other place that shows the navigation! 

Part 3: Creating and Checking Persistent Variables

Now that we have a custom Screen and can reach it, we need to fill it up with our information!

To check whether a player has gotten a specific ending, you'll need to place a persistent variable at that ending in the script.

In the script.rpy file:

The above is an example of one of my game endings. The important part is the line:

$ persistent.ren_ending_shot = True

Adding 'persistent.' before a variable definition makes it so the variable will remain filled even after the player closes the game and reopens it. This is perfect for saving information like what endings they've gotten!

Now you can check this variable back on your custom Screen back on screens.rpy.

The image above shows a little bit of text that will display differently depending on if 'persisten.ren_ending_shot' is 'True' or not.

If the player has gone past that script part that sets it to True, this bit of code will display the ending, if not, it'll display the '???'.

_________________________________________________________________

And that's it folks! The only part left is doing the same thing for every ending XD A long task, but I think it's worth it!


More Creators