Sliding out and in with imagebutton, while also the sliding out part being not fully hidden when it is mostly in

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
Tow4352
Regular
Posts: 50
Joined: Sat Aug 22, 2020 11:27 am
Contact:

Sliding out and in with imagebutton, while also the sliding out part being not fully hidden when it is mostly in

#1 Post by Tow4352 »

Hey there. I am currently working on a function that lets a tiny bit of that box peak out with the imagebutton. Then the button is pressed, the box moves right and shows its bigger self with contents such as stats. Sadly I only have it right now where the small box can be shown, but when the button is pressed a second one slides out. So, I have two buttons and two boxes switching places at all times. It would be nice if I had one box and one button that slid right and left. Does anyone know how to get that result?

OLD CODE

Code: Select all

transform capture_data:
    on show, replace:
        xalign -1.0
        easein_quint 1.5 xalign 0.0
    on hide, replaced:
        xalign 0.0
        easeout_quint 1.5 xalign -1.0

screen icon1():

    default show_icon1 = False

    showif not show_icon1:
        hbox:
            frame:
                xpos -800
                background "gui/button/iconbox1.png"
                text "Text and stuff."
            imagebutton:
                xpos -500 ypos 350
                focus_mask True
                idle "gui/button/icon_dazzi.png"
                hover Transform ("gui/button/icon_dazzi.png", matrixcolor=BrightnessMatrix(-0.3))
                action ToggleScreenVariable("show_icon1")

    showif show_icon1:
        hbox:
            at capture_data
            box_reverse True
            frame:
                xpos -250
                background "gui/button/iconbox1.png"
                text "Text and stuff."
            imagebutton:
                xpos 800 ypos 350
                focus_mask True
                idle "gui/button/icon_dazzi.png"
                hover Transform ("gui/button/icon_dazzi.png", matrixcolor=BrightnessMatrix(-0.3))
                action ToggleScreenVariable("show_icon1")
Image


EDIT: New code, but sadly not working yet and not sure if this is the best way to do it, so I still need help.

Code: Select all

transform capture_start:
    xalign -1.0
    easein_quint 1.5 xalign 0.0

transform capture_finish:
    xalign 0.0
    easeout_quint 1.5 xalign -1.0

screen icon1():

    default cd = "capture_start"
    default show_icon0 = False

    hbox:
        at cd
        frame:
            xpos -800
            background "gui/button/iconbox1.png"
            text "Text and stuff."
        imagebutton:
            xpos -500 ypos 350
            focus_mask True
            idle "gui/button/icon_dazzi.png"
            hover Transform ("gui/button/icon_dazzi.png", matrixcolor=BrightnessMatrix(-0.3))
            if show_icon0 == False:
                action [SetVariable ("cd", "capture_finish"), SetVariable ("show_icon0", True)]
            else:
                action [SetVariable ("cd", "capture_start"), SetVariable ("show_icon0", False)]

Tow4352
Regular
Posts: 50
Joined: Sat Aug 22, 2020 11:27 am
Contact:

Re: Sliding out and in with imagebutton, while also the sliding out part being not fully hidden when it is mostly in

#2 Post by Tow4352 »

I managed to make it work. So all is good now. ^^

Code: Select all

transform capture_start:
    xalign 0.25
    easein_quint 1.5 xalign 0.0

transform capture_finish:
    xalign 0.0
    easeout_quint 1.5 xalign 0.25

screen icon1():

    default cd = capture_start
    default show_icon0 = False

    hbox:
        at cd
        frame:
            xpos -825
            background "gui/button/iconbox1.png"
            text "Text and stuff."
        imagebutton:
            xpos -500 ypos 350
            focus_mask True
            idle "gui/button/icon_dazzi.png"
            hover Transform ("gui/button/icon_dazzi.png", matrixcolor=BrightnessMatrix(-0.3))
            if show_icon0 == False:
                action [SetScreenVariable ("cd", capture_finish), SetScreenVariable ("show_icon0", True)]
            else:
                action [SetScreenVariable ("cd", capture_start), SetScreenVariable ("show_icon0", False)]

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Majestic-12 [Bot]