Main Menu image

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
User avatar
Minuteman
Regular
Posts: 40
Joined: Sat Feb 24, 2018 2:02 pm
Location: On duty
Contact:

Main Menu image

#1 Post by Minuteman »

Hello
I want to change main menu image after end of the game (simple, not miltiple choice)

Thanks in advance!
of the people for the people

User avatar
Andredron
Miko-Class Veteran
Posts: 714
Joined: Thu Dec 28, 2017 2:37 pm
Location: Russia
Contact:

Re: Main Menu image

#2 Post by Andredron »

Minuteman wrote: Sat Feb 24, 2018 2:07 pm Hello
I want to change main menu image after end of the game (simple, not miltiple choice)

Thanks in advance!

Code: Select all

#script.rpy:
label start:
    "Change background in direct dependence from endings."
    menu:
        "First.":
            $ persistent.ending = "first"
        "Second.":
            $ persistent.ending = "second"
        "To return the main background.":
            $ persistent.ending = "main"
    return

#screens.rpy:
screen main_menu:
# This replaces the other menu
    tag menu
# The main menu background.
    window:
        style "mm_root"
       if persistent.ending == None:
    $ persistent.ending = "main"
    background ("images/mm-%s.jpg" % (persistent.ending))
# etc.


User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Main Menu image

#3 Post by Remix »

Code: Select all

default persistent.endings_found = []

init python:
    gui.main_menu_background = "images/bg {0}.png".format( len(persistent.endings_found) ) 

label some_ending:
    if 1 not in persistent.endings_found:
         persistent.endings_found.append( 1 ) 

label some_other_ending:
    if 2 not in persistent.endings_found:
         persistent.endings_found.append( 2 ) 
Would use images/bg 0.png then images/bg 1.png etc
Frameworks & Scriptlets:

User avatar
Draziya
Regular
Posts: 70
Joined: Sun Nov 26, 2017 8:50 am
Completed: this was for you. [NaNoRenO 19], Acetylene [AceJam19], Ah!! My Roommate is a Succubus Hellbent on World [MonJam 18], I Don't Have A Clue [QRMJam 18], Cautionary Tale [NaNoRenO 18], OP Dodge Cross [GGJ 18], Acetone [AceJam 18]
Projects: I'm a love interest in my childhood friend's reverse harem!!
Organization: Watercress
itch: Drazillion
Contact:

Re: Main Menu image

#4 Post by Draziya »

I notice that you mentioned your game doesn't have multiple choices. This is what I did for a kinetic VN I did.

At the end of the game I added a persistent variable.

Code: Select all

label end:
    "THE END"
    $ persistent.end = 1

I added an if statement with that persistent variable in the game_menu in screens.rpy.

Code: Select all

screen game_menu(title, scroll=None, yinitial=0.0):

    style_prefix "game_menu"

    if main_menu:
        if persistent.end:
            add "images/ending.png"
        else:
            add gui.main_menu_background

    else:
        add gui.game_menu_background
Image

User avatar
Minuteman
Regular
Posts: 40
Joined: Sat Feb 24, 2018 2:02 pm
Location: On duty
Contact:

Re: Main Menu image

#5 Post by Minuteman »

Draziya wrote: Sat Feb 24, 2018 7:44 pm I notice that you mentioned your game doesn't have multiple choices. This is what I did for a kinetic VN I did.

At the end of the game I added a persistent variable.

Code: Select all

label end:
    "THE END"
    $ persistent.end = 1

I added an if statement with that persistent variable in the game_menu in screens.rpy.

Code: Select all

screen game_menu(title, scroll=None, yinitial=0.0):

    style_prefix "game_menu"

    if main_menu:
        if persistent.end:
            add "images/ending.png"
        else:
            add gui.main_menu_background

    else:
        add gui.game_menu_background
I did this, but main menu picture didn't change after end of the game...
of the people for the people

User avatar
Draziya
Regular
Posts: 70
Joined: Sun Nov 26, 2017 8:50 am
Completed: this was for you. [NaNoRenO 19], Acetylene [AceJam19], Ah!! My Roommate is a Succubus Hellbent on World [MonJam 18], I Don't Have A Clue [QRMJam 18], Cautionary Tale [NaNoRenO 18], OP Dodge Cross [GGJ 18], Acetone [AceJam 18]
Projects: I'm a love interest in my childhood friend's reverse harem!!
Organization: Watercress
itch: Drazillion
Contact:

Re: Main Menu image

#6 Post by Draziya »

My apologies! I was looking at the wrong part of my code. That's for the background of the game menu (which you still might want). The background for the main menu is the same but in the main_menu screen in screens.rpy

Code: Select all

screen main_menu():

    ## This ensures that any other menu screen is replaced.
    tag menu

    style_prefix "main_menu"

    if persistent.end:
        add "images/ending.png"
    else:
        add gui.main_menu_background
Image

User avatar
Minuteman
Regular
Posts: 40
Joined: Sat Feb 24, 2018 2:02 pm
Location: On duty
Contact:

Re: Main Menu image

#7 Post by Minuteman »

Draziya wrote: Sun Feb 25, 2018 5:08 am My apologies! I was looking at the wrong part of my code. That's for the background of the game menu (which you still might want). The background for the main menu is the same but in the main_menu screen in screens.rpy

Code: Select all

screen main_menu():

    ## This ensures that any other menu screen is replaced.
    tag menu

    style_prefix "main_menu"

    if persistent.end:
        add "images/ending.png"
    else:
        add gui.main_menu_background
Its working, thank you!
of the people for the people

Post Reply

Who is online

Users browsing this forum: Google [Bot]