Draggable area limit?

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
nanashine
Regular
Posts: 129
Joined: Thu Nov 30, 2017 1:44 pm
itch: renpytom
Contact:

Draggable area limit?

#1 Post by nanashine »

I'm using this code:

Code: Select all

screen drag:
    zorder 100

    draggroup:
        drag:
            drag_name "pink"
            drag_offscreen True
            xpos 10 ypos 0
            add "flowerpot"
This code allows you to drag "flowerpot" around the screen. It's working fine.

But I wanted to establish a draggable area limit.

For example, in the screen:

Image

I wanted it to only be draggable in the yellow area.

How do I establish a limit in this case?

Thanks.
I can't access my other account cause I don't remember the e-mail I used *cries in emoji*.

User avatar
Kia
Eileen-Class Veteran
Posts: 1040
Joined: Fri Aug 01, 2014 7:49 am
Deviantart: KiaAzad
Discord: Kia#6810
Contact:

Re: Draggable area limit?

#2 Post by Kia »

you can put the drag inside a frame to limit it to the area of that frame. any parent with defined size will be the area that the drag can move inside, right now it's parented to the screen.

nanashine
Regular
Posts: 129
Joined: Thu Nov 30, 2017 1:44 pm
itch: renpytom
Contact:

Re: Draggable area limit?

#3 Post by nanashine »

Kia wrote: Mon Jul 08, 2019 10:31 am you can put the drag inside a frame to limit it to the area of that frame. any parent with defined size will be the area that the drag can move inside, right now it's parented to the screen.
Thank you so much! I'll try it :)
I can't access my other account cause I don't remember the e-mail I used *cries in emoji*.

Post Reply

Who is online

Users browsing this forum: Bing [Bot]