[Solved] Can you put an ATL transform on a bar?

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
floweringOrchid
Newbie
Posts: 14
Joined: Thu Oct 26, 2023 5:39 pm
Contact:

[Solved] Can you put an ATL transform on a bar?

#1 Post by floweringOrchid »

Hi! I'm trying to create a bar within a screen and want it to move/animate on an ATL transform.
For example, I'd like this:

Code: Select all

bar value AnimatedValue(charFriendship, range = 10) xalign 0.5 yalign 0.5:
            top_bar "gui/bar/friendshipBar_empty.png"
            bottom_bar "gui/bar/friendshipBar_filled.png"
            thumb "gui/bar/friendshipBar_thumb.png"
            thumb_offset 10
to act like when this imagebutton moves with a transform at the end:

Code: Select all

imagebutton auto "gui/buttonInteract_%s.png" action [Jump('test')] xalign 0.5 yalign 0.5 at object_float
I've tried looking around for language that could help me in this and haven't found anything. Is there a way I can go about moving a bar on the screen?
Last edited by floweringOrchid on Sat Oct 28, 2023 6:07 pm, edited 2 times in total.

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3794
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: Can you put an ATL transform on a bar?

#2 Post by Imperf3kt »

I believe you'll need to use a CDD, creator defined displayable.
I don't have any experience using these, so cannot help more than this, sorry.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

User avatar
Alex
Lemma-Class Veteran
Posts: 3094
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Can you put an ATL transform on a bar?

#3 Post by Alex »

floweringOrchid wrote: Fri Oct 27, 2023 10:38 pm ... Is there a way I can go about moving a bar on the screen?
Just use transform as you did for imagebutton. Try

Code: Select all

transform bar_transform(t=0.5):
    0.5
    parallel:
        linear t * (config.screen_width / config.screen_height) xalign 1.0
        linear t * (config.screen_width / config.screen_height) xalign 0.0
        repeat
    parallel:
        linear t * (config.screen_height / config.screen_width) yalign 0.0
        linear t * (config.screen_height / config.screen_width) yalign 1.0
        repeat

screen test_bar():
    modal True
    default bar_value = 0
    # mousewheel will change bar value
    key 'mousedown_4' action SetScreenVariable('bar_value', min(20, bar_value + 1))
    key 'mousedown_5' action SetScreenVariable('bar_value', max(0, bar_value - 1))
    key 'mousedown_1' action Hide('test_bar')

    bar value bar_value range 20:
        xsize 200
        align (0.5, 0.5)
        at bar_transform(5.0)

    text "Click to continue" align (0.5, 0.05)

label start:
    "..."
    show screen test_bar
    "?!"
    "done"

floweringOrchid
Newbie
Posts: 14
Joined: Thu Oct 26, 2023 5:39 pm
Contact:

Re: Can you put an ATL transform on a bar?

#4 Post by floweringOrchid »

Alex wrote: Sat Oct 28, 2023 4:47 pm
Just use transform as you did for imagebutton. Try

Code: Select all

transform bar_transform(t=0.5):
    0.5
    parallel:
        linear t * (config.screen_width / config.screen_height) xalign 1.0
        linear t * (config.screen_width / config.screen_height) xalign 0.0
        repeat
    parallel:
        linear t * (config.screen_height / config.screen_width) yalign 0.0
        linear t * (config.screen_height / config.screen_width) yalign 1.0
        repeat
Thank you so much, this worked! I will definitely need to keep researching the language more too, as I'm a little confused as to why the usual ATL didn't work with it.

floweringOrchid
Newbie
Posts: 14
Joined: Thu Oct 26, 2023 5:39 pm
Contact:

Re: Can you put an ATL transform on a bar?

#5 Post by floweringOrchid »

Imperf3kt wrote: Sat Oct 28, 2023 12:25 am I believe you'll need to use a CDD, creator defined displayable.
I don't have any experience using these, so cannot help more than this, sorry.
Thanks for your reply as well! I didn't know this was a thing, so I'll have to look into this too :)

Post Reply

Who is online

Users browsing this forum: No registered users