small things I've done in Ren'Py while working on this (part 1)
So I'm getting more down to the nitty gritty in the game, which means I'm working on smaller things like adding transitions to the game.
In Pet, the visual novel I released last year, I manually wrote code for each transition, and it wasn't scalable.
The code looked like this in Pet:
scene black with Pause(1) show text "The Walk Home" with dissolve with Pause(1) hide text with dissolve with Pause(0.7)
This worked great in Ren'Py. It changed the background to black, paused for one second, showed the text "The Walk Home" with a dissolve in, held for a second, and then dissolved out the text, finally holding on a pause for 0.7 seconds (no idea why that's the magic number, but it was for that game!).
However, there were only 3-4 transitions like this in Pet, and Start Running contains a ton more.
After working with code in my day job for the past long while, I've really been interested in scalability, but a year ago I didn't know enough Python to do this.
In order to make this more scalable, here's what I created in Python:
def transition_text(transtext): transtext = Text(transtext) renpy.scene() renpy.show("black") renpy.pause(1, hard=True) renpy.show("mytext", [Position(xpos=.5, ypos=.5, xanchor=0.5, yanchor=0.5)], what=transtext) renpy.with_statement(trans=dissolve, always=False) renpy.pause(2, hard=True) renpy.hide("mytext") renpy.with_statement(trans=dissolve, always=False) renpy.pause(2, hard=True)
What this does is creates a function that I can call called "transition_text". It takes an input of a string of text. I guess if I was going to do this with photos, I would make it work with both, but these transitions are always just text.
When I call
$ transition_text("The Walk Home")
, the game does this process:
1. Turns the string into a text object, which is necessary for it to be displayed in the "what" , from what I can tell. When I tried this without that, it didn't work.
2. Sets the screen to black and forces a second of pause. This is superior, imho, because the player can't just click through the transition.
3. It then fades in the "The Walk Home" in the middle of the screen, exactly the same way the original text did, but with a different length of time.
4. It pauses, again with a hard pause.
5. It fades out and pauses.
This means that for every transition I want to show with text, I can just type one line and it's repeatable.
Trying to do this with transforms is probably also possible, but since I've already written a lot of Python for this project, this worked well.
Get Start Running
Start Running
A horror point and click game where choices matter about trying to do your final marathon training run.
Status | Released |
Publisher | |
Author | beepsoft industries |
Genre | Adventure |
Tags | Horror, Indie, Point & Click |
Languages | English |
Accessibility | Color-blind friendly |
More posts
- Patch 1.02Jul 30, 2024
- Start Running will release July 8, 2024!Jul 05, 2024
- Demo!Feb 19, 2024
Leave a comment
Log in with itch.io to leave a comment.