# Block Toppling

10 replies to this topic

### #1 Creativita

Creativita

GMC Member

• GMC Member
• 172 posts
• Version:GM:Studio

Posted 05 May 2012 - 09:59 AM

I am creating a building game in which the player is required to build a structure that will reach a certain height by using a limited number of blocks. But I am unable to allow the blocks to become topple if they are "poorly" placed. How may I allow this toppling effect to occur?
• 0

### #2 ND4SPD

ND4SPD

GMC Member

• GMC Member
• 2167 posts

Posted 05 May 2012 - 10:04 AM

This is tricky.

At its simplest, I suppose you could find the area of the base of the structure by finding the distance from the furthest left point to the furthest right point. Then, find the center of mass of the rest of the structure by adding all the x and y coordinates, multiplying by a mass value, and then dividing by the number of coords to find an average. If the centre of mass lies to the left or the right of the area of support, then the tower would topple.

EDIT: Extend this to check at every level. As in, find the 'base area' for the lowest level of the tower, and calculate whether every block above would balance. Then check the second lowest level, find the base area here, and calculate whether every block above THAT level would balance. Then the third lowest level, and so on to the top.

Edited by ND4SPD, 05 May 2012 - 10:09 AM.

• 0

### #3 Creativita

Creativita

GMC Member

• GMC Member
• 172 posts
• Version:GM:Studio

Posted 05 May 2012 - 10:10 AM

Thank you. But I lack the coding knowledge to do this. Can you assist me?
• 0

### #4 ND4SPD

ND4SPD

GMC Member

• GMC Member
• 2167 posts

Posted 05 May 2012 - 10:15 AM

I can try!

How are these blocks going to work? Objects, or part of an array? Are they aligned to a grid? I'll need considerably more info about how this game works...
• 0

### #5 Creativita

Creativita

GMC Member

• GMC Member
• 172 posts
• Version:GM:Studio

Posted 05 May 2012 - 10:22 AM

The blocks are simply objects that the player may create at will by selecting the block type and clicking on the screen. The blocks, when created, will travel downwards (270) with a gravity of 1. When colliding with any other solid object, the block gravity and vertical speed will be set to 0 and the block will move to contact downwards (270) at a maximum of 12.
• 0

### #6 ND4SPD

ND4SPD

GMC Member

• GMC Member
• 2167 posts

Posted 06 May 2012 - 01:43 AM

What do the objects look like?! Are they aligned to a grid?

Maybe get a screenshot of what you have thus far...
• 0

### #7 Creativita

Creativita

GMC Member

• GMC Member
• 172 posts
• Version:GM:Studio

Posted 06 May 2012 - 11:01 AM

Sadly, I created it using another computer to which I do not have access. I will quickly re-create it so you may see it.

EDIT:

Here is a screenshot of the present game. Is that in any way helpful?

Edited by Creativita, 07 May 2012 - 04:20 AM.

• 0

### #8 ND4SPD

ND4SPD

GMC Member

• GMC Member
• 2167 posts

Posted 07 May 2012 - 06:04 AM

Oh wow. It may be easier to find a physics engine than use my method...? If it was all aligned to a grid, it wouldn't be TOOOO tricky, but this....
• 0

### #9 creators124

creators124

awesomeliciousmember

• GMC Member
• 866 posts
• Version:GM8

Posted 07 May 2012 - 06:16 AM

question are the block x,y at the center or the at the left hand corner?
first block dorpped can set the grid!
• 0

### #10 Creativita

Creativita

GMC Member

• GMC Member
• 172 posts
• Version:GM:Studio

Posted 07 May 2012 - 07:19 AM

I am now experimenting with Extreme Physics. But thank you for your help.
• 0

### #11 ND4SPD

ND4SPD

GMC Member

• GMC Member
• 2167 posts

Posted 07 May 2012 - 08:38 AM

I am now experimenting with Extreme Physics. But thank you for your help.

Good luck! sorry I couldn't do more.
• 0

#### 0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users