# Better Blast Algorithm?

Page 1 of 1

## 0 Replies - 448 Views - Last Post: 05 October 2012 - 12:29 AMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=294357&amp;s=19b7ff8c8758f84304300b53cbcea38d&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 DimitriV

• vexing conundrum

Reputation: 587
• Posts: 2,746
• Joined: 24-July 11

# Better Blast Algorithm?

Posted 05 October 2012 - 12:29 AM

Hey guys, back again!
As some of you may know, I am coding a mine craft clone for my friends/brother/his fanatic friends. I recently read up about TNT on the Minecraft forum and how it blasts:

Quote

The TNT blast will propagate according to this formula f=e-r, where f is the force of the TNT blast after propagating through the block, e is the energy of the blast before propagating through the block, and r is the blast resistance of the block. Thus, the explosion propagates farthest (7 blocks) through air, which has a blast resistance of zero. However, TNT immediately enclosed in stone will destroy an exact 3x3x3 cube originating from the center of the blast. The damage is lethal at close range.

So, how would I do this? I have a TNT blast thing but it is much simpler:
```Sub chkTNT(ByVal tntb As _2Blk)
Dim radius As New Rectangle (tntb.DrawLocation.X - 64, tntb.DrawLocation.Y - 64, 32 *5, 32 * 5)
For i As Integer = 0 To objects.Count - 1
If New Rectangle(objects(i).DrawLocation.X, objects(i).DrawLocation.Y, 32, 32).IntersectsWith(radius) Then
objects(i).Btype = "blast1" 'just for animation purposes
End If
Next
End Sub
'From memory I think this is it...

```

I am totally and utterly confused as to how to do this like in the quote above. Any suggestions are appreciated.
My above code sample isn't probably the best way to do this anyway.

This post has been edited by DimitriV: 05 October 2012 - 12:30 AM

Is This A Good Question/Topic? 0

Page 1 of 1

 .related ul { list-style-type: circle; font-size: 12px; font-weight: bold; } .related li { margin-bottom: 5px; background-position: left 7px !important; margin-left: -35px; } .related h2 { font-size: 18px; font-weight: bold; } .related a { color: blue; }