auto snap object to object

Get help using Construct 2

Post » Tue Nov 27, 2012 5:59 pm

how do i something like that: when i drag and drop object A to another object B, this object A is automatically attracted to the object B. But is a few condictions: A object must be in this same angle as object B and must be mirrored or flipped as object B

As a result, both objects should match each other.delgado2012-11-29 13:57:50
B
93
S
19
G
34
Posts: 1,840
Reputation: 27,963

Post » Wed Nov 28, 2012 11:24 pm

bump.
B
93
S
19
G
34
Posts: 1,840
Reputation: 27,963

Post » Thu Nov 29, 2012 12:11 am

Is this what you're looking for?
B
40
S
12
G
7
Posts: 603
Reputation: 7,646

Post » Thu Nov 29, 2012 1:49 pm

@EncryptedCow thanks for your time but its not all, i show you what i think

https://dl.dropbox.com/u/44710358/snap.jpgdelgado2012-11-29 13:51:53
B
93
S
19
G
34
Posts: 1,840
Reputation: 27,963

Post » Thu Nov 29, 2012 2:35 pm

Compare the angles.

If
ObjectA.Angle == ObjectB.Angle
and
Distance(ObjectA.X, ObjectA.Y, ObjectB.X, ObjectB.Y) < snapdistance
then
Set position of ObjectA to ObjectB

This doesn't take into account flipping. If you want that, throw negative width and height detection into the mix.

If you'd like an example post a .capx. Kudos for the descriptive diagram.
Moderator
B
72
S
13
G
11
Posts: 900
Reputation: 11,783

Post » Thu Nov 29, 2012 2:37 pm

Fixed it. Use Left/Right arrows to change it between mirrored and not mirrored.

@thehen
That's a really complicated way to do it. First, you can simply invert 'Is Flipped' You can also use ObjectA is overlapping ObjectB to know when to snap. EncryptedCow2012-11-29 14:48:18
B
40
S
12
G
7
Posts: 603
Reputation: 7,646

Post » Thu Nov 29, 2012 3:09 pm

@EncryptedCow wow i change angle of BoxB and boxA didnt want snap :)
i will test this few times and tell u hows going:)delgado2012-11-29 15:14:25
B
93
S
19
G
34
Posts: 1,840
Reputation: 27,963


Return to How do I....?

Who is online

Users browsing this forum: Pandadoor, Sotir31 and 28 guests