Transform states in python

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
Shlizer
Newbie
Posts: 7
Joined: Fri Sep 03, 2021 12:47 am
Github: https://github.com/Shlizer
Contact:

Transform states in python

#1 Post by Shlizer »

Hey,
I've got a problem with transforms and I was wandering if you can help with it. Currently I'm passing a transform function to change some states of my buttons, but I'd like to add some life to it, so I was wondering if there is possibility to add like in regular ATL block something like idle or hover states with easing animation? I mean, how can I do this:

Code: Select all

transform some_button():
    on idle:
        easein 0.9 xpos 0
    on hover:
        easein 0.5 xpos -60
Into this:

Code: Select all

transform some_button():
    function test_fn()

init python:
    def test_fn(tf,st,at):
         # how to modify tf object?
         return 0
I know I can calculate it manually, but I'm wondering if there is some out-of-the-box solution and how can I get current state of the element (eg. hovered or selected)? Source code says there's a arguments field in Transform class, that should have those states, but for me it's constantly empty.

Post Reply

Who is online

Users browsing this forum: Zahdernia