Fade for menu choices during the beginning scene

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
johnstag123
Newbie
Posts: 14
Joined: Mon Dec 02, 2013 7:27 am
Contact:

Fade for menu choices during the beginning scene

#1 Post by johnstag123 » Thu Jan 02, 2014 2:53 am

Hello, a the beginning of the game im making there is a set of menu choices which sa if they want to rename the mc or not. How do you make the menu choice slowly fade after one selects it only for that scene. I think it involves the renpy. wait and the with dissolve. I could make the dissolve slower by costumizing the time to like .75, but I'm not really sure how you make it that the menu choice will slowly dissolve I only know how to make it for text though. I also want to know how to make it only for that scene since I don't want all the menu choices to fade slowly like that.

User avatar
Alex
Lemma-Class Veteran
Posts: 2981
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Fade for menu choices during the beginning scene

#2 Post by Alex » Thu Jan 02, 2014 9:40 am

Try to modify choice screen a bit

Code: Select all

transform appear:
    on show:
        xalign .5 yalign .5
        zoom .6 alpha 0.0
        linear 1.5 zoom 1.0 alpha 1.0
        
    on replace:
        xalign .5 yalign .5
        zoom .6 alpha 0.0
        linear 1.5 zoom 1.0 alpha 1.0
        
    on hide:
        linear 1.5 zoom .6 alpha 0.0

screen choice:

    if flag:
        window:
            style "menu_window"
            xalign 0.5
            yalign 0.5
        
            at appear
                

            vbox:
                style "menu"
                spacing 2

                for caption, action, chosen in items:

                    if action:

                        button:
                            action action
                            style "menu_choice_button"

                            text caption style "menu_choice"

                    else:
                        text caption style "menu_caption"
                        
    else:
        window:
            style "menu_window"
            xalign 0.5
            yalign 0.5
                

            vbox:
                style "menu"
                spacing 2

                for caption, action, chosen in items:

                    if action:

                        button:
                            action action
                            style "menu_choice_button"

                            text caption style "menu_choice"

                    else:
                        text caption style "menu_caption"

label start:

    "..."
    $ flag = True # this var's value must be set before menu would be shown for the first time
    menu:
        "Choice 1":
            pass
            
        "Choice 2":
            pass
        
    "..."
    $ flag = False # sets the value for the rest of the menus (don't set it right after the choice made otherwise you won't be able to see the hide transform)
    
    menu:
        "Choice 3":
            pass
            
        "Choice 4":
            pass
    "..."

User avatar
johnstag123
Newbie
Posts: 14
Joined: Mon Dec 02, 2013 7:27 am
Contact:

Re: Fade for menu choices during the beginning scene

#3 Post by johnstag123 » Thu Jan 02, 2014 11:31 am

I have tried the above script and I placed it into a init python: however I'm now getting this error.
init python:
transform appear:
on show:
xalign .5 yalign .5
zoom .6 alpha 0.0
linear 1.5 zoom 1.0 alpha 1.0

on replace:
xalign .5 yalign .5
zoom .6 alpha 0.0
linear 1.5 zoom 1.0 alpha 1.0

on hide:
linear 1.5 zoom .6 alpha 0.0

screen choice:

if flag:
window:
style "menu_window"
xalign 0.5
yalign 0.5

at appear


vbox:
style "menu"
spacing 2

for caption, action, chosen in items:

if action:

button:
action action
style "menu_choice_button"

text caption style "menu_choice"

else:
text caption style "menu_caption"

else:
window:
style "menu_window"
xalign 0.5
yalign 0.5


vbox:
style "menu"
spacing 2

for caption, action, chosen in items:

if action:

button:
action action
style "menu_choice_button"

text caption style "menu_choice"

else:
text caption style "menu_caption"
File "game/script.rpy", line 58: invalid syntax
transform appear:

User avatar
Alex
Lemma-Class Veteran
Posts: 2981
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Fade for menu choices during the beginning scene

#4 Post by Alex » Thu Jan 02, 2014 1:30 pm

You don't need to put it under init or init python block, just open screens.rpy, find the code for choice screen and replace it with this code - should work.

http://www.renpy.org/doc/html/atl.html# ... -statement

User avatar
Michiyo6918
Veteran
Posts: 262
Joined: Fri Nov 11, 2011 12:26 am
Projects: ╮(╯▽╰)╭
Location: Look behind you
Contact:

Re: Fade for menu choices during the beginning scene

#5 Post by Michiyo6918 » Thu Jan 02, 2014 7:30 pm

I tried out your code and it works!!
But I have been trying and just can't seem to make any change to the interface... do you have a way to customize this menu choice button? Like I want the options to be spacing out evenly in the black box and maybe in the center? (And if I can-- is it possible to replace that black box with my own background of some sort?)
screenshot.png
Tumblr | DA | Honest Critique
“如果那个人是神。
他想渎神。
——【黑匣子】”

User avatar
Alex
Lemma-Class Veteran
Posts: 2981
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Fade for menu choices during the beginning scene

#6 Post by Alex » Fri Jan 03, 2014 7:15 pm

You need to set appropriate styles - http://lemmasoft.renai.us/forums/viewto ... =51&t=9812
By the way, are you showing your menu inside the textbox?

User avatar
Michiyo6918
Veteran
Posts: 262
Joined: Fri Nov 11, 2011 12:26 am
Projects: ╮(╯▽╰)╭
Location: Look behind you
Contact:

Re: Fade for menu choices during the beginning scene

#7 Post by Michiyo6918 » Sun Jan 05, 2014 3:37 am

O- OH-OHHH Hello how stupid I am LMFAO Okay thank you for your help I finally understood XD

Yes, onto your question- All I did was copy paste the code from you so I don't know what went wrong. But I did find out how to show the menu the normal way. If I keep this code in the screen choice then the menu will appear normally. (With all the transition of course)

Code: Select all

init -2 python:
    config.narrator_menu = True
    
    style.menu_window.set_parent(style.default)
    style.menu_choice.set_parent(style.button_text)
    style.menu_choice.clear()
    style.menu_choice_button.set_parent(style.button)
    style.menu_choice_button.xminimum = int(config.screen_width * 0.75)
    style.menu_choice_button.xmaximum = int(config.screen_width * 0.75)
Tumblr | DA | Honest Critique
“如果那个人是神。
他想渎神。
——【黑匣子】”

Post Reply

Who is online

Users browsing this forum: Google [Bot]