[Solved] Drag/drop object? How do I establish the area limit here?

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
User avatar
Nanahs
Veteran
Posts: 310
Joined: Wed Aug 22, 2018 5:50 pm
Contact:

[Solved] Drag/drop object? How do I establish the area limit here?

#1 Post by Nanahs »

I'm using a drag/drop code. It works great, and it's quite simple.

Code: Select all

screen drag:
    zorder 50

    draggroup:
        drag:
            drag_name "tree"
            draggable True
            xpos -60 ypos 10            
            add "drop.png"


label start:

    scene b
    
    call screen drag
The thing is, I wanted to allow the object to exceed the screen limit a little.

Like this:
Image

The tree leaves are "outside" of the screen limit, cause I used the "xpos -60".
The problem is that after I move the tree for the first time, I can only move it inside the screen limits.

Is there a way I can can create a "limit outside the screen" to where it can be dragged?
Like, establish something inside of a "(0, 0, 0, 0)". Each number would be the drag limit of right/left/top/bottom corner.

Thanks. Happy holidays everyone!!!
Last edited by Nanahs on Wed Dec 26, 2018 1:15 pm, edited 2 times in total.

User avatar
Nanahs
Veteran
Posts: 310
Joined: Wed Aug 22, 2018 5:50 pm
Contact:

Re: Drag/drop object? How do I establish the area limit here?

#2 Post by Nanahs »

Oh, nevermind! I discovered the solution. I changed the code to this:

Code: Select all

screen drag:
    zorder 50

    draggroup:
        drag:
            drag_name "tree"
            drag_offscreen True
            xpos -60 ypos 10            
            add "drop.png"


label start:

    scene b
    
    call screen drag
Now it's working :)

Post Reply

Who is online

Users browsing this forum: No registered users