screen before main menu screen

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
black_hayate
Newbie
Posts: 7
Joined: Sun Jul 21, 2013 2:52 pm
Completed: in progress
Projects: in progress
Organization: none
Location: far from here
Contact:

screen before main menu screen

#1 Post by black_hayate » Thu Jul 25, 2013 5:38 pm

I need help with a splash screen or start screen(before main menu screen).
something like the image:

*if I click on the screen, go to main menu
*if I wait about 40 seconds, go to opening video
Attachments
screens.jpg

User avatar
BlueScorpion
Newbie
Posts: 14
Joined: Thu Jul 25, 2013 4:01 am
Contact:

Re: screen before main menu screen

#2 Post by BlueScorpion » Thu Jul 25, 2013 11:46 pm

There might be a better way to do this, but something like this technically works...

Code: Select all

init python:
    show_main = False
screen main_menu:
    # This ensures that any other menu screen is replaced.
    tag menu

    # The background of the main menu.
    window:
        style "mm_root"

    if not show_main:
        timer 40 action SetVariable('show_main', True)
        textbutton '':
            background None xminimum config.screen_width yminimum config.screen_height
            action SetVariable('show_main', True)
        text "Click to start" xalign .5 yalign .75 style style.button_text
        
    else:
        # The main menu buttons.
        frame:
            style_group "mm"
            xalign .98
            yalign .98
    
            has vbox
    
            textbutton _("Start Game") action Start()
            textbutton _("Load Game") action ShowMenu("load")
            textbutton _("Preferences") action ShowMenu("preferences")
            textbutton _("Help") action Help()
            textbutton _("Quit") action Quit(confirm=False)

User avatar
black_hayate
Newbie
Posts: 7
Joined: Sun Jul 21, 2013 2:52 pm
Completed: in progress
Projects: in progress
Organization: none
Location: far from here
Contact:

Re: screen before main menu screen

#3 Post by black_hayate » Fri Jul 26, 2013 1:15 am

I can't understand the code, it's very confusing...
I'm in options.rpy where the opening and start screen(static image) code are in there
just need a simple code, anyway thanks for the help, maybe can try...

User avatar
BlueScorpion
Newbie
Posts: 14
Joined: Thu Jul 25, 2013 4:01 am
Contact:

Re: screen before main menu screen

#4 Post by BlueScorpion » Fri Jul 26, 2013 1:38 am

If you don't care how it works, just go to screens.rpy, select the entire main menu screen (except for the style block underneath) and paste the code i provided over it.

I will try to explain it, though.

This initializes the variable used to decide whether 'Click to continue' or the menu selections are showing.

Code: Select all

init python:
    show_main = False
This block of code runs when show_main is False.

Code: Select all

    if not show_main:
        timer 40 action SetVariable('show_main', True)
        textbutton '':
            background None xminimum config.screen_width yminimum config.screen_height
            action SetVariable('show_main', True)
        text "Click to start" xalign .5 yalign .75 style style.button_text
This line sets a timer that will set show_main to True when it expires.

Code: Select all

timer 40 action SetVariable('show_main', True)
This line creates an invisible button the size of the screen that sets show_main to True when clicked.

Code: Select all

textbutton '':
    background None xminimum config.screen_width yminimum config.screen_height
    action SetVariable('show_main', True)
This line just creates text that says "Click to start".

Code: Select all

text "Click to start" xalign .5 yalign .75 style style.button_text
This block of code runs when show_main is True. It is unchanged from the default main menu code, except that i indented it to place it under the else.

Code: Select all

    else:
        # The main menu buttons.
        frame:
            style_group "mm"
            xalign .98
            yalign .98
   
            has vbox
   
            textbutton _("Start Game") action Start()
            textbutton _("Load Game") action ShowMenu("load")
            textbutton _("Preferences") action ShowMenu("preferences")
            textbutton _("Help") action Help()
            textbutton _("Quit") action Quit(confirm=False)

User avatar
BlueScorpion
Newbie
Posts: 14
Joined: Thu Jul 25, 2013 4:01 am
Contact:

Re: screen before main menu screen

#5 Post by BlueScorpion » Fri Jul 26, 2013 1:51 am

Oh yeah... i just realized i have "Click to start" set to the button color, which may not have been the best choice. In some themes it's going to be too similar to the background.
To change the color find this line:

Code: Select all

   text "Click to start" xalign .5 yalign .75 style style.button_text
...and replace it with this one:

Code: Select all

    text "Click to start" xalign .5 yalign .75 color '#000'
It will change the color to black.

User avatar
black_hayate
Newbie
Posts: 7
Joined: Sun Jul 21, 2013 2:52 pm
Completed: in progress
Projects: in progress
Organization: none
Location: far from here
Contact:

Re: screen before main menu screen

#6 Post by black_hayate » Fri Jul 26, 2013 2:28 am

ahh ok, but, how about the opening video, I have it in a code in options.rpy in a label, like this:

Code: Select all

label opening:
    $renpy.movie_cutscene("opening.mpg")
next, the "click to start" screen, label too:

Code: Select all

label starts: 
    scene start with dissolve
    play sound "start.mp3"
    $renpy.pause(40.0)
after this the main menu screen...

but the question is:
how i put on this timer to show the opening screen if I not click in "click to start" screen for about 40 seconds?
only if I clic on the "clic to start" screen allow me to advance to the main_menu screen

like the image i posted before
something like a game when a press start screen appears, if i press start it shows me the main menu, or if i not press anything for a long time, it returns to opening video

User avatar
BlueScorpion
Newbie
Posts: 14
Joined: Thu Jul 25, 2013 4:01 am
Contact:

Re: screen before main menu screen

#7 Post by BlueScorpion » Fri Jul 26, 2013 3:29 am

Oh. Sorry, that detail got away from me. Might work if you just have the timer jump to the opening's label instead.

Code: Select all

timer 40 action Jump('opening')

adeRuZet
Newbie
Posts: 13
Joined: Wed Oct 04, 2017 11:23 am
Github: aderuZet
Contact:

Re: screen before main menu screen

#8 Post by adeRuZet » Sat Oct 14, 2017 1:15 am

BlueScorpion wrote:
Fri Jul 26, 2013 1:38 am
If you don't care how it works, just go to screens.rpy, select the entire main menu screen (except for the style block underneath) and paste the code i provided over it.

I will try to explain it, though.

This initializes the variable used to decide whether 'Click to continue' or the menu selections are showing.

Code: Select all

init python:
    show_main = False
This block of code runs when show_main is False.

Code: Select all

    if not show_main:
        timer 40 action SetVariable('show_main', True)
        textbutton '':
            background None xminimum config.screen_width yminimum config.screen_height
            action SetVariable('show_main', True)
        text "Click to start" xalign .5 yalign .75 style style.button_text
This line sets a timer that will set show_main to True when it expires.

Code: Select all

timer 40 action SetVariable('show_main', True)
This line creates an invisible button the size of the screen that sets show_main to True when clicked.

Code: Select all

textbutton '':
    background None xminimum config.screen_width yminimum config.screen_height
    action SetVariable('show_main', True)
This line just creates text that says "Click to start".

Code: Select all

text "Click to start" xalign .5 yalign .75 style style.button_text
This block of code runs when show_main is True. It is unchanged from the default main menu code, except that i indented it to place it under the else.

Code: Select all

    else:
        # The main menu buttons.
        frame:
            style_group "mm"
            xalign .98
            yalign .98
   
            has vbox
   
            textbutton _("Start Game") action Start()
            textbutton _("Load Game") action ShowMenu("load")
            textbutton _("Preferences") action ShowMenu("preferences")
            textbutton _("Help") action Help()
            textbutton _("Quit") action Quit(confirm=False)
how about to change the click button into something like, press F or press Spacebar to start.
and, is it ok if i change the Click to Start text to an imagemap/imagebutton?

Post Reply

Who is online

Users browsing this forum: Donmai