Page 1 of 1

screen before main menu screen

Posted: Thu Jul 25, 2013 5:38 pm
by black_hayate
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

Re: screen before main menu screen

Posted: Thu Jul 25, 2013 11:46 pm
by BlueScorpion
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)

Re: screen before main menu screen

Posted: Fri Jul 26, 2013 1:15 am
by black_hayate
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...

Re: screen before main menu screen

Posted: Fri Jul 26, 2013 1:38 am
by BlueScorpion
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)

Re: screen before main menu screen

Posted: Fri Jul 26, 2013 1:51 am
by BlueScorpion
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.

Re: screen before main menu screen

Posted: Fri Jul 26, 2013 2:28 am
by black_hayate
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

Re: screen before main menu screen

Posted: Fri Jul 26, 2013 3:29 am
by BlueScorpion
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')

Re: screen before main menu screen

Posted: Sat Oct 14, 2017 1:15 am
by adeRuZet
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?