[SOLVED] Animate variables when they are updated?

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.
Message
Author
OrsonDeWitt
Regular
Posts: 35
Joined: Thu Dec 06, 2018 3:23 am
Contact:

Re: Animate variables when they are updated?

#16 Post by OrsonDeWitt » Fri Nov 20, 2020 4:47 pm

hell_oh_world wrote:
Fri Nov 20, 2020 1:21 pm
Alternatively, you can just do this, short but a neat trick, passing variables around atl makes them dynamic on each interaction restart.

Code: Select all

transform animation_update(var): # make an argument where we can receive the variable.
    alpha 0.0
    easein 0.25 alpha 1.0

default var = 1

screen something():
    vbox:
        align (0.5, 0.25)
        
        textbutton "increment" action SetVariable("var", var + 1) align (0.5, 0.5)
        
        text str(var):
            at animation_update(var) # then just pass the var for no reason...
            
Thanks for help! It is very neat and works great! Thanks for taking your time to answer, you've been very helpful :)

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]