How do I create shape and position detection

Get help using Construct 2

Post » Tue Sep 01, 2015 3:53 am

I want the shapes to only snap to the bgshape if their position and angleis the same. Image and Image
B
10
S
1
Posts: 93
Reputation: 722

Post » Tue Sep 01, 2015 6:45 am

When testing overlapping add condition:

System -> Compare two values -> Lshape.Angle = LshapeInBg.Angle

Also a foreach might be needed for Lshape :-)
B
10
S
2
G
1
Posts: 51
Reputation: 761

Post » Wed Sep 02, 2015 12:02 am

How to use For Each command @Borgi
B
10
S
1
Posts: 93
Reputation: 722

Post » Wed Sep 02, 2015 12:16 am

I've managed to get for each command work @Borgi
Last edited by garyrossiter on Wed Sep 02, 2015 12:28 am, edited 1 time in total.
B
10
S
1
Posts: 93
Reputation: 722

Post » Wed Sep 02, 2015 12:26 am

When i change the angle of LshapeinBg the Lshape stops to set its position on Lshapeinbg and some times both LshapeinBG gets destroy when there should be only one getting destroy Image
B
10
S
1
Posts: 93
Reputation: 722

Post » Wed Sep 02, 2015 1:51 pm

The overlapping with offset condition may be true for more than one Lshape, that's why more of them getting destroyed. You should pick the one LshapeinBg which is the closes to Lshare. There is a "Pick nearest/furthest" in system.

How did you changed the angle of LshapeinBG? If you set it precisely ->set it to a number and you dont rotate them in the layout editor, it should work.

And I think as the way you did this, you do not need the "for each" loop.

Can you share capx?

keep up the good work :)
B
10
S
2
G
1
Posts: 51
Reputation: 761

Post » Mon Sep 07, 2015 2:20 am

@borgi I can email you the capx if you want scirra isn't letting me attach it here
B
10
S
1
Posts: 93
Reputation: 722

Post » Mon Sep 07, 2015 8:25 am

Send a link in PM, if you can not let me know I will send you my email in PM
B
10
S
2
G
1
Posts: 51
Reputation: 761

Post » Tue Sep 08, 2015 3:06 am

@borgi can't send Pm
B
10
S
1
Posts: 93
Reputation: 722

Post » Tue Sep 08, 2015 9:31 pm

The Angles you set from the editor might not be that accurate values. As I could check it in debugger, the lower LBGShape was like 90.000000SOMETHING degrees. Try checking if the angles are equal with abs(Lshape.Angle - LshapeInBg.Angle) < 0.1
And I find that checking with overlapping with that huge offset is too much. I would not use that, because it usually 2 of the LBGShapes are picked. I would suggest you to use simple overlap instead. But I think the main problem was the angles, you can figure the rest out!

Good luck!
B
10
S
2
G
1
Posts: 51
Reputation: 761

Next

Return to How do I....?

Who is online

Users browsing this forum: stevenode, Yahoo [Bot] and 8 guests