'=========================================================================== ' Subject: CIRCULAR PLASMA EFFECT Date: 03-06-97 (15:24) ' Author: Angelo Ken Pesce Code: QB, PDS ' Origin: ken@uniserv.uniplan.it Packet: GRAPHICS.ABC '=========================================================================== DECLARE SUB initp () DECLARE SUB init () ' ANGELO KEN PESCE 1997 ' COLOR PLASMA EFFECT v4 ' Email: ken at uniserv.uniplan.it ' LOAD THIS PROGRAM USING QBX /AH OR QB /AH ' WATCH THIS: IT's 160x100 but using different colors it looks like 320x200 ' $DYNAMIC DEFINT A-Z ' INITIALIZE CIRCLE ARRAY DIM SHARED aps(250, 250) CALL init SCREEN 13 ' PALETTE INIT CALL initp ' PATTER 1 AND PATTER 2 CENTER and INITIAL MOVEMENT xp1 = 80 + 20: yp1 = 50 + 20 xp2 = 80 - 20: yp2 = 50 - 20 xm1 = 1 ym1 = -1 xm2 = -1 ym2 = 1 DO ' FIRST HALF ************************************************************** DEF SEG = &HA000 FOR x = 1 TO 160 ax = x + 125 x1 = ax - xp1 x2 = ax - xp2 px = x * 2 FOR y = 1 TO 50 ay = y + 125 y1 = ay - yp1 ' THOSE CHECKS ARE REMOVED TO INCREASE SPEED 'IF x1 < 1 OR x1 > 250 OR y1 < 1 OR y1 > 250 THEN col1 = 0: GOTO ex1 col1 = aps(x1, y1) ex1: y2 = ay - yp2 ' THOSE CHECKS ARE REMOVED TO INCREASE SPEED 'IF x2 < 1 OR x2 > 250 OR y2 < 1 OR y2 > 250 THEN col2 = 0: GOTO ex2 col2 = aps(x2, y2) ex2: IF col1 > 0 AND col2 > 0 THEN GOTO rand1 ELSE col = col1 + col2 py = y * 2 POKE (py * 320 + px), col POKE (py * 320 + px - 1), col + 32 POKE ((py - 1) * 320 + px), col + 16 POKE ((py - 1) * 320 + px - 1), col + 16 GOTO next1 rand1: py = y * 2 POKE (py * 320 + px), 0 POKE (py * 320 + px - 1), 0 next1: NEXT NEXT ' SECOND HALF ************************************************************* DEF SEG = (&HA000 + &H7D0) FOR x = 1 TO 160 ax = x + 125 x1 = ax - xp1 x2 = ax - xp2 px = x * 2 FOR y = 1 TO 50 ay = y + 125 y1 = ay - yp1 + 50 ' THOSE CHECKS ARE REMOVED TO INCREASE SPEED 'IF x1 < 1 OR x1 > 250 OR y1 < 1 OR y1 > 250 THEN col1 = 0: GOTO ex3 col1 = aps(x1, y1) ex3: y2 = ay - yp2 + 50 ' THOSE CHECKS ARE REMOVED TO INCREASE SPEED 'IF x2 < 1 OR x2 > 250 OR y2 < 1 OR y2 > 250 THEN col2 = 0: GOTO ex4 col2 = aps(x2, y2) ex4: IF col1 > 0 AND col2 > 0 THEN GOTO rand2 ELSE col = col1 + col2 py = y * 2 POKE (py * 320 + px), col POKE (py * 320 + px - 1), col + 32 POKE ((py - 1) * 320 + px), col + 16 POKE ((py - 1) * 320 + px - 1), col + 16 GOTO next2 rand2: py = y * 2 POKE (py * 320 + px), 0 POKE (py * 320 + px - 1), 0 next2: NEXT NEXT DEF SEG GOSUB setmov LOOP UNTIL INKEY$ <> "" END setmov: ' LET THEM MOVE (I HAVE TO IMPROVE THIS ROUTINE!!!) xp1 = xp1 + xm1 yp1 = yp1 + ym1 xp2 = xp2 + xm2 yp2 = yp2 + ym2 IF xp1 > 80 + 20 THEN xm1 = -1 ELSE IF xp1 < 80 - 20 THEN xm1 = 1 IF yp1 > 50 + 20 THEN ym1 = -1 ELSE IF yp1 < 50 - 20 THEN ym1 = 1 IF xp2 > 80 + 20 THEN xm2 = -1 ELSE IF xp2 < 80 - 20 THEN xm2 = 1 IF yp2 > 50 + 20 THEN ym2 = -1 ELSE IF yp2 < 50 - 20 THEN ym2 = 1 RETURN REM $STATIC SUB init ' I HAVE TO USE THIS "TRICK" IN ORDER TO USE INTEGERS SCREEN 12 FOR i = 1 TO 180 STEP 16 FOR i1 = 1 TO 4 CIRCLE (125, 125), i + i1, i1 + ((180 - i) / 18) CIRCLE (126, 125), i + i1, i1 + ((180 - i) / 18) NEXT FOR i1 = 1 TO 4 CIRCLE (125, 125), i + i1 + 4, (5 - i1) + ((180 - i) / 18) CIRCLE (126, 125), i + i1 + 4, (5 - i1) + ((180 - i) / 18) NEXT NEXT FOR x = 1 TO 250 FOR y = 1 TO 250 aps(x, y) = POINT(x, y) NEXT NEXT END SUB SUB initp FOR i = 0 TO 15 PALETTE i, i * 4 NEXT FOR i = 16 TO 31 PALETTE i, 256 * ((i - 16) * 2 + 7) NEXT FOR i = 32 TO 47 PALETTE i, 65536 * ((i - 32) * 4) NEXT END SUB