Overlapping true when objects next to each other

  • Overlapping means one object is on top of another. For some reason, when 2 objects are perfectly side by side (such as in a grid), the overlapping condition is true.

    I am using the default calculated bounding box for a 32 x 32 sprite, which contains 0's and 32's in the coordinates. I don't expect a 32 x 32 sprite at 0,0 to be overlapping a 32 x 32 sprite at 32,0

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Try making the collision box 1 pixel smaller then the sprite image.

  • This will work of course, but its hiding an issue, not fixing it.

  • It's not really an issue, as the edges share the same pixel when they touch each other. And besides, some of the games that people make are also relying on this overlapping condition. Hence, just as justifun mentioned just make the collision area smaller or you could actually give buffer spaces using the animation editor to make the sprite height and width larger while keeping the collision area the same so that when you place side be side the buffer space will separate the sprites so that the overlapping conditions would not trigger.

  • This is currently by design. Firstly, changing it could break an enormous number of projects. Secondly, I think it makes sense: two 32x32 objects perfectly next to each other will have the left object's right edge at X = 32, and the right object's left edge at X = 32. So their borders are at the same position, which means they are overlapping.

  • Ashley, I understand why it's happening, I just think that not only is this majorly confusing, it's not ideal as a default.

    I am beyond doubt that changing it would break a whole load of things. It's actually really nice that you can tell if an object is sitting on a platform or not for example without having to sink a detector 1 pixel down, it's just the wording is misleading.

    My suggestion is to add something like "strictly overlapping", i.e. use strict inequalities instead of less than or equal. Add a strict option mitigates for the non-strict behaviour of the default overlapping condition. The boundaries only overlap because there is no convenient way of specifying (object width - smallest floating point delta), and had you been writing a game yourself in javascript you would want to use strict inequalities.

    p.s. I might add, overlapping at offset is brilliant, a strict version would be sweet.

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