no offset drag and drop

Show us your completed creations made in Construct 2

Post » Tue Jan 03, 2012 6:45 pm

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
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Tue Jan 03, 2012 6:52 pm

Nice :)

Thanks, newt.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
120
S
28
G
68
Posts: 4,844
Reputation: 48,289

Post » Tue Jan 03, 2012 7:59 pm

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.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Tue Jan 03, 2012 8:31 pm

Thanks.

Cool, planning on a major upgrade soon with touch screen monitor, so definitely looking forward to that Ashley.
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Wed Jan 04, 2012 6:35 am

[QUOTE=Ashley] FWIW I was going to add an official drag+drop behavior at some point which also supports touch.[/QUOTE]

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.
B
14
S
5
G
7
Posts: 235
Reputation: 5,175

Post » Thu Jan 26, 2012 2:04 pm

Hi newt,

Could this be used for touch functions aswell?

If so, how would you achieve this...
B
5
S
1
G
1
Posts: 111
Reputation: 1,122

Post » Thu Jan 26, 2012 2:30 pm

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.
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Thu Jan 26, 2012 3:06 pm

Cheers man! Ill test it!
B
5
S
1
G
1
Posts: 111
Reputation: 1,122

Post » Thu Jan 26, 2012 3:11 pm

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?2Bdigital2012-01-26 15:11:41
B
5
S
1
G
1
Posts: 111
Reputation: 1,122

Post » Thu Jan 26, 2012 3:20 pm

Not sure what you mean, Im guessing, just delete the y's.
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Next

Return to Completed Creations

Who is online

Users browsing this forum: No registered users and 3 guests