[SOLVED] Apply a transform through a screen action?

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
Tess
Regular
Posts: 59
Joined: Thu Aug 04, 2022 3:43 pm
Projects: The Songbird Guild
Organization: Yurisoft
Github: wainwt2
Discord: Tess#7782
Contact:

[SOLVED] Apply a transform through a screen action?

#1 Post by Tess »

So in a label, you can use show...at... to apply a transform to a sprite. Is it possible to do something similar on a custom screen? I have a lot of complex movements that are triggered by one displayable but apply to many, so I'm often looking for ways to trigger ATL outside of the standard external events.

Code: Select all

transform move_to_center(duration=1.0):
    ease duration xpos 0.5

screen test_screen():
    add "images/Ball.png"
    textbutton "Move Ball to Center" action #Apply move_to_center to the ball somehow?
    
label start:
    call screen test_screen
Last edited by Tess on Sat Sep 17, 2022 5:41 pm, edited 1 time in total.

enaielei
Veteran
Posts: 293
Joined: Fri Sep 17, 2021 2:09 am
Organization: enaielei
Tumblr: enaielei
Deviantart: enaielei
Github: enaielei
Skype: enaielei
Soundcloud: enaielei
itch: enaielei
Discord: enaielei#7487
Contact:

Re: Apply a transform through a screen action?

#2 Post by enaielei »

Use variables.

Code: Select all

transform move_to_center(duration=1.0):
    ease duration xpos 0.5

screen test_screen():
    default move = None
    add "images/Ball.png" at move
    textbutton "Move Ball to Center" action SetScreenVariable("move", move_to_center)
    
label start:
    call screen test_screen

User avatar
Tess
Regular
Posts: 59
Joined: Thu Aug 04, 2022 3:43 pm
Projects: The Songbird Guild
Organization: Yurisoft
Github: wainwt2
Discord: Tess#7782
Contact:

Re: Apply a transform through a screen action?

#3 Post by Tess »

That's so cool! Thank you so much!!

Post Reply

Who is online

Users browsing this forum: DewyNebula, Ocelot, piinkpuddiin