How to make drag and drop application

Get help using Construct 2

Post » Fri Dec 16, 2011 3:14 pm

I am new to construct 2, trying to make a application to match boxes as per given layout. For this I want to use drag and drop functionality to match the block.
Can any body help me ?

Thanks in advance
Kiran
B
3
G
1
Posts: 7
Reputation: 516

Post » Fri Dec 16, 2011 6:59 pm

Well,first,make the object you want to drag(A rock,for example)then create a number variable named dragged for the rock.

Left Mouse button clicked                  -"Rock"-set "dragged" to 1
"rock" isn't overlapping "rock"            -
-------------------------------
Left mouse button is down                  -"Rock"-set position to "mouse"
"rock" dragged is 1                        -
-------------------------------
On left button released                    -"Rock"-set "dragged" to 0

And there ya go,hope it helped :D
fmaf2011-12-16 19:02:03
B
16
S
5
G
1
Posts: 43
Reputation: 1,787

Post » Fri Dec 16, 2011 8:10 pm

Here is an example I made previously for someone else.

Click Inventory Example

I hope it helps.
Don't see the fnords and they won't eat you!
B
75
S
16
G
12
Posts: 322
Reputation: 11,608

Post » Sat Dec 17, 2011 9:12 am

drag&drop for ya
drag%26drop.capx
Last edited by Yann on Sun Sep 14, 2014 10:39 am, edited 1 time in total.
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Sat Dec 17, 2011 7:11 pm

Here's an example that picks the topmost object under the mouse and move it on top of the others when dragged. I thinks this makes it a more intuitive behavior.

ExampleAnimmaniac2011-12-17 19:14:32
Scirra Employee
B
129
S
45
G
15
Posts: 705
Reputation: 15,413

Post » Sat Dec 17, 2011 8:04 pm

Yeah anim I saw rojo post a capx on emulating a "pick top most" behavior but I was too lazy to implement it :D... my capx is an old one I made like a month and half ago.Yann2011-12-17 20:04:24
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Sun Dec 18, 2011 12:05 am

@animmaniac, nice example. I will start using your method instead.
Don't see the fnords and they won't eat you!
B
75
S
16
G
12
Posts: 322
Reputation: 11,608

Post » Wed Dec 21, 2011 6:41 am

Thanks to all of your contribution, given examples helps me lot.
B
3
G
1
Posts: 7
Reputation: 516

Post » Thu Dec 29, 2011 1:30 pm

It helped, thanks!!

But when I click CTRL +A and then try to drag the objects, its drag the complete background. It is only worked proper when I refresh the html page.
B
9
S
2
G
4
Posts: 23
Reputation: 2,766

Post » Sat Feb 04, 2012 5:23 pm

Very useful... I will use the example of @Yann =)
B
203
S
37
G
13
Posts: 136
Reputation: 29,523

Next

Return to How do I....?

Who is online

Users browsing this forum: Paradox and 2 guests