Platformer Collision at Small Sizes

0 favourites
  • 7 posts
From the Asset Store
10 Retro songs ideal for platformers or farming games
  • When a platformer behaviour is attached to a very small sprite box (I've specifically set it at [6, 17]), and the sprite tries to walk across angled (rectangular) platforms, it seems to get 'stuck' a lot.

    It doesn't seem to happen nearly anywhere near as much as when it's using large sprites.

    I've tried creating an event which changes the angle to whatever it's colliding with, to little avail. Also I've tried 'rounding off' the edges, but occasionally it gets stuck on the edge of a flat box, too.

    I think this is a case of collisions being too precise when they get too small. Is there the ability to make collisions a little more forgiving at smaller levels, or would it be easier to just double the size of everything?

    I'm keeping it small because I'm trying to keep the overall size of the layout down.

  • You could make the collisions as a "box", meaning, all pixels in the sprite will be detected.

  • Can you post a .capx demonstrating this?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The capx is probably not really needed, because it's just using many of the default behaviours (Platform + Solid)

    Here is a quick game that I mocked up to show the problem.

    And the .capx to show how it was done.

    The problem is when the main sprite goes on an angled platform, which gets him 'stuck'.

  • Ah, I was wrong. The bounding box collision is only for Physics and doesn't seem to make a difference. I also think the pixel detection it's being too precise. Looks like the sprite it's going up and down stairs.

  • Well, that's odd. If you open one of the platformer examples from the examples directory it works fine.

    I didn't really design the platform behavior to work at such tiny scales. The player is only 6x11 pixels big. The platform behavior is only designed to work to the nearest pixel. So I guess the off-by-one-pixel rounding is causing the problems, which is a large amount compared to the size of the player.

    TBH it's difficult to make the platform movement more precise than to the nearest pixel. I'd suggest just designing your game with larger objects instead of scaling the layer.

  • Yeah I figured as much. I think it's just to do with the fact that at such small scales, individual pixels matter.

    I looked through the code to see if I could make it more forgiving to obstacles, but it was more like I was stabbing around in the dark. I'll just make the resources bigger.

    Anyway, thought I'd let you know about the limitations (if it can even be called that).

    Thanks.

    Edit: I got it to work really well by speeding him up. That's really all you need, at the end of the day; speed.

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