in the meantine, here's all the code (I think);
Function shatter()
For ps.pic_shard = Each pic_shard
FreeImage ps\im:Delete ps
Next
img=CreateImage(GraphicsWidth(),GraphicsHeight() )
screen_splinter_im=LoadAnimImage(("images\splinter1.png"),128,128,0,4)
MaskImage screen_splinter_im,255,255,255
screen_splinter2_im=LoadAnimImage(("images\splinter2.png"),128,128,0,4)
MaskImage screen_splinter2_im,255,255,255
CopyRect 0,0,GraphicsWidth(),GraphicsHeight(),0,0,FrontBuffer(),ImageBuffer(img)
MaskImage img,255,0,0
Dim matrix(GraphicsWidth()/64,GraphicsHeight()/64)
shardsacross=(GraphicsWidth()/64)+1
shardsdown=(GraphicsHeight()/64)+1
For lp=1 To shardsacross*shardsdown
; a little bit of recursion here, shouldn't be too big a deal
Repeat
lpx=Rnd(1,shardsacross)-1
lpy=Rnd(1,shardsdown)-1
Until matrix(lpx,lpy)=0
matrix(lpx,lpy)=1
tmp=Rand(0,3)
ps.pic_shard=New pic_shard
ps\x=lpx*64
ps\y=lpy*64
ps\my=(Rnd(-2,0)+(lpy-5))*(Float(GraphicsHeight())/480)
ps\mx=(Rnd(-1,1)+(Float((lpx*2)-shardsacross)/shardsacross*5))*(Float(GraphicsWidth())/640)
ps\im=CreateImage(128,128)
CopyRect (lpx*64)-32,(lpy*64)-32,128,128,0,0,ImageBuffer(img),ImageBuffer(ps\im)
MaskImage ps\im,255,0,0
SetBuffer ImageBuffer(img)
DrawImage screen_splinter_im,(lpx*64)-32,(lpy*64)-32,tmp
SetBuffer ImageBuffer(ps\im)
DrawImage screen_splinter2_im,0,0,tmp
Color 255,0,0
If lpy=0 Then Rect 0,0,128,32,1
If lpy=shardsdown-1 Then Rect 0,96,128,32,1
Next
SetBuffer BackBuffer()
FreeImage img:FreeImage screen_splinter_im:FreeImage screen_splinter2_im
End Function
Function update_splinters()
For ps.pic_shard = Each pic_shard
ps\y=ps\y+ps\my:ps\my=ps\my+(0.6*(Float(GraphicsHeight())/480))
ps\x=ps\x+ps\mx
If ps\y>GraphicsHeight()+100 Or ps\x<-100 Or ps\x>GraphicsWidth()+100 Then FreeImage ps\im:Delete ps
Next
End Function
|