'=========================================================================== ' Subject: GRAPHICAL SPHERE Date: 11-19-91 (08:31:00) ' Author: Jeff Benson Code: QB, QBasic ' Keys: GRAPHICAL,SPHERE Packet: GRAPHICS.ABC '=========================================================================== 'Here's a program worth trying, people . . . all you need is QuickBASIC '(of course) and a VGA graphics adaptor. Give it a shot, you might 'learn something. This program was found on a local BBS. ' Program Creates a moving sphere by shifting the VGA palette SCREEN 13 DIM Sphere(700) CLS PAINT (160, 100), 201 Red = 1 Green = 1 Blue = 1 Radius = 25 FOR PaletteRange = 15 TO 40 Red = PaletteRange Green = PaletteRange ToColor = 65536 * Blue + 256 * Green + Red PALETTE PaletteRange, ToColor CIRCLE (160, 100), Radius, PaletteRange PAINT (160, 100), PaletteRange IF Radius > 1 THEN Radius = Radius - 1 END IF NEXT ' Get Sphere, store in array, clear and repaint screen GET (134, 78)-(186, 122), Sphere CLS PAINT (160, 100), 201 X = 4 Y = 4 ' Move Sphere around screen until a key is pressed WHILE INKEY$ = "" IF X > 259 THEN Xadj = -1 ELSEIF X <= 4 THEN Xadj = 1 END IF IF Y >= 148 THEN Yadj = -1 ELSEIF Y <= 4 THEN Yadj = 1 END IF X = X + Xadj Y = Y + Yadj PUT (X, Y), Sphere, PSET WEND END