10 CLEAR ALL
20 c=80
30 DIM x(c),y(c),xd(c),yd(c)
40 BITMAP 1 NEW 32,32
50 TARGET BITMAP 1
60 CIRCLE FILL 16,16,15
70 FOR i=1 TO c
80     SPRITE i BIND BITMAP 1 TAG "ball"
90     x(i)=RANGE(0,1280)
100     y(i)=RANGE(0,800)
110     xd(i)=RANGE(-10,10)
120     yd(i)=RANGE(-10,10)
130     SPRITE i SHOW MOVE x(i),y(i) TINT RND.COLOR
140     IF SPRITE.HIT(i) THEN 90
150 NEXT i
160 DO
170     FOR i=1 TO c
180         x(i)=x(i)+xd(i)
190         y(i)=y(i)+yd(i)
200         SPRITE i MOVE x(i),y(i)
210         IF x(i)<0 OR x(i)>1280 THEN xd(i)=-xd(i)
220         IF y(i)<0 OR y(i)>800 THEN yd(i)=-yd(i)
230         IF SPRITE.HIT(i,"ball")>1 THEN
240             xd(i)=-xd(i)
250             yd(i)=-yd(i)
260         END IF
270     NEXT i
280     PAUSE
290 LOOP WHILE INKEY$=""
300 END
