Qbasicnews.com

Full Version: I made a version of that screensaver I have now...
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Mystify I think it is? I wanted to see if I could... I can't get the multiple lines to follow it though, too much work for me.

Code:
DEFINT A-Z
RANDOMIZE TIMER
CONST xBound = 310, yBound = 190
SCREEN 13
CLS

TYPE allDots
        x AS SINGLE
        y AS SINGLE
        xAngle AS SINGLE
        yAngle AS SINGLE
END TYPE

INPUT "How many sides?", numDots
SCREEN 7, , 0, 1

DIM Dot(1 TO numDots) AS allDots

FOR i = 1 TO numDots
        Dot(i).xAngle = (1.8 * RND) + .7
        Dot(i).yAngle = (1.8 * RND) + .7

        Dot(i).x = 14
        Dot(i).y = 14
NEXT i

DO UNTIL key$ <> ""
        key$ = INKEY$
        PCOPY 0, 1

        CLS
        FOR i = 1 TO numDots
                LINE (Dot(i).x, Dot(i).y)-(Dot(i).x + 2, Dot(i).y + 2), 0, BF
              
                IF Dot(i).x > xBound OR Dot(i).x < 10 THEN Dot(i).xAngle = (1.8 * RND + .7) * -SGN(Dot(i).xAngle)
                IF Dot(i).y > yBound OR Dot(i).y < 10 THEN Dot(i).yAngle = (1.8 * RND + .7) * -SGN(Dot(i).yAngle)
                Dot(i).x = Dot(i).x + Dot(i).xAngle
                Dot(i).y = Dot(i).y + Dot(i).yAngle
                                                          
                LINE (Dot(i).x, Dot(i).y)-(Dot(i).x + 2, Dot(i).y + 2), 14, BF
        NEXT i
        FOR i = 1 TO numDots - 1
                LINE (Dot(i).x, Dot(i).y)-(Dot(i + 1).x + 2, Dot(i + 1).y + 2), 14
        NEXT i
        LINE (Dot(1).x, Dot(1).y)-(Dot(numDots).x + 2, Dot(numDots).y + 2), 14
LOOP
Cool! Try to get this down to 9 lines so it can be entered into the competition @ QBNZ.
Hints: Use lots of GOTOs.