I made another example relating to Collision Detection which I'm popping in here. This routine has some similarities to the last example I posted in the Silly Programming Ideas Thread (Attack of the Moving Shapes), though on this occasion I'm moving 3 Objects, a white border is drawn and 100 or so White Squares are randomly drawn onscreen. Initially if the Objects are drawn over the White Squares they'll move on til they find an open area and bounce off the Squares, the moving objects have their own set directions pretty much like a nasty from Roland in Time or Monty on the Run.

`100 MODE 0:CALL &BC02:INK 0,11:BORDER 11:INK 1,26:PEN 1`

110 FOR y=1 TO 25

120 LOCATE 1,y

130 PRINT CHR$(143);

140 LOCATE 20,y

150 PRINT CHR$(143);

160 NEXT y

170 LOCATE 1,1

180 PRINT STRING$(20,CHR$(143));

190 LOCATE 1,25

200 PRINT STRING$(20,CHR$(143));

210 FOR b=1 TO 100

220 RANDOMIZE TIME:RANDOMIZE RND

230 x=(RND*17)+2

240 y=(RND*23)+2

250 LOCATE x,y

260 PRINT CHR$(143);

270 NEXT b

280 PRINT CHR$(23)+CHR$(1); ' XOR Mode

290 w=320:z=350:u=288:v=238:s=96:t=94

300 a=32 :b=16 :c=a :d=a

310 c=5:x=w:y=z:GOSUB 1000:x=u:y=v:c=1:GOSUB 1000:x=s:y=t:c=2:GOSUB 1000

320 LOCATE 1,1

330 WHILE INKEY(18)<>0 ' Enter/Return to Exit

340 x=w:y=z:c=5:z=z+b:GOSUB 1000:x=w:y=z:GOSUB 1000

350 IF TEST(w,z+16)=1 THEN b=-16 ELSE IF TEST(w,z-16)=1 THEN b=16

360 x=u:y=v:c=1:u=u+a:GOSUB 1000:x=u:y=v:GOSUB 1000

370 IF TEST(u+32,v)=1 THEN a=-32 ELSE IF TEST(u-32,v)=1 THEN a=32

380 x=s:y=t:c=2:s=s+d:GOSUB 1000:x=s:y=t:GOSUB 1000

390 IF TEST(s+32,t)=1 THEN d=-32 ELSE IF TEST(s-32,t)=1 THEN d=32

400 WEND

410 WHILE INKEY$<>"":WEND:MODE 2:END

1000 PLOT -2,-2,c:MOVE x,y

1010 TAG

1020 PRINT CHR$(225);

1030 TAGOFF

1040 RETURN

[attachimg=1]