Advertisement Jump to content
Sign in to follow this  
thomp33

Tile based building demolition

This topic is 1880 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!