Gradual speed change in image animation and sync

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
ze4non
Newbie
Posts: 1
Joined: Tue Jan 02, 2024 12:09 pm
Contact:

Gradual speed change in image animation and sync

#1 Post by ze4non »

Hello, I hope someone can help me with this.
I don't know anything about python, I'm just guided by the codes they provide here in the forum.
I have applied this code of gradual change in the animation speed of a half body jumping.
And I want to modify the outfit and hair, but when I add them to the screen the images are not synchronized.

viewtopic.php?t=60827

Code: Select all

init:
    $ hair = False
    $ clothes = False

    #################################3
    image Fidget base:
        function var_speed_base #
    image Fidget hair:
        function var_speed_hair #
    image Fidget clothes:
        function var_speed_clothes #
    default frame_num = 1
    default anim_speed = 0.3

# The game starts here.
init python:
    def var_speed_base(trans, st, at): #### BASE BODY
        trans.set_child("images/px/body_{}.png".format(store.frame_num))
        store.frame_num +=1
        if store.frame_num > 14:
            store.frame_num = 1
        return store.anim_speed
    def var_speed_hair(trans, st, at): #### HAIR
        trans.set_child("images/px/hair_{}.png".format(store.frame_num))
        store.frame_num +=1
        if store.frame_num > 14:
            store.frame_num = 1
        return store.anim_speed
    def var_speed_clothes(trans, st, at): #### CLOTHES
        trans.set_child("images/px/clothes02_{}.png".format(store.frame_num))
        store.frame_num +=1
        if store.frame_num > 14:
            store.frame_num = 1
        return store.anim_speed
label start:

    call screen custom


    return

#############################################SCREENS
screen c_velocidad:

    vbar:
         value VariableValue("anim_speed", 0.3, max_is_zero=False)
         xsize 50
         ysize 500
         yalign 0.5
         bar_invert True

screen menu_custom:
    tag menu
    zorder 100
    frame:
        vbox:
         textbutton "HAIR":
             if hair == True:
                 action SetVariable("hair", False)
             else:
                 action SetVariable("hair", True)
         textbutton "CLOTHES":
              if clothes == True:
                  action SetVariable("clothes", False)
              else:
                  action SetVariable("clothes", True)
    use c_velocidad

screen custom:
    add "Fidget base"
    if hair:
        add "Fidget hair"
    if clothes:
        add "Fidget clothes"
    use menu_custom
I wonder if there is a way for the overlay animations to sync with the bodybase one.
Here I leave the "Test"
https://drive.google.com/file/d/1aXz4fW ... drive_link
And thanks in advance to whoever can help.
Attachments
Test_SyncAndSpeed-1.0-pc.zip
(37.24 MiB) Downloaded 136 times

Post Reply

Who is online

Users browsing this forum: Majestic-12 [Bot]