'=========================================================================== ' Subject: PIXEL ANGLE BOUNCE Date: 01-07-98 (19:26) ' Author: Nick Kochakian Code: QB, QBasic, PDS ' Origin: NickK@worldnet.att.net Packet: GRAPHICS.ABC '=========================================================================== 'Pixel angle bounce ' '11/4/97 By: - Nick Kochakian - ' 'Ever see thoes balls that every time they hit a corner of the screen 'they angle another way? Well, here's the basics to that bouncing ball thing, 'only I've put in pixels instead of the classic ball. ' 'e-mail: nickk@worldnet.att.net 'web page: http://www.geocities.com/siliconvalley/heights/5914/ 'DEFINT A-Z 'This is so the program runs faster RANDOMIZE TIMER SCREEN 13 pix = 10 DIM x(pix) DIM y(pix) DIM dir$(pix) FOR i = 1 TO pix x(i) = INT(RND * 319) + 1 y(i) = INT(RND * 199) + 1 dir = INT(RND * 4) + 1 IF dir = 1 THEN dir$(i) = "7" IF dir = 2 THEN dir$(i) = "9" IF dir = 3 THEN dir$(i) = "1" IF dir = 4 THEN dir$(i) = "3" NEXT i 'x = 100 'y = 100 'dir$ = "7" i = 1 DO PSET (x(i), y(i)), 0 IF dir$(i) = "7" THEN x(i) = x(i) - 1: y(i) = y(i) - 1 IF dir$(i) = "3" THEN x(i) = x(i) + 1: y(i) = y(i) + 1 IF dir$(i) = "9" THEN x(i) = x(i) + 1: y(i) = y(i) - 1 IF dir$(i) = "1" THEN x(i) = x(i) - 1: y(i) = y(i) + 1 IF x(i) < 0 AND y(i) < 0 AND dir$(i) = "7" THEN dir$(i) = "3" IF y(i) > 199 AND dir$(i) = "3" THEN dir$(i) = "9" IF x(i) > 319 AND dir$(i) = "9" THEN dir$(i) = "7" IF y(i) < 0 AND dir$(i) = "7" THEN dir$(i) = "1" IF y(i) > 199 AND dir$(i) = "1" THEN dir$(i) = "7" IF x(i) < 0 AND dir$(i) = "7" THEN dir$(i) = "9" IF y(i) < 0 AND dir$(i) = "9" THEN dir$(i) = "3" IF x(i) > 319 AND dir$(i) = "3" THEN dir$(i) = "1" IF x(i) < 0 AND dir$(i) = "1" THEN dir$(i) = "3" PSET (x(i), y(i)), 15 FOR a = 1 TO 99 NEXT a i = i + 1 IF i > pix THEN i = 1 LOOP UNTIL INKEY$ <> ""