[solved] How to use transformations on pre-existing windows.

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
texi
Newbie
Posts: 14
Joined: Tue May 30, 2017 3:40 pm
Contact:

[solved] How to use transformations on pre-existing windows.

#1 Post by texi »

I tried to set what as the window's name but that didn't work. This is using renpy.show(). The window in question is generated by a function. I want to make it move when an option is selected.
Last edited by texi on Sun Jul 09, 2017 7:22 am, edited 1 time in total.

User avatar
Evildumdum
Regular
Posts: 191
Joined: Sun Jan 18, 2015 8:49 am
Projects: ApoclypseZ
Contact:

Re: How to use transformations on pre-existing windows.

#2 Post by Evildumdum »

When you say windows, do you mean screens? If so, you can set the transform to a variable and change the transform attached to it, the use renpy.restart_interaction()

Simple example:

Code: Select all

init:
    transform number_one:
        xpos 0.5 ypos 0.5 
        linear 1.0 xpos 1.0 ypos 0.5
    transform number_two:
        xpos 1.0 ypos 0.5 
        linear 1.0 xpos 0.5 ypos 0.5

init python:
    changing_transform = "None"

screen example_screen:
    add "example image at changing_transform
label start:
    $ changing_transform = number_one
    show screen example_screen #brings up screen with transform number_one being executed
    $ changing_transform = number_two
    $ renpy.restart_interaction() #refreshes active screens, which will activate the now changed changing_transform and apply it
Please note that because renpy compiles init python's before standard init's you cannot assign a transform to a variable during initialization. You have to do it within the running code.
"If at first you don't succeed, try hitting it with a shoe."

texi
Newbie
Posts: 14
Joined: Tue May 30, 2017 3:40 pm
Contact:

Re: How to use transformations on pre-existing windows.

#3 Post by texi »

No, sorry, I meant a window as in the displayable text box. It's not just specific to windows as well, images too.

User avatar
Donmai
Eileen-Class Veteran
Posts: 1962
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: How to use transformations on pre-existing windows.

#4 Post by Donmai »

It isn't easy to understand what you're asking (it seems what you are calling "window" is, in fact, a screen). Anyway, to apply a transform to a menu screen, you just need to define the transform first, as Evildumdum explained. For example:

Code: Select all

    transform rising:
        subpixel True
        alpha 0.0 yoffset 500
        parallel:
            ease 0.6 alpha 1.0
        parallel:
            ease 0.6 yoffset 0
        yoffset 0 alpha 1.0
Then, for example, to show the preferences screen with that transform, you just edit the preferences screen in screens.rpy:

Code: Select all

screen preferences():

    tag menu

    if renpy.mobile:
        $ cols = 2
    else:
        $ cols = 4

    use game_menu(_("Preferences"), scroll="viewport"):

        vbox:
            at rising # here, I changed 'with dissolve' to 'at rising'
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

User avatar
Milkymalk
Miko-Class Veteran
Posts: 762
Joined: Wed Nov 23, 2011 5:30 pm
Completed: Don't Look (AGS game)
Projects: KANPEKI! ★Perfect Play★
Organization: Crappy White Wings
Location: Germany
Contact:

Re: How to use transformations on pre-existing windows.

#5 Post by Milkymalk »

I think the question is how to apply transforms to the screen when a button on it is pressed. As in, the screen is already shown and is waiting for input.
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

Post Reply

Who is online

Users browsing this forum: No registered users