How do I drag and drop and stick

Get help using Construct 2

Post » Tue Jan 06, 2015 3:16 pm

hello here is example of what i would like to make. You have number 3. You can drag and drop it. There is another number 3 in the layout. and when you drag number 3 on another number 3 it will stick to it. And you will not able to move it again. If you drag numver 5 on nuber 3 it will not stick.
B
11
S
3
G
1
Posts: 419
Reputation: 1,782

Post » Tue Jan 06, 2015 4:19 pm

You can use system:compare values

object = the object that you drag and drop
target = the position in which you want the object to stick
value is determined by how big you want the snap to be

On dropped "object" |
system: compare values: abs("object".x - "target".x) < "value" |
system: compare values: abs("object".y - "target".y) < "value" |set position of "object" to "target".x and "target".y
B
18
S
4
Posts: 87
Reputation: 1,199

Post » Wed Jan 07, 2015 3:13 pm

Thank you , very helpful
B
11
S
3
G
1
Posts: 419
Reputation: 1,782

Post » Thu Jan 08, 2015 3:35 am

My pleasure friend!
B
18
S
4
Posts: 87
Reputation: 1,199


Return to How do I....?

Who is online

Users browsing this forum: rayolf, Yahoo [Bot] and 27 guests