Ren'Py transform on idle dependant on an if check

ShaddyGames

Engaged Member
Modder
Donor
Game Developer
Jan 19, 2020
2,393
11,978
Hey, I'm trying to find a way to to have the on idle part of transform dependant on whether a variable is set True or False. Here's an example of what i tried but obviously didn't work. I am using renpy 8.0.3. I know i can put the check on the imagebutton itself with separate idle's, but i'd rather not have to do that.

Code:
transform btn_glow:
    on idle:
        if persistent.glow:
            block:
                alpha 0.0
                linear 1.3 alpha 1.0
                linear 1.3 alpha 0.0
                pause 1.0
                repeat
        else:
            alpha 1.0
    on hover:
        alpha 1.0
Nevermind. I figured it out. In case anyone wants to do something similar here's how I got it working. Although I'm sure there's a cleaner way of doing it.

Code:
transform btn_glow:
    on idle:
        block:
            alpha 0.0
            linear 1.3 alpha (1.0 if persistent.glow else 0.0)
            linear 1.3 alpha 0.0
            pause 1.0
            repeat
    on hover:
        alpha 1.0
 
Last edited: