Opps well try it again here
ExplodeMunition:
Position object 30,bX#,bY#,bZ#
Show object 30
Position object 31,bX#,bY#,bZ#
Show object 31
EScale=20*(30-Explode)
Scale object 30,EScale,EScale,EScale
rem Yrotate object 30,WrapValue(Explode*37)
Scale object 31,EScale/1.5,EScale/1.5,EScale/1.5
rem Yrotate object 31,WrapValue(359-Explode*37)
Dec Explode
If Explode = 0 then hide object 30: Hide object 31:if bY# < Get Ground height(1,bX#,bZ#) then gosub crater
If Explode=18
position sound 200,bX#,bY#,bZ#
play sound 200
endif
rem If Explode < 15 then position sound 200,X#,Y#,Z#
Return
crater:
rem find closest tile pos
set matrix height 1,get_x_matrix(bx,10000,100),get_z_matrix(bz,10000,100),-50
update matrix 1
return
function get_x_matrix(xposition#,matrixsize#,tiles)
`will find relative matrix co-ordinate for X position in 3d world.
matrixtilex=round((xposition#/matrixsize#)*tiles)
if matrixtilex<1 then matrixtilex=1
if matrixtilex>tiles then matrixtilex=tiles
endfunction matrixtilex
function get_z_matrix(zposition#,matrixsize#,tiles)
`will find relative matrix co-ordinate for Z position in 3d world.
matrixtilez=round((zposition#/matrixsize#)*tiles)
if matrixtilez<1 then matrixtilez=1
if matrixtilez>tiles then matrixtilez=tiles
endfunction matrixtilez
function round(number#)
`rounds a number up or down depending if the first decimal is over .5 or not.
fraction#=number#-int(number#)
if fraction#=>0.5 then result=int(number#+1) else result=int(number#)
endfunction result