'=========================================================================== ' Subject: COOL LINE GRAPHICS Date: 02-24-97 (15:10) ' Author: Reinder Glas Code: QB, QBasic, PDS ' Origin: glas400@hio.tem.nhl.nl Packet: GRAPHICS.ABC '=========================================================================== 'Cool line-graphics 'By Reinder Glas '1996 'Email: glas400@hio.tem.nhl.nl DEFINT A-Z 'const definition !!!change to get different effects!!! 'this const are optimalized for a 486dx50 computer CONST ArrayLength = 96 CONST Refresh = 3000 CONST MaxStepFactor = 8 'static const definition CONST TRUE = 1 CONST Forward = 0 CONST Back = NOT Forward 'type definition TYPE Pixel x AS INTEGER 'the x coordinate of the pixel y AS INTEGER 'the y coordinate of the pixel xd AS INTEGER 'the x direction the pixel is moving yd AS INTEGER 'the y direction the pixel is moving xs AS INTEGER 'the speed the pixel is moving in the x direction ys AS INTEGER 'the speed the pixel is moving in the y direction END TYPE TYPE PixelPair p1 AS Pixel p2 AS Pixel END TYPE 'allocate usertypes DIM ActivePixels(2) AS Pixel DIM PixelPairArray(ArrayLength) AS PixelPair 'declare subs DECLARE SUB Update (InPixel AS Pixel) 'main program SCREEN 13 RANDOMIZE TIMER DIM col AS INTEGER 'color of line DIM counter AS INTEGER WHILE (TRUE) FOR waiting = 0 TO Refresh: NEXT LINE (PixelPairArray(counter).p1.x, PixelPairArray(counter).p1.y)-(PixelPairArray(counter).p2.x, PixelPairArray(counter).p2.y), 0 Update ActivePixels(0) Update ActivePixels(1) PixelPairArray(counter).p1 = ActivePixels(0) PixelPairArray(counter).p2 = ActivePixels(1) LINE (PixelPairArray(counter).p1.x, PixelPairArray(counter).p1.y)-(PixelPairArray(counter).p2.x, PixelPairArray(counter).p2.y), col counter = (counter + 1) MOD ArrayLength col = (col + 1) MOD 256 IF col < 32 THEN col = 32 WEND SUB Update (InPixel AS Pixel) IF InPixel.x >= 320 THEN InPixel.xd = Back: InPixel.xs = INT(RND * MaxStepFactor) + 1 IF InPixel.x <= 0 THEN InPixel.xd = Forward: InPixel.xs = INT(RND * MaxStepFactor) + 1 IF InPixel.y >= 200 THEN InPixel.yd = Back: InPixel.ys = INT(RND * MaxStepFactor) + 1 IF InPixel.y <= 0 THEN InPixel.yd = Forward: InPixel.ys = INT(RND * MaxStepFactor) + 1 IF InPixel.xd = Forward THEN InPixel.x = InPixel.x + InPixel.xs IF InPixel.xd = Back THEN InPixel.x = InPixel.x - InPixel.xs IF InPixel.yd = Forward THEN InPixel.y = InPixel.y + InPixel.ys IF InPixel.yd = Back THEN InPixel.y = InPixel.y - InPixel.ys END SUB