imagebutton transform looping

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
diderdrogba
Newbie
Posts: 3
Joined: Tue Jul 11, 2023 11:15 pm
Contact:

imagebutton transform looping

#1 Post by diderdrogba »

What I want is for the image of the orbs to show with the transform Bezier, then when hovering over them, they'll disappear with another transform.
The issue here is that the transform animation keeps playing infinitely, it doesn't even wait for the transform to end before a new one starts again. I want the screen to happen only one time until it is called again.
And to call the label orbs, it needs to meet a condition, but even when the condition isn't met, the animation still keeps playing over and over.

Code: Select all

label orbs :
    show screen orbs 
    call screen attack

screen orbs:
    fixed:
        for i in range(1, 10):
            $ start_x, start_y, end_x, end_y, ctrl_1_x, ctrl_1_y, ctrl_2_x, ctrl_2_y, duration = display_and_move_orbs(monster.level)
            $ orb_id = "blue_orb_" + str(i)
            imagebutton:
                focus_mask True
                idle (orb_id) 
                hover (orb_id)
                at bezier_arc((start_x, start_y), (end_x, end_y), (ctrl_1_x, ctrl_1_y), (ctrl_2_x, ctrl_2_y), duration)
                action NullAction()


transform bezier_arc(start, end, ctrl_1, ctrl_2, duration):
    on idle :
        zoom 0.15
        alpha 0
        subpixel True
        pos start
        linear duration pos end knot ctrl_1 knot ctrl_2 alpha 1
        block:
            ease 1 yoffset +5 
            ease 1 yoffset -5
            repeat
    on hover : 
        zoom 0.2
        alpha 1.0 matrixcolor TintMatrix("#f91307ff")
        linear 0.2 xpos 100 ypos 100 alpha 0

jeffster
Veteran
Posts: 437
Joined: Wed Feb 03, 2021 9:55 pm
Contact:

Re: imagebutton transform looping

#2 Post by jeffster »

diderdrogba wrote: Wed May 08, 2024 5:27 am What I want is for the image of the orbs to show with the transform Bezier, then when hovering over them, they'll disappear with another transform.
The issue here is that the transform animation keeps playing infinitely, it doesn't even wait for the transform to end before a new one starts again. I want the screen to happen only one time until it is called again.
And to call the label orbs, it needs to meet a condition, but even when the condition isn't met, the animation still keeps playing over and over.

Code: Select all

label orbs :
    show screen orbs 
    call screen attack

screen orbs:
    fixed:
        for i in range(1, 10):
            $ start_x, start_y, end_x, end_y, ctrl_1_x, ctrl_1_y, ctrl_2_x, ctrl_2_y, duration = display_and_move_orbs(monster.level)
            $ orb_id = "blue_orb_" + str(i)
            imagebutton:
                focus_mask True
                idle (orb_id) 
                hover (orb_id)
                at bezier_arc((start_x, start_y), (end_x, end_y), (ctrl_1_x, ctrl_1_y), (ctrl_2_x, ctrl_2_y), duration)
                action NullAction()


transform bezier_arc(start, end, ctrl_1, ctrl_2, duration):
    on idle :
        zoom 0.15
        alpha 0
        subpixel True
        pos start
        linear duration pos end knot ctrl_1 knot ctrl_2 alpha 1
        block:
            ease 1 yoffset +5 
            ease 1 yoffset -5
            repeat
    on hover : 
        zoom 0.2
        alpha 1.0 matrixcolor TintMatrix("#f91307ff")
        linear 0.2 xpos 100 ypos 100 alpha 0
There's "repeat" in the transform, so it will repeat
https://renpy.org/doc/html/atl.html#repeat-statement

You can limit the amount of repetitions with repeat 2 and the like, instead of just repeat.
If the problem is solved, please edit the original post and add [SOLVED] to the title. 8)

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]