[Solved] Changing the title screen throughout the game?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
menostorpe
Newbie
Posts: 15
Joined: Tue Jan 06, 2009 10:01 am
Contact:

[Solved] Changing the title screen throughout the game?

#1 Post by menostorpe »

Basically, I want to have several different title screens. When the player starts up the VN for the first time, they'll see the first image, but after they progress far enough in the story, the title screen will change to the second image, and so on.

How should I do this? I set persistent data when those points in the story are passed, but I'm not sure how to change the image based on that.
Last edited by menostorpe on Wed Mar 29, 2017 5:28 pm, edited 1 time in total.

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2402
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Changing the title screen throughout the game?

#2 Post by Ocelot »

You can do something like that in main_menu screen:

Code: Select all

# instead of add gui.main_menu_background :
if persistent.progress == 3:
    add backgound_3
elif persistent.progress == 2:
    add backgound_2
elif persistent.progress == 1:
    add backgound_1
else
    add backgound_default
< < insert Rick Cook quote here > >

menostorpe
Newbie
Posts: 15
Joined: Tue Jan 06, 2009 10:01 am
Contact:

Re: Changing the title screen throughout the game?

#3 Post by menostorpe »

Thanks for the quick answer! I should probably have mentioned that I'm using the legacy theme, not the GUI interface. I think the relevant part looks like this:

Code: Select all

    window:
        style "mm_root"
I tried something very much like what you suggested, just in case the screen could take if/else statements, but it didn't work.

User avatar
IrinaLazareva
Veteran
Posts: 399
Joined: Wed Jun 08, 2016 1:49 pm
Projects: Legacy
Organization: SunShI
Location: St.Petersburg, Russia
Contact:

Re: Changing the title screen throughout the game?

#4 Post by IrinaLazareva »

in Legacy theme:

Code: Select all

    # The background of the main menu.
    window:
        style "mm_root"
        if persistent.progress == 1:
            add "image.png"
        elif persistent.progress == 2:
            add "newimage.png"
        #etc...

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3794
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: Changing the title screen throughout the game?

#5 Post by Imperf3kt »

Always make sure you count from highest to lowest (if you use numbers as your flags). Otherwise you may get undesired results when Ren'Py checks if '1' is true before '2'
If 1 is true, then 2 is ignored without being checked.

If you're using the same variable to set the bg, I think thats a bad idea. Imagine a player is at persistent.progress = 5.
What happens if a player loads an old save file, reaches persistent.progress = 3
The menu changes back to 3's background. All good.
But now they exit and reload where they were. Persistent.progress is still 3.
Last edited by Imperf3kt on Wed Mar 29, 2017 5:02 pm, edited 1 time in total.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

menostorpe
Newbie
Posts: 15
Joined: Tue Jan 06, 2009 10:01 am
Contact:

Re: Changing the title screen throughout the game?

#6 Post by menostorpe »

That does it, thanks!

Post Reply

Who is online

Users browsing this forum: Bing [Bot]