' STEP-1.BAS
' This program uses the illusion of zooming through space
'   to demonstrate the STEP keyword.

CLS

CONST DELAY% = 200                  ' controls how fast stars "shoot"

INPUT "Please enter a screen mode (0-13):  ", modeNum%
SCREEN modeNum%

DO
    PSET (160, 100), 0              ' set center (assumes 320 by 200
                                    '   resolution)
    quad% = INT(RND(1) * 4)         ' random number for quadrant from
                                    '   which the "star" will shoot
    randX% = INT(RND(1) * 10)       ' random number for column movement
    randY% = INT(RND(1) * 10)       ' random number for row movement

    IF quad% = 0 OR quad% = 1 THEN  ' normal movement is down;
        randY% = -randY%            '   reverse y value to move up
    END IF
    IF quad% = 0 OR quad% = 3 THEN  ' normal movement is to right;
        randX% = -randX%            '   reverse x value to move to left
    END IF
   
    FOR i% = 1 TO 20
        PSET STEP(-randX% * i%, randY% * i%)  ' draw "star"
       
        FOR j% = 1 TO DELAY%        ' delay loop
        NEXT j%
       
        PRESET STEP(0, 0)           ' erase "star"
    NEXT i%

LOOP UNTIL INKEY$ <> ""

