OK, be kind, what do you think of my ShatterWipe effect?
sync on : sync rate 60
randomize timer()
set text opaque
bw = bitmap width(0)
bh = bitmap height(0)
rem --- make a sample image on bitmap 0
DrawSomething(0,0)
sync
create bitmap 1, bw, bh
t = 1
do
rem --- make a sample image in bitmap 1
DrawSomething(1,t)
inc t, 1 : if t = 3 then t = 0
set current bitmap 0
ink 16777215,0
center text bw / 2, 32, " Press any key! "
sync
wait key
ShatterWipe(1,10,8,10)
sync
loop
end
function DrawSomething(bmp,t)
set current bitmap bmp : cls 0
bw = bitmap width(bmp) : bh = bitmap height(bmp)
for i = 1 to 1000
ink rgb(rnd(255),rnd(255),rnd(255)),0
select t
case 0 : dot rnd(bw),rnd(bh) : endcase
case 1 : line rnd(bw),rnd(bh),rnd(bw),rnd(bh) : endcase
case 2 : r = rnd(40) + 10 : ellipse rnd(bw),rnd(bh),r,r : endcase
endselect
next i
endfunction
function ShatterWipe(bmp,gridwidth,gridheight,speed)
remstart
bmp = source bitmap to be displayed (size must equal to bitmap 0)
gridwidth, gridheight = number of divisions in bitmap. It's best to use values
that can easily divide into width and height of bitmap (min 4, max 20)
speed = how fast you want the blocks to fly
NOTE: function will use DRAW SPRITES LAST in order to work properly
remend
if bitmap exist(bmp) and bmp > 0
bw = bitmap width(0) : bh = bitmap height(0)
if bw = bitmap width(bmp) and bh = bitmap height(bmp)
if gridwidth 20 then gridwidth = 20
if gridheight 20 then gridheight = 20
if speed = bw
x = 0
inc y, spriteheight
endif
rem --- set direction speed of sprite
repeat : xd(i) = (rnd(speed*2) - speed) : until abs(xd(i)) > speed / 2
repeat : yd(i) = (rnd(speed*2) - speed) : until abs(yd(i)) > speed / 2
next i
draw sprites last
copy bitmap bmp,0
spritesoffscreen = 0
rem bw or sx bh or sy