How do I create shape and position detection

  • I want the shapes to only snap to the bgshape if their position and angleis the same.

    and

  • When testing overlapping add condition:

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

    Also a foreach might be needed for Lshape

  • How to use For Each command Borgi

  • I've managed to get for each command work Borgi

  • 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

  • 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

  • Borgi I can email you the capx if you want scirra isn't letting me attach it here

  • Send a link in PM, if you can not let me know I will send you my email in PM

  • Borgi can't send 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!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Or you can also you can compare the angles after you round them, that sounds a lot more simple.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)