How to make a dragged object stay in the same position?

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
Danah
Newbie
Posts: 20
Joined: Fri Sep 27, 2019 7:38 pm
Contact:

How to make a dragged object stay in the same position?

#1 Post by Danah »

In a drag and drop code:

Code: Select all

screen televisiondg:
    zorder 100

    draggroup:
        drag:
            drag_name "tv"
            drag_offscreen True
            xpos 10 ypos 0
            add television
The person can drag the image of a tv around the screen.
What I wanted is to make the tv stay where the person dropped it (don't restore initial position).

What I am missing in the code?

Thanks.

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

Re: How to make a dragged object stay in the same position?

#2 Post by Alex »

You need to store x and y coordinates of a drag in the variables, and update their values when object been dropped.
Check this thread - viewtopic.php?f=8&t=57041

User avatar
Danah
Newbie
Posts: 20
Joined: Fri Sep 27, 2019 7:38 pm
Contact:

Re: How to make a dragged object stay in the same position?

#3 Post by Danah »

Alex wrote: Tue Oct 08, 2019 8:41 pm You need to store x and y coordinates of a drag in the variables, and update their values when object been dropped.
Check this thread - viewtopic.php?f=8&t=57041
Thank you so much! I'm going to check this :)

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot], Majestic-12 [Bot], zoxell