Breaking off blocks from a structure

0 favourites
  • 3 posts
From the Asset Store
a complete set of modular graphics, perfect for all kind of levelbuilding
  • Been searching the forums and tutorials for a while with limited success, so here goes;

    Not enough rep yet to post a link, but if you open a new project and scroll down to the example that says "Falling blocks", you'll see what I've been working on.

    Been working with the "Falling Blocks" example included with C2, hoping to create an element for a game.

    In the example, when a block or group of blocks is not connected to the structure of blocks, they slowly sink until they reach the ground or come to rest on another block.

    The structure-connection system is perfect for my needs, but what I hope to accomplish is that when the blocks become disconnected, rather than just sinking downwards, they become physics objects and fall and bounce around and the like. I have been trying myself for quite a while, but have been unable to make it work. Either all of the blocks become physics objects and fall at once or sink as usual but without recognizing any connection.

    I'm probably just missing something pretty basic, but if someone could help point me in the right direction, that would be wonderful. I've been banging my head against the keyboard for a few days now. :)

    Thanks so much!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I haven't looked at the example, but it sounds like you might want to give them something like a physics behaviour, set it as inactive on start, and then use an event to set it as active.

    Here's a quick example of what I mean:

    drop-boxes.capx

    The boxes have physics disabled as an initial state and an instance variable called 'touched' which is 0. When you click on a box it changes their variable 'touched' to 1. Event 2 makes physics active when touched=1

    The result is that when you click on a box it drops to the floor.

    You could use one event (when object is touched, set physics to enabled) but the reason I used an instance variable is so that you can change the trigger from clicking on them to a collision, or time, or anything you want.

    Hmm, maybe I should have looked at the example, but I hope this is a hint in the right direction anyway.

  • Thanks for the reply.

    This is the idea I've been trying to implement already, and it works just fine on its own, but when I try to use it in conjunction with the setup nothing works the way it should.

    I try enabling physics when the blocks are defined as IsFalling, but all of them just fall right away.

    This example is being rather uncooperative.

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