This is part 4 of a 4 article series on some useful techniques for making a RenPy game. We’ll show you how to implement a simple inventory system and build an intelligent menu for a shop/vending machine that reacts and responds appropriately to player inventory and stats.
The other articles are listed below, links will be added as the articles come out.
- Stats/Inventory system
- Dynamic menus and dialog based off
- Event Triggers
- Recursive menus that continue until all options are exhausted
- Theme music
Scrolling Credits in RenPy
In my first RenPy project, scrolling credits was undoubtedly the most difficult problem I faced.
Googling it lead me to a very verbose and seemingly complex, but powerful solution in of about 40 lines of code.
Unfortunately, after playing around with the proposed solution I didn’t get it to work and, being in a time crunch, decided to develop my own technique which uses just 4 lines of code in total.
Step 1 – Grab an Image Editor
The first thing I did was open up an image editor, my preferred weapon of choice is the free and powerful GIMP.
I created a credits image with a transparent background, adding the text to the image exactly where and how I wanted it displayed.
This had the added benefit of allowing me the option of embedding images and stylistic designs into my credits, though I ran out of time to do so.
Step 2 – A Few Lines of Code
Once I had my credits image saved in the images folder of my RenPy project, I simply had to create a credits label with the following four lines of codecode under it.
label credits: $ credits_speed = 25 scene black show credits_image at Move((0.5, 1.0), (0.5, -1.0), credits_speed, xanchor=0.5, yanchor=0) with Pause(credits_speed+10)
First we set a convenience variable called “credits_speed” which will be the time in seconds that it takes our credits to scroll.
Then we turn the scene black.
Then we load in our credits image (called “credits_image”) in the center, but just below the screen. Our credits begin automatically scrolling up once we reach this line of code.
Lastly, we tell RenPy to wait for 10 seconds after the credits have scrolled.
While you don’t need to make the Pause that long, the Pause prevents PenPy from moving further down our script file, so it needs to be at least as long as credits_speed or you will cut your credits off in the middle!
This is a quick, easy, and reliable technique for producing good looking and highly customized scrolling credits in RenPy.
The inclusion of credits as images has no impact on performance and gives the creator total control over the presentation.
Found a better technique? Let me know in the comments below!
Looking for more RenPy tips? Want to find good, royalty free music for your games? Looking for quality, royalty free art for your games?
Find all this and more in the Friendly Neighborhood Newsletter.
See you soon!