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
S
1
G
1
Posts: 7
Reputation: 666

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
17
S
5
G
1
Posts: 45
Reputation: 1,816

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
79
S
17
G
12
Posts: 323
Reputation: 11,850

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
66
S
22
G
14
Posts: 1,484
Reputation: 16,511

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
153
S
53
G
17
Posts: 710
Reputation: 17,825

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
66
S
22
G
14
Posts: 1,484
Reputation: 16,511

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
79
S
17
G
12
Posts: 323
Reputation: 11,850

Post » Wed Dec 21, 2011 6:41 am

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

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: 25
Reputation: 2,780

Post » Sat Feb 04, 2012 5:23 pm

Very useful... I will use the example of @Yann =)
B
212
S
38
G
14
Posts: 136
Reputation: 30,522

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 41 guests