how do a drag and drop event like this

Get help using Construct 2

Post » Thu Sep 05, 2013 6:05 am

How can i make a dragable object? For example i have draggable objects to choose from. 1, 2and 3. When i drag 1 the the object 1 creates another similar object. Then it can only be dropped at a certain location. If not the object disappears.

Thanks in adance
B
1
Posts: 6
Reputation: 137

Post » Thu Sep 05, 2013 7:21 am

Something like this?

https://www.dropbox.com/s/32t3o7690ithgvy/dragdropEvent.capx
B
17
S
8
G
4
Posts: 93
Reputation: 3,190

Post » Thu Sep 05, 2013 7:35 am

exactly thanks by the way :)

i got the logic now thanks man your a life saver
B
1
Posts: 6
Reputation: 137

Post » Thu Sep 05, 2013 8:13 am

can i ask what is the sprite.uid. sprite2.uid, sprite3.uid and the variable picked uid. cant understand those. are those boolean variables that are set to 1 when the user click the object?

thanks for answering
B
1
Posts: 6
Reputation: 137

Post » Thu Sep 05, 2013 8:40 am

In construct 2, any object created is tag with a Unique ID(UID). I use the variable PickedUID to store the selected sprite(when clicked) so when mouse onButtonReleased, I use PickedUID to get the last selected(Dragging) sprite and destroy if neccessary.c4sp3r892013-09-05 08:48:34
B
17
S
8
G
4
Posts: 93
Reputation: 3,190

Post » Thu Sep 05, 2013 9:04 am

so PickedUID is used to store the unique id of the object currently drag. and this is used so know what action should be done when the left click is released am i right?

thanks dude :)
B
1
Posts: 6
Reputation: 137

Post » Thu Sep 05, 2013 9:07 am

Yup. No problem.
B
17
S
8
G
4
Posts: 93
Reputation: 3,190

Post » Thu Sep 05, 2013 9:20 am

so what if it is not a line but a box instead how do i compare the x and y of a box sprite at the same time?
B
1
Posts: 6
Reputation: 137

Post » Thu Sep 05, 2013 9:35 am

If you want the object to 'drop' in the box you can use sprite->Check if overlapping object(box), if yes, destroy the sprite.
If you want to check x and y together then just add another condition Sprite Compare X < or > box.x with the Sprite Compare Y
B
17
S
8
G
4
Posts: 93
Reputation: 3,190


Return to How do I....?

Who is online

Users browsing this forum: ST314, Yahoo [Bot] and 30 guests