Advertisement

Tile based building demolition

Started by November 28, 2013 11:50 PM
1 comment, last by Waterlimon 11 years, 2 months ago

Hello, how would you implement a tile based building demolition physics/maths?

Let's say there is a simple building made out of 10x10 blocks and you set a dynamite somewhere and it would make the building collapse (or a part of it to collapse).

I'm not looking after the animation when the building collapses, lets say the blocks just disappear.

Just simply put, if you put ten blocks on top of one another, then delete one block from the middle, the upper part would collapse and disappear. But how would this work with more complex buildings, so that they collapsed in a some what realistic fashion?

A game called King Arthur's Gold would be a good example, just without the animations when the building collapses.

Sand blocks and water 'blocks' do this kind of thing in Minecraft. I think they do it by having a blockUpdate() function, where the disappearing block passes a message to nearby blocks, which can then act accordingly.

--"I'm not at home right now, but" = lights on, but no ones home
Advertisement
You use a flood fill the find whether any of the connected tile structures has become unconnected to the ground. Then you collapse them. King Arthur's Gold seems to row by row transform the blocks to physics bodies that then fall and interact with other blocks to form rubble.

o3o

This topic is closed to new replies.

Advertisement