[Solved]Ingame menu/choices transitions?

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
somein96
Newbie
Posts: 8
Joined: Sun Jul 20, 2014 1:55 am
Location: New Zealand
Contact:

[Solved]Ingame menu/choices transitions?

#1 Post by somein96 » Sat Sep 26, 2015 7:37 am

Hi I was wondering if it's possible to assign a transition to choice menus, and if so how would I go about doing that?
Last edited by somein96 on Mon Sep 28, 2015 5:38 am, edited 1 time in total.

philat
Eileen-Class Veteran
Posts: 1853
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Ingame menu/choices transitions?

#2 Post by philat » Sat Sep 26, 2015 11:05 am

You can assign an ATL transform to the choice screen using on show / on hide. http://www.renpy.org/doc/html/atl.html#on-statement

Or you can apply the transform to the buttons, I guess, which are drawn in a for loop so you'd only need to apply it once.

User avatar
Donmai
Eileen-Class Veteran
Posts: 1919
Joined: Sun Jun 10, 2012 1:45 am
Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question, To The Girl With Sunflowers
Projects: Slumberland
Location: Brazil
Contact:

Re: Ingame menu/choices transitions?

#3 Post by Donmai » Sat Sep 26, 2015 11:21 am

There are two approaches: common transitions or ATL transforms. You can apply a transition to a menu this way:

Code: Select all

    menu:
        with dissolve #you can use any other transition instead of dissolve
        f "What color do you prefer?"
        "I prefer red.":
            jump red
        "I prefer blue.":
            jump blue
To use an ATL transform, you must make a little edit on the choice screen. You will find it on your screens.rpy. Find these lines:

Code: Select all

##############################################################################
# Choice
#
# Screen that's used to display in-game menus.
# http://www.renpy.org/doc/html/screen_special.html#choice

screen choice:

    window:
        style "menu_window"
and insert your transform name after the window statement:

Code: Select all

##############################################################################
# Choice
#
# Screen that's used to display in-game menus.
# http://www.renpy.org/doc/html/screen_special.html#choice

screen choice:

    window:
        at fromRight 
        style "menu_window"
Define your transform anywhere (Personally, I like to have a separate script for my transforms):

Code: Select all

    transform fromRight:
        subpixel True
        alpha 0.0 xalign 1.0 xanchor 0.0
        parallel:
            easein 1.0 alpha 1.0
        parallel:
            easein 1.0 xalign 0.5
        on hide:            
            alpha 1 zoom 1 xanchor 0.5 yanchor 0.5
            block:
                linear 0.1 zoom 1.1
                linear 0.5 zoom 0
Using this second method all your in-game menus will use the same transform.
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

somein96
Newbie
Posts: 8
Joined: Sun Jul 20, 2014 1:55 am
Location: New Zealand
Contact:

Re: Ingame menu/choices transitions?

#4 Post by somein96 » Sun Sep 27, 2015 7:41 am

Thank you very much! These were exactly what I was looking for =D

Nova Alamak
Regular
Posts: 71
Joined: Sun Jun 08, 2014 1:45 pm
Contact:

Re: [Solved]Ingame menu/choices transitions?

#5 Post by Nova Alamak » Sat Apr 16, 2016 6:29 pm

Thanks for the info! This was really well-answered. I was wondering if there's a similar way to also use a transition after the choice is made? Say I had my menu slide in from the left with the moveinleft transform; where would I place a moveoutleft transition to slide it on out afterward?

EDIT: Never mind! I tried the ATL method instead and my question is now invalid!

trismegistus
Newbie
Posts: 7
Joined: Mon Jul 04, 2016 4:02 pm
Contact:

Re: [Solved]Ingame menu/choices transitions?

#6 Post by trismegistus » Mon Jul 04, 2016 4:07 pm

Thanks for this. Relatedly, I was wondering if it's possible to make each menu option transition in one at a time. I tried moving the "at fromRight" statement into the for loop:

Code: Select all

            for caption, action, chosen in items:

                if action:

                    button:
                        at fromRight
                        action action
                        style "menu_choice_button"

                        text caption style "menu_choice"

                else:
                    text caption style "menu_caption"
...but they all still seem to slide in at the same time. I'm guessing it's because there's nothing making it delay each subsequent option. Can I make it delay playing the transition by a slightly longer amount for each button?

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

Re: [Solved]Ingame menu/choices transitions?

#7 Post by Alex » Mon Jul 04, 2016 4:59 pm

This will make them appear one after another

Code: Select all

transform my_tr(t=0):
    xpos 1.2 xanchor 0.0
    t*0.5
    linear 1.0 xalign 0.5

    
screen choice(items):

    window:
        style "menu_window"
        xalign 0.5
        yalign 0.5

        vbox:
            style "menu"
            spacing 2

            for i, (caption, action, chosen) in enumerate(items):

                if action:
                    button:
                        action action
                        style "menu_choice_button"

                        text caption style "menu_choice"
                        at my_tr(t=i)

                else:
                    text caption style "menu_caption" at my_tr(t=i)
https://docs.python.org/2/library/funct ... #enumerate

trismegistus
Newbie
Posts: 7
Joined: Mon Jul 04, 2016 4:02 pm
Contact:

Re: [Solved]Ingame menu/choices transitions?

#8 Post by trismegistus » Mon Jul 04, 2016 5:33 pm

Thanks, that's just what I need. The only thing that confuses me is the line that's just "t*0.5" with no statement or anything. Does Ren'py just treat a number on its own line as "wait for this many seconds"?

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

Re: [Solved]Ingame menu/choices transitions?

#9 Post by Alex » Mon Jul 04, 2016 6:14 pm


Post Reply

Who is online

Users browsing this forum: Google [Bot], zyric