Colision between two blocks

  • Hey guys, i need a little help. I am making a puzzle game like the puzzles in Goof Troop (snes).

    The player is the darker block. When i touch a block, i am making it go forward in the direction that the player is moving.

    Everything ok until here, but when i colide two blocks, the moving one enters a little bit in the stopped one. And then, when i try to move the stucked block, it passes the other block like they were not solid.

    Any ideas?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The layout and the properties aren't useful. A capx or a picture of events is.

    I thought there was an example floating around the forum but I couldn't find one, so here's my take.

    https://dl.dropboxusercontent.com/u/542 ... _push.capx

    I used the 8direction behavior to move the player. I also added CustomMovement and solid to both the player and the boxes. CustomMovement is used for it's "push out of solid" actions and "solid" is used to specify the solids which I toggle on and off.

    The general idea is to

    1. if player overlaps a box then push the box

    2. if the pushed box is then overlapping any other boxes then we need to push back by

    a. push the box backwards out of the other boxes

    b. push the player backwards out of the boxes.

    The only major equation used is to round an angle to the nearest 90, so we get a correct angle to push. Solid is enabled and disabled throughout. The idea is to only enable a solid if we want to push out of it, otherwise it's disabled.

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