How do I keep collision polygons from colliding from very far apart?

0 favourites
  • 11 posts
  • Hi, let me preface by saying I'm not a programmer. I got Construct 3 for my son to make a project, but now I'm having a go.

    I'm making a top down action game about a dog that needs to claim all the territories of each neighborhood by peeing on them. It's 2D pixel art, about an 8-bit resolution, and most things are coming along without too much fuss.

    But I don't think I understand collision polygons very well, and I've watched countless videos and read everything I can find to no avail.

    Most examples I've seen, the creator makes a standard square hero, square enemy, with a collision polygon around the perimeter of the entire sprite, and then use an animated sprite pinned to that to show actual characters. This seems to work fine for them.

    But my character and other solid objects are registering as colliding from seemingly much further away from each other. I keep making the collision polygons smaller and smaller, doing a lot of trial and error to see if they work out.

    There are a lot of other wacky interactions that I suspect are stemming from this, like being able to push other solid characters from certain directions & not others.

    My player character has Solid, Tile Movement,Bound to Layout, and Scroll To behaviors set. Most objects are just Solid. Other characters have Solid, Tile Movement, and Bound to Layout set, but don't have any actions on the event sheet yet.

    Any help understanding this problem is greatly appreciated.

  • Check to make sure the origin point is near the middle of your sprites.

    That is how I would start.

    yours

    winkr7

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I try to keep the origin point right in the center, or in the case of oblong dogs, as near as I can.

  • Are you using a Tilemap to create your layout? I once had a problem where I would "erase" tiles by painting with a fully empty tile, but this actually still puts the collisions there, you need to use the eraser tool instead.

    On the layout properties bar, at the bottom is a check box labeled "Show Collision Polygons". enable this and see if there is perhaps anything out of place / larger than normal.

    Hopefully this helps!

  • I am using a Tilemap, and I tried this out. There was one goofy collision polygon on the map that I disabled, but otherwise I just saw all the tiny little collision boxes hidden in all my sprites.

  • drive.google.com/file/d/1PmaxFilv3j0Hv2OrlO6eyUJ0nIkBJMBn/view

    I don't know that I'm doing this right, or protecting myself at all, but here is a link to the game thus far.

    The event pages are a mess right now, but some of the basic behaviors are where I'm encountering problems, so I haven't gone much further with the NPCs and such.

  • I've messed around a bit with your project, and I'm just as confused as you are. I do have a question though, and maybe a possible fix.

    - Why do things such as the mower and the cat have TileMovement? Are you planning to make them move? Because if not, disabling that behavior fixed the pushing issue for me.

    -One issue with the hitboxes could potentially be because the sprites change size? For example, if you are walking up and then walk right, the size of the player changes and perhaps this is causing some of the strange collisions?

    Sorry if this didn't work. I can try to help some more later.

  • Yeah, the TileMovement on the cat and mower are eventually so they can move about. The Mower guy will sort of pace back and forth on a path, and the cat will walk to the construction site while she's on screen, but stop when she has Line of Sight, eventually giving birth to a bunch of kittens and giving you an achievement for witnessing it.

    I do keep messing with the player's boxes, trying to make them more consistently square-ish. I'll just make a small square and apply it to all her directions and see what that does. I appreciate the help.

  • I made the dog's collision box an 8x8 no matter what she's doing or direction she's facing and made sure the origin point was always at the same spot, and it did eliminate some of the stranger interactions I was having. It stopped the woodpecker effect of running into certain objects, or getting stuck in some spots, so thank you for that advice.

    I still have to keep other objects' collision boxes pulled in from the sides of the sprites in most cases, but not as severely as before.

  • Glad that something was fixed. What other collision issues are still there, if any?

  • Right now, it's just the ability to bop the NPCs around, but hopefully once I figure out how to get them to behave the way I intend, they won't be bouncing off the dog.

    But that's a problem for future me. Thanks for all the help.

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