0 Favourites

Make it so collisions don't count edge to edge?

  • Is there a way to make the collisions exclude edge to edge cases?

    If I have a two boxes that are 16x16 and put them diagonally to each other and check if overlap at offset y+1, it will say they overlap even though they don't overlap.

  • You can make you own collision polygones. Double click to sprite to acces the image editor. The polygones editor is the last icon in the tools bar. Right click in the graphic field to have more actions.

  • The issue isn't with editing the polygons- I know how to do that. I'm trying to figure a simple way so that edge to edge cases aren't included in the overlapping regardless of polygon shape.

  • Apart from shrinking the collision polygon you pretty much need to make your own collision detection.

    This is really only relevant for boxes though. If you're using a grid you can use an array to lookup collisions. Also you could do manual collision detection with integer positions. I've used that before for a retro platformer where I wanted the player to fit perfectly in passages his same size.

    The sizes needed to be even, or as long as the the edges of the sprite were on integer positions you could test for a collision with:

    bbright > wall.bbleft

    bbleft < wall.bbright

    bbbottom > wall.bbtop

    bbtop < wall.bbbotom

    and then objects right next to each other won't count as overlapping.

    Apart from that I've done stuff like

    set size of everything a little smaler

    check for collisions

    put the sizes back to normal

    or

    if the hotspots are centered you could do a compare right after the overlap condition.

    abs(sprite.x-wall.x) < (wall.width+sprite.width)/2

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • This thing goes round and round, and is never detecting any overlap. Yet it collides like the birds on my windows.

    https://

    drive.google.com/open?id=0B1SSuCVV8v74T0hPRjVRTU5vUVk

    I apology for taking you for beginner. Now it is your turn, treat as the beginner (that i am).

    Explain the context where it is a problem ? Plz.

  • 99Instances2Go , you're using rescaled objects, which seems to get checked differently. If you use objects scaled to their origin size, they would overlap on the edges.

    R0J0hound, thanks.. I've gone with one of those options since everything is block shaped and aligned to grids. The sprites extend further than the polygons, so bboundleft, etc, don't correspond to the polygon collision area. So I have to calculate from center of the objects.. It's working how I want it now.

    Would be useful to have a choice of edge cases by default though in construct2.

  • Same with a 'non scaled' object.

    https://

    drive.google.com/open?id=0B1SSuCVV8v74YUdleURpNVNKZWM

  • 99Instances2Go you're still using scaled sprites. The pink sprites are not original size you have them 270x270 when they are actually 250x250.

  • Its behaves fine with a tilemap too.

    https://

    drive.google.com/open?id=0B1SSuCVV8v74QXk3RnRmLVpEZXc

    Not that i am happy with the movement, but this is only a simple bullet behaviour riding arround that maze.

  • 99Instances2Go your tilemap polygon isn't completely to the edge. So you're not seeing the problem I am seeing.

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