How do I Make a system that makes blocks have no gravity unless it has no supports?

0 favourites
  • 4 posts
From the Asset Store
Make your own platformer for both the web and mobile easy with this Santas Platformer Template, FULLY DOCUMENTED
  • I want to make a game where you build things with blocks then enemies try to explode your structures

    I wanna make it so that if the structure has any supports that are touching the ground, it doesn't move at all

    But if no part of the structure is touching the ground, it will act like a regular physics object

    I tried using the physics joints but it bends when theres too many blocks

    Is there a good way to create what I'm aiming for?

  • Set the blocks to be immovable. Then test if it has supports underneath, if not, set it to moveable.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Wouldn't that make it only up and down? If i applied that system In the first picture, only the left side pillar would stay up, the horizontal part would fall

  • One approach to see if a structure is on the ground is to start by marking the blocks touching the ground, then mark the blocks touching those, and so on. In the end you will then know which blocks are supported from the ground or not. It’s kind of like a flood fill. Search for posts by me I think I made a digging example that made unsupported blocks crumble.

    Making those objects not supported be movable is then an easy solution to have things crumble. To have them fall in chunks of connected blocks is harder. You can do more flood fills to find all the individual chunks or blocks as a first step. But the second step of connecting them together with physics isn’t really possible with the physics behavior. Best you can do is with joints but that can’t make the shapes rigid.

    To have rigid shapes the only option I can think of is to not use the physics behavior and either roll your own solution or attempt using a JavaScript library to do the physics I suppose.

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