no offset drag and drop

Forum Home Forum Home > Construct 2 General > Your Creations
 Post Reply Post Reply Page  12>
Author
16,524 Rep
Post Options Post Options   Quote newt Quote  Post ReplyReply Direct Link To This Post Topic: no offset drag and drop
    Posted: 03 Jan 2012 at 6:45pm
The usual method of set x,y to mouse x,y, always moves the object to its hotspot.
This method gets the offset from the hotspot, or basically gets the relative coordinate from where you clicked, and moves it there.
Ie click a corner, drag that corner, not drag from the hotspot.

Demo here:
no offset drag and drop
Back to Top
6,828 Rep
Post Options Post Options   Quote zenox98 Quote  Post ReplyReply Direct Link To This Post Posted: 03 Jan 2012 at 6:52pm
Nice :)

Thanks, newt.
Spec:
OS: Windows 7 SP1 64bit, Intel I7-2600 3.4 GHz, Memory: 8 GB, Gfx: GeForce 560TI DirectCUII.
Back to Top

Scirra Developer
78,586 Rep
Post Options Post Options   Quote Ashley Quote  Post ReplyReply Direct Link To This Post Posted: 03 Jan 2012 at 7:59pm
Nice example. You can also do it by delta-x and delta-y rather than distance/angle, but I guess it works the same.

FWIW I was going to add an official drag+drop behavior at some point which also supports touch.
Back to Top
16,524 Rep
Post Options Post Options   Quote newt Quote  Post ReplyReply Direct Link To This Post Posted: 03 Jan 2012 at 8:31pm
Thanks.

Cool, planning on a major upgrade soon with touch screen monitor, so definitely looking forward to that Ashley.
Back to Top
3,438 Rep
Post Options Post Options   Quote Geo Quote  Post ReplyReply Direct Link To This Post Posted: 04 Jan 2012 at 6:35am
Originally posted by Ashley Ashley wrote:

FWIW I was going to add an official drag+drop behavior at some point which also supports touch.


By the way, is there an official roadmap or todo list somewhere? I can't find it. Just so we know what to expect in the not-so-distant future :)

Thanks.
Back to Top
947 Rep
Post Options Post Options   Quote 2Bdigital Quote  Post ReplyReply Direct Link To This Post Posted: 26 Jan 2012 at 2:04pm
Hi newt,

Could this be used for touch functions aswell?

If so, how would you achieve this...
Back to Top
16,524 Rep
Post Options Post Options   Quote newt Quote  Post ReplyReply Direct Link To This Post Posted: 26 Jan 2012 at 2:30pm
Just add the touch object, and switch out mouse.x, mouse.y, for touch.x, touch.y, and the relative conditions.

drag and drop touch

Note you will need the mouse object for preview, haven't tested on export.
Back to Top
947 Rep
Post Options Post Options   Quote 2Bdigital Quote  Post ReplyReply Direct Link To This Post Posted: 26 Jan 2012 at 3:06pm
Cheers man! Ill test it!
Back to Top
947 Rep
Post Options Post Options   Quote 2Bdigital Quote  Post ReplyReply Direct Link To This Post Posted: 26 Jan 2012 at 3:11pm
It works perfect,

If I just wanted to use X positions for drag and drop how would I achieve this?

At the moment it requires 4 parameters. What value do I use?

Edited by 2Bdigital - 26 Jan 2012 at 3:11pm
Back to Top
16,524 Rep
Post Options Post Options   Quote newt Quote  Post ReplyReply Direct Link To This Post Posted: 26 Jan 2012 at 3:20pm
Not sure what you mean, Im guessing, just delete the y's.
Back to Top
 Post Reply Post Reply Page  12>

Forum Jump Forum Permissions View Drop Down