You use newxvalue to tell you the new x position of the object, and newyvalue to tell you the new y position. These are based on angles and speeds, so for each fragment you want a random angle and a random speed.
Here's an example using an explosion of 10 pixels. I've put the x and y positions, and the angles and speeds into an array.
sync on
sync rate 30
randomize timer()
dim fragment(10,4)
rem (i,0) = x position
rem (i,1) = y position
rem (i,2) = angle
rem (i,3) = speed
for i=0 to 9
fragment(i,0)=320
fragment(i,1)=240
next i
explode=0
do
if mouseclick()=1 and explode=0
explode=1
for i=0 to 9
fragment(i,2)=int(rnd(360))
rem assign random angle
fragment(i,3)=int(rnd(5))+1
rem assign random speed
next i
endif
if mouseclick()=2
explode=0
rem reset pixels
for i=0 to 9
fragment(i,0)=320
fragment(i,1)=240
next i
endif
if explode=1
for i=0 to 9
fragment(i,0)=newxvalue(fragment(i,0),fragment(i,2),fragment(i,3))
fragment(i,1)=newzvalue(fragment(i,1),fragment(i,2),fragment(i,3))
next i
endif
for i=0 to 9
dot fragment(i,0),fragment(i,1)
next i
sync
cls
loop
Note I'm using newzvalue, because it seems to work better for these kind of things.
Once I was but the learner,
now, I am the Master.