[SOLVED]Using drag on a button?

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
Fynmorph
Newbie
Posts: 4
Joined: Fri May 14, 2021 5:54 pm
Contact:

[SOLVED]Using drag on a button?

#1 Post by Fynmorph »

Hi, how can you make a button draggable while their action is triggerable?

Code: Select all

        drag:
            xalign 0.5 yalign 0.5
            button:
                background '#0ff'
                maximum (150,150)
                action SetVariable("currentFamily", "dd")
                text str(currentFamily) color '#000'
                $ osef = main_centre[-1][card_hover_c] if len(main_centre)>0 and card_hover_c!=-1 else "bite"
                text str(osef) ypos 50 color '#000'
Right now if I do this the button works but the dragging doesn't.
If I comment the Action line, the button doesn't work anymore (obviously) and the dragging works again.

Any way to circumvent that?
Last edited by Fynmorph on Fri Jun 25, 2021 9:35 am, edited 1 time in total.

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

Re: Using drag on a button?

#2 Post by Alex »

Fynmorph wrote: Wed Jun 23, 2021 11:30 am Hi, how can you make a button draggable while their action is triggerable? ...
Try to add some not clickable space to drag the button, like put the button inside a fixed or a frame that is bigger than the button.

Code: Select all

        drag:
            xalign 0.5 yalign 0.5
            frame:
                xysize(150, 200)
                button:
                    background '#0ff'
                    maximum (150,150)
                    action SetVariable("currentFamily", "dd")
                    text str(currentFamily) color '#000'
                    $ osef = main_centre[-1][card_hover_c] if len(main_centre)>0 and card_hover_c!=-1 else "bite"
                    text str(osef) ypos 50 color '#000'

Fynmorph
Newbie
Posts: 4
Joined: Fri May 14, 2021 5:54 pm
Contact:

Re: Using drag on a button?

#3 Post by Fynmorph »

True, could work for my case, thanks!

Post Reply

Who is online

Users browsing this forum: Imperf3kt