Create textbutton with transition

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
alex.theoto
Regular
Posts: 55
Joined: Sun Sep 13, 2015 3:11 pm
Location: Greece
Contact:

Create textbutton with transition

#1 Post by alex.theoto » Wed Nov 18, 2015 1:31 pm

I want to make some effects at menus on a vn I'm working now.
I'm newbie on code.

What I want to do is to make the menu frames movement from left to right and with alpha fade.
So, after some research, I saw this and with the combination of 'easein' I tried but with no success.

Code: Select all

screen test_frame():
    frame:
        xpadding 10
        ypadding 10
        xalign 0.7 yalign .8 alpha 0.0
	easein .7 xalign 0.8 alpha 1.0

        vbox:
            text "Display"
            null height 10
            textbutton "Fullscreen" action Preference("display", "fullscreen")
            textbutton "Window" action Preference("display", "window")
I get the error 'Tab charachers are not allowed in Ren'Py scripts.' [at 'xalign 0.7 yalign .8 alpha 0.0' line]

Where is my 'tab' mistake?
Is it possible to use easein on textbutton?

Thank you...

User avatar
Jae
Regular
Posts: 192
Joined: Sun Sep 13, 2015 5:41 pm
Projects: Pokémon Academy Life
Location: New York, NY
Contact:

Re: Create textbutton with transition

#2 Post by Jae » Wed Nov 18, 2015 3:59 pm

The "tab" mistake is likely because you copied and pasted from another document. Note how "easein" and "frame:" are not aligned properly. Renpy's indents use four spaces (literally hitting your space bar four times, not the same as hitting "tab" in Microsoft Word or Notepad, for example).

Also as for transitions, you can try using "$ renpy.transition(USER DEFINED TRANSITION)" prior to showing your "screen test_frame()". For example, I often use "$ renpy.transition(dissolve)" for showing and hiding screens.

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: Create textbutton with transition

#3 Post by Donmai » Wed Nov 18, 2015 4:29 pm

alex.theoto wrote:Where is my 'tab' mistake?
Certainly at the start of a line :mrgreen: . This error has nothing to do with your attempt to use ATL to animate menus. Make sure you are indenting with spaces, not tab characters. Anyway, your code wouldn't work because of indentation errors, and because you're mixing ATL and Screen Language commands.
alex.theoto wrote:Is it possible to use easein on textbutton?
Yes, but it seems you are in fact trying to use it on a frame which contain some buttons. You would have to understand better how ATL works. easein is not a command to move things, it's a warper that will affect the way things move. I will give you an example of how to make the standard main menu animate.
First, you must decide where you want your menu to stay. In this case I will put it centered and near the bottom of the screen. Using the xalign and yalign values we can create an ATL transform that will animate the frame.

Code: Select all

transform move_up:
    subpixel True
    xalign .5 # this will center the main menu
    alpha 0.0 yalign 1.0 yanchor 0.0 # this will position the main menu at the bottom, outside of the screen
    parallel:
        easein 1.0 alpha 1.0
    parallel:
        easein 1.0 yanchor 1.0 #changing yanchor from 0 to 1 we make the menu appear
There's no "right" place to put a transform. Usually I create a new rpy file called (duh) transforms.rpy, and put it there. Now open your screens.rpy and look for these lines:

Code: Select all

    # The main menu buttons.
    frame:
        style_group "mm"
        xalign .98
        yalign .98

        has vbox
and change them to:

Code: Select all

    # The main menu buttons.
    frame:
        at move_up
        style_group "mm"

        has vbox
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

alex.theoto
Regular
Posts: 55
Joined: Sun Sep 13, 2015 3:11 pm
Location: Greece
Contact:

Re: Create textbutton with transition

#4 Post by alex.theoto » Thu Nov 19, 2015 10:41 am

Thank you both of you for your reply.

I didn't know that my text editor messed my tabs even I set it as space.
Renpy's editra editor works perfect and for the time being I'll use it.

As for my problem, Donmai's code helped me a lot.

Post Reply

Who is online

Users browsing this forum: Google [Bot], Ocelot