Problems with hitboxs

0 favourites
  • 6 posts
From the Asset Store
For problem solving, puzzles, bubbles, platforms and other adventures.
  • Hi, First of all, excuse me for my bad english :)

    I'm try to making a physic based puzzle game like "Tricky Tower" who is a Tetris like game.

    And i have a collision problem with the Bricks/Tetrominos : They dont stack properly like i want and there is always a gap/shift of 1 or more pixels depending on how many bricks are stacked, and thats annoying because thats ruine the stability of the tower block after block and make it wobbly.

    All hitboxs are based on 16x16 areas

    Bricks have : physic behavior, solid and much more

    I'ts probably a stupid question but how to get rid of these thing ?! I've tried everything but nothing work...

  • Using Physics in tetris game is probably not a good idea. Mixing Physics with other behaviors (solid, 8-direction etc) in one object is a very bad idea. This will never work correctly..

    .

    I don't know what kind of game you are making. If it's a tetris clone, you need precise control over shapes movement, which you can't achieve with Physics or 8-direction behaviors. I suggest using addons like MoveTo or Board:

    construct.net/en/forum/extending-construct-2/addons-29/behavior-moveto-40701

    construct.net/en/forum/extending-construct-2/addons-29/pluginboard-layout2board-47187

  • Using Physics in tetris game is probably not a good idea. Mixing Physics with other behaviors (solid, 8-direction etc) in one object is a very bad idea. This will never work correctly..

    Ok, but I need physic , thats the base of my gameplay, I don't want the bricks to be stuck on a grid ,the bricks need to have a weight and moves naturally , they need to be affected by gravity, etc.

    For now everythings work fine except this pixel gap between blocks, I don't understand how the collision box works, why is it loose 1 pixel lenght on stacked blocks. Is there a way to "align" them properly and to maintain the physics behavior at the same time ?

    Edit: It's not exactlly a Tetris like, it has a more inaccurate and natural brick placement like that : youtu.be/RxNqzov8vts the constructions should collapse

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Oh, so it's a physics game. Still, it's not recommended to move Physics objects with non-physics behaviors and actions, they will be conflicting with each other.

    There will always be a small gap between touching physics objects, I believe this is how the box2d engine works. You can try Chipmunk Physics instead:

    scirra.com/forum/behavior-chipmunk-physics_t110815

    Or you can try to use two objects for blocks - one invisible sprite with Physics behavior, and another visible sprite pinned to it. The second sprite should be slightly bigger to cover the gaps.

  • Oh, so it's a physics game. Still, it's not recommended to move Physics objects with non-physics behaviors and actions, they will be conflicting with each other.

    There will always be a small gap between touching physics objects, I believe this is how the box2d engine works. You can try Chipmunk Physics instead:

    https://www.scirra.com/forum/behavior-chipmunk-physics_t110815

    Or you can try to use two objects for blocks - one invisible sprite with Physics behavior, and another visible sprite pinned to it. The second sprite should be slightly bigger to cover the gaps.

    Thanks ! I'm gonna test this engine instead of Box2D and also try the 2 objects technic ,I will tell you if its work fine.

  • Yeaaaaah it works ! Thanks again dop2000, you saved my life. Chipmunk rocks, there is no more pixel shifting on stacked blocks, the hitbox no more get through sprite. But the physic is radically different and I need to change few things to get back to the old gamefeel like the normal physic behavior , chipmunk seem to be more complete and also complicated.

    I've spend hours to search on internet and on this forum but it seem to be nobody who talk about this hitbox problem anywhere, thats weird .

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