[r260] 8-direction movement + solid makes player go through walls

0 favourites
  • 8 posts
From the Asset Store
Players follower. use it for anything which follows the player
  • Hi everyone,

    Using the 8-direction movement with solid objects seems to bug it out a bit if the walls are too thin (at least 16px).

    Steps to reproduce:

    1. Add 8direction and solid behaviors to 2 objects

    2. Add a tilemap (so you can have walls, but any solid will do) that has 16x16 tiles

    3. Add controls to both objects

    4. Hug any wall with both characters and make one of them block the other from behind

    5. Either hold the same direction for both objects, or if nothing happens, try to move backwards with the object that's hugging the wall.

    CAPX example:

    Use WSAD to move one player next to a wall. Use the arrow keys to stand behind that player. Release everything and use WSAD again to try and move backwards, into the other player that's blocking you.

    If you were hugging a wall on your left or above, the player that's closest to the all warps all the way around it.

    If you were hugging a wall to your right or bottom, the players can't even hug it - they'll start warping between it each other.

    Here's a gif showing it:

    And here's a capx:

    1drv.ms/u/s!AuQM7MihYyx4joAMfqNNPaNwvrAKTA

    Note that this does not happen if the objects and the walls are at least 32px by 32px.

  • It is true, it is not even necessary to move the red block. Just leave it still while keeping a space so that the blue block can be inserted.

    I think this happens because the blue block detects that the route is blocked (the red block blocks the route when you press the right cursor), then the blue block looks for the exit on the left.

    But this should not happen if there is enough space for the blue block to be in the area.

    That is, the area is large enough to keep the blue block there, so there is no need to look for an exit on the left.

    This error seems to only occur towards the left side.

  • This error seems to only occur towards the left side.

    Like I said in the first post, there are different errors depending on the side. Left and Up makes the player warp like that, but Right and Down makes the player exchange positions if both are moving in the same direction.

  • The movement behaviors aren't designed to work with the solid behavior added as well. It can result in awkward situations like objects crushed by other ones with no room to move in to, which activates a "get me out of here" routine that moves it to the nearest clear space. I'm not sure how this could be improved or entirely prevented. I'd prefer to leave it as an unsupported case.

  • I thought that solids were perfect for creating walls.

    I'm surprised that movement behaviors with solids are not compatible. This would be a great method to quickly get the gameplay but ... are not compatible ?.

    0_0

  • It's never been officially supported, because it's almost impossible to get right. There are way too many difficult edge cases where objects move in to a tightly constrained spot and there's no way to avoid wedging them inside a solid or doing something else that the engine typically disallows.

    Anyway this only affects games that use multiple players, and then by far the most reliable thing to do is to simply allow them to overlap each other. This also completely avoids difficult gameplay problems such as one player managing to block the other player so it's impossible for them to move, or both players accidentally getting in to a position where they are both together permanently stuck.

  • you got to create your own events for movement and collisions and you'll be fine. Although, you will need to create slightly different events for kb and for gamepad.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If anyone is interested, I'm probably going to end up using rexrainbow's push out of solid behaviour:

    c2rexplugins.weebly.com/rex_pushoutsolid.html

    It's not a perfect solution (it seems there's a weird bug that I talk about here: construct.net/forum/extending-construct-2/addons-29/behavior-moveto-40701/page-28 ) but at least it doesn't allow my players to overlap each other. Since the players are 16x16 it's almost unnoticable anyway.

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