DECLARE SUB particle.1 (x.1!, y.1!, cir!, x.bnd!, y.bnd!, x.bnd.s!, y.bnd.s!, drct.x!, drct.y!, c!) '******************************************************************* '* '* This is a program that has balls. . . '* An artistic example, referencing limits on an object with '* linear motion. '* '* Written by:Paul Graham pmg "06" '* paul154@hotmail.com '* '* x.bnd = 210 y.bnd = 110 x.bnd.s = 425 y.bnd.s = 380 x.bnd.i = x.bnd y.bnd.i = y.bnd x.bnd.s.i = x.bnd.s y.bnd.s.i = y.bnd.s x.1 = x.bnd + 1 y.1 = y.bnd + 1 x.2 = 10 y.2 = 10 cnt = 0 cir = 10 cir.1 = 20 'x1 = -1 'y1 = 301 c.1 = 2 drct.x.1 = -2 drct.y.1 = 2 PRINT "Press Esc to exit. . ." LOCATE 1, 1 SLEEP 2 SCREEN 12 DO delay = 0 WHILE delay < 90 delay = delay + 1 WEND VIEW SCREEN (0, 0)-(639, 479), 0, 1 VIEW SCREEN (x.bnd, y.bnd)-(x.bnd.s, y.bnd.s), 0, 1 x.bnd = CLNG(x.bnd.i + 150 * SIN(mov + 15)) y.bnd = CLNG(y.bnd.i + 80 * COS(mov)) x.bnd.s = CLNG(x.bnd.s.i + 150 * SIN(mov + 35)) y.bnd.s = CLNG(y.bnd.s.i + 80 * COS(mov + 15)) particle.1 x.1, y.1, cir.1, x.bnd, y.bnd, x.bnd.s, y.bnd.s, drct.x.1, drct.y.1, c.1 CIRCLE (x.2 + x.1, y.2 + y.1), 5, c + 1 'LINE (x.bnd, y.bnd)-(x.bnd.s, y.bnd.s), 1, B mov = mov + .009 LOOP WHILE INKEY$ <> CHR$(27) SUB particle.1 (x.1, y.1, cir, x.bnd, y.bnd, x.bnd.s, y.bnd.s, drct.x, drct.y, c) IF x.1 > x.bnd - 1 AND x.1 < x.bnd.s + 1 AND drct.x = -2 THEN x.1 = CLNG(x.1 + drct.x + .01) IF x.1 - cir < x.bnd THEN drct.x = 2 END IF END IF IF x.1 > x.bnd - 1 AND x.1 < x.bnd.s + 1 AND drct.x = 2 THEN x.1 = CLNG(x.1 + drct.x) IF x.1 + cir > x.bnd.s THEN drct.x = -2 END IF END IF IF y.1 > y.bnd - 1 AND y.1 < y.bnd.s + 1 AND drct.y = 2 THEN y.1 = CLNG(y.1 + drct.y + .03) IF y.1 + cir > y.bnd.s THEN drct.y = -2 END IF END IF IF y.1 > y.bnd - 1 AND y.1 < y.bnd.s + 1 AND drct.y = -2 THEN y.1 = CLNG(y.1 + drct.y) IF y.1 - cir < y.bnd THEN drct.y = 2 END IF END IF CIRCLE (x.1, y.1), cir, c END SUB