9-Patch Collision?

0 favourites
  • 3 posts
  • Hi All,

    On my growing project I have floating panels for the GUI, since it's easier for me to design I used 9-patch (and I love it!) instead of redesign the panels manually.

    But I want them to STOP when collide with each other.

    The only idea I had is to create an invisible sprite with the same size of the panel, Pin it to each panel and code the Sprite collision... but I don't like this idea very much.

    Is there a way to do a collision for the panels using the 9-patch or it will be just easier with the way I just mentioned?

    The shorter/efficient code, the better. Thanks ahead! :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Use BBoxLeft, BBoxRight, BBoxTop, BBoxBottom expressions to position your panels.

    "On collision" event is a bad choice here anyway, because collision checks are performed every tick and objects can travel big distances in one tick if the speed is high or FPS is low. So, for example if you are dragging a panel and want to stop when it collides with another panel, if you move your mouse too fast, you can easily drag it 100-200px too far.

  • Thanks for the explanation!

    Use BBoxLeft, BBoxRight, BBoxTop, BBoxBottom expressions to position your panels.

    I think that's how I stopped the panels from getting out of the viewport, I'll give it a try!

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