How do I stop solids shifting each other?

0 favourites
  • 4 posts
  • So I have a group of solids that I would like to be able to sit next to one another, flush if you will, at any point during gameplay.

    There will be a switch to toggle when the objects are able to be moved using the 8 direction, however when this toggle is activated the objects move ever slightly by literally a pixel or two, almost as if they are repelling one another.

    Ultimately this is a problem because my main game works on a grid basis which falls apart if the objects are forced off the grid, even slightly.

    Here is an example capx of what is happening:

    https://drive.google.com/open?id=0B3txc ... XZPektSVFU

    Is there a way to activate movement or control of the objects without them shifting one another off their original positions?

    Thanks in advance beautiful people

  • You may want to set up custom events for movement and collisions if at all feasible. I've run into this issue before with pixel perfect blocks sliding up against each other where solids did not play nicely. Adjacent pixels count as colliding and solids will block each other.

    Although if anyone has any other ideas I'd be interested as well.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • you could do different frames of the object with each its own object collision mask such as if you have a square object in a

    1-D world that would be fine since the camera is always from above but when doing 2-D or even isomeric where its 2.5.

    It could pose a problem so I've always ruled that its best to make several of the same frame with different collision mask to see which works the best.

    And if you want to restore the object collision back to the original you could make an invisible sprite to check to see when to turn back to the other frame with a better collision mask for your game.

    So in your case find a commonground that you can see the sprite doing and try to adjust the colliosion mask to it. Or you could disable collision until you are far enough away to resume collision. Just some trick I've learn.

  • Thanks guys, appreciate the help.

    I've managed to do it using the first thing Gearworkdragon said about collision masks and reduced each side of the object's collision by 2 pixels. This has stopped solids displacing each other when touching the side of another one. Works pretty friggin' well I must say.

    Thanks again for the help!

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