DECLARE SUB setscreen (lines, stars, numlines, numstars, circstar)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'                                Arena                                   '
'                            By Lucas Alonso                             '
' I made this simple but cool program a few years ago then  I came back  '                                                               
' and dug it up and did some severe streamlining and, well here it is.   '
'                  Press Z & X to change directions                      '
'I highly recommend that you edit the values below to get max performance'
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
lines = 1 'Do you want lines on the arena (1=y 0=n)
stars = 1 'Do you want stars on the arena (1=y 0=n)
circstar = 0 ' Change Stars into circles  (1=y 0=n)
numlines = 50 'The number of lines
numstars = 100 'number of stars
tail = 1 ' Do you want a tail following the point (if the program goes to fast add more 1=y 0=n)
delay = 50 ' If there is no tail the program is SO fast that you need a delay
length = 10 'Length of the tail that follows the point
cv = 15 'Color of the point
x = 320 ' X Starting place of the point
y = 240  ' X Starting place of the point
x1 = 1   'Direction in which the point will first travel X
y1 = 1   'Direction in which the point will first travel Y
IF tail = 1 THEN DIM OX(1000), OY(1000)  'Setting up the tail (if it exists)
IF tail = 1 THEN FOR a = 1 TO length: OX(a) = x: OY(a) = y: NEXT a  'Setting up the tail (if it exists)
setscreen lines, stars, numlines, numstars, circstar' Set the Screen With Your Values
'Main Loop
'No More Comments Beyond This Point (slows down program)
DO
IF tail <> 1 THEN PSET (x, y), 0
IF tail = 1 THEN OX(0) = x: OY(0) = y
IF tail = 1 THEN FOR a = length TO 1 STEP -1: OX(a) = OX(a - 1): OY(a) = OY(a - 1): NEXT a: OX(0) = x: OY(0) = y
countme = countme + 1
x = x + x1: y = y + y1
IF loopcounter = 1 THEN loopy = loopy + 1
IF POINT(x + x1, y) <> 0 THEN x1 = -x1:
IF POINT(x, y + y1) <> 0 THEN y1 = -y1:
IF tail = 1 THEN PSET (OX(length), OY(length)), 0
PSET (x, y), cv
IF tail <> 1 THEN
FOR ctr = 1 TO delay
NEXT ctr
END IF
SELECT CASE INKEY$
CASE "z"
x1 = -x1
CASE "x"
y1 = -y1
END SELECT
LOOP UNTIL INKEY$ = "q"

SUB setscreen (lines, stars, numlines, numstars, circstar)
SCREEN 12
LINE (0, 0)-(0, 479), 1
LINE (0, 479)-(640, 479), 1
LINE (639, 479)-(639, 0), 1
LINE (639, 0)-(0, 0), 1
IF lines = 1 THEN
FOR ctr = 1 TO numlines
RANDOMIZE TIMER
cirx = INT(RND * 560)
circy = INT(RND * 400)
t = INT(RND * 14) + 1
cirx2 = INT(RND * 560)
circy2 = INT(RND * 400)
growth = INT(RND * 100)
growth2 = INT(RND * 100)
IF t = 15 THEN t = 1
LINE (cirx, circy)-(cirx, circy + growth), t
LINE (cirx2, circy2)-(cirx2 + growth2, circy2), t
NEXT ctr
END IF
IF stars = 1 THEN
FOR d = 1 TO numstars
RANDOMIZE TIMER
starx = INT(RND * 640)
stary = INT(RND * 480)
c = INT(RND * 14) + 1
PSET (starx, stary), c
IF circstar = 1 THEN CIRCLE (starx, stary), INT(RND * 15), c
NEXT d
END IF
LOCATE 15, 30
PRINT "Please Press q To Quit"
END SUB

