Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Mystify - Screen Saver Similar to Windows 98 Mystify from the 1990's.
#1
Mystify.bas by Bob Seguin
[Image: Screenshot-633.png]
Description: Screen saver.

Code: (Select All)
_TITLE "Mystify.bas by Bob Seguin"
_FULLSCREEN

TYPE MovingPolyType
    x AS INTEGER
    y AS INTEGER
    IncX AS INTEGER
    IncY AS INTEGER
END TYPE

TYPE HoldingPolysType
    x AS INTEGER
    y AS INTEGER
END TYPE

DIM Co(1 TO 8) AS MovingPolyType
DIM Slots(1 TO 11, 1 TO 8) AS HoldingPolysType

DEFINT A-Z

'Establish random starting coordinates and x/y increments for polygons

SCREEN 12

RANDOMIZE TIMER

FOR n = 1 TO 8
    Co(n).x = INT(RND * 400) + 1
    Co(n).y = INT(RND * 240) + 1
    Rand = INT(RND * 2) + 1
    SELECT CASE Rand
        CASE 1
            Co(n).IncX = -INT(RND * 12) + 1
        CASE 2
            Co(n).IncX = INT(RND * 12) + 1
    END SELECT
    Rand = INT(RND * 2) + 1
    SELECT CASE Rand
        CASE 1
            Co(n).IncY = -INT(RND * 12) + 1
        CASE 2
            Co(n).IncY = INT(RND * 12) + 1
    END SELECT
NEXT n

FOR Reps = 1 TO 8
    Slots(1, Reps).x = Co(Reps).x + 119: Slots(1, Reps).y = Co(Reps).y + 119
NEXT Reps

OneSwitch = 1
ThreeSwitch = 1

One = 16
Three = 52

PALETTE 0, 655360
PALETTE 4, 63

GOSUB ColorSet

ON TIMER(1) GOSUB ColorSet

TIMER ON

DO

    FOR n = 1 TO 8
        GOSUB Direction
    NEXT n

    FOR Reps = 11 TO 2 STEP -1
        FOR Pots = 1 TO 8
            Slots(Reps, Pots).x = Slots(Reps - 1, Pots).x
            Slots(Reps, Pots).y = Slots(Reps - 1, Pots).y
        NEXT Pots
    NEXT Reps
    'For this small-area-of-activity version, new coordinates are assigned
    'and set to occur center screen (+ 119).
    FOR Pots = 1 TO 8
        Slots(1, Pots).x = Co(Pots).x + 119
        Slots(1, Pots).y = Co(Pots).y + 119
    NEXT Pots
    'Erase last polygon
    LINE (Slots(11, 1).x, Slots(11, 1).y)-(Slots(11, 2).x, Slots(11, 2).y), 0
    LINE (Slots(11, 2).x, Slots(11, 2).y)-(Slots(11, 3).x, Slots(11, 3).y), 0
    LINE (Slots(11, 3).x, Slots(11, 3).y)-(Slots(11, 4).x, Slots(11, 4).y), 0
    LINE (Slots(11, 4).x, Slots(11, 4).y)-(Slots(11, 1).x, Slots(11, 1).y), 0
    LINE (Slots(11, 5).x, Slots(11, 5).y)-(Slots(11, 6).x, Slots(11, 6).y), 0
    LINE (Slots(11, 6).x, Slots(11, 6).y)-(Slots(11, 7).x, Slots(11, 7).y), 0
    LINE (Slots(11, 7).x, Slots(11, 7).y)-(Slots(11, 8).x, Slots(11, 8).y), 0
    LINE (Slots(11, 8).x, Slots(11, 8).y)-(Slots(11, 5).x, Slots(11, 5).y), 0

    'Draw new first polygons and redraw existing polygons so that all the
    'erasures are overdrawn, all polygons take on the updated color, and
    'the second-color polygons overdraw the first-color polygons.

    WAIT &H3DA, 8
    WAIT &H3DA, 8, 8

    FOR Reps = 1 TO 10
        IF Slots(Reps, 1).x <> 0 THEN
            LINE (Slots(Reps, 1).x, Slots(Reps, 1).y)-(Slots(Reps, 2).x, Slots(Reps, 2).y), 1
            LINE (Slots(Reps, 2).x, Slots(Reps, 2).y)-(Slots(Reps, 3).x, Slots(Reps, 3).y), 1
            LINE (Slots(Reps, 3).x, Slots(Reps, 3).y)-(Slots(Reps, 4).x, Slots(Reps, 4).y), 1
            LINE (Slots(Reps, 4).x, Slots(Reps, 4).y)-(Slots(Reps, 1).x, Slots(Reps, 1).y), 1
        END IF
    NEXT Reps
    FOR Reps = 1 TO 10
        IF Slots(Reps, 1).x <> 0 THEN
            LINE (Slots(Reps, 5).x, Slots(Reps, 5).y)-(Slots(Reps, 6).x, Slots(Reps, 6).y), 2
            LINE (Slots(Reps, 6).x, Slots(Reps, 6).y)-(Slots(Reps, 7).x, Slots(Reps, 7).y), 2
            LINE (Slots(Reps, 7).x, Slots(Reps, 7).y)-(Slots(Reps, 8).x, Slots(Reps, 8).y), 2
            LINE (Slots(Reps, 8).x, Slots(Reps, 8).y)-(Slots(Reps, 5).x, Slots(Reps, 5).y), 2
        END IF
    NEXT Reps

LOOP UNTIL INKEY$ <> ""
TIMER OFF
CLS
SYSTEM

Direction:
SELECT CASE Co(n).x
    CASE IS <= 0
        Co(n).IncX = INT(RND * 12) + 1
    CASE IS >= 399
        Co(n).IncX = -INT(RND * 12) + 1
END SELECT
SELECT CASE Co(n).y
    CASE IS <= 0
        Co(n).IncY = INT(RND * 12) + 1
    CASE IS >= 239
        Co(n).IncY = -INT(RND * 12) + 1
END SELECT
Co(n).x = Co(n).x + Co(n).IncX
Co(n).y = Co(n).y + Co(n).IncY
RETURN

ColorSet:
SELECT CASE OneSwitch
    CASE 1
        One = One + 1
        IF One = 63 THEN OneSwitch = 0
    CASE 0
        One = One - 1
        IF One = 0 THEN OneSwitch = 1
END SELECT
SELECT CASE ThreeSwitch
    CASE 1
        Three = Three + 1
        IF Three = 63 THEN ThreeSwitch = 0
    CASE 0
        Three = Three - 1
        IF Three = 0 THEN ThreeSwitch = 1
END SELECT
PALETTE 1, 2490368 + ((63 - Three) * 256) + One
PALETTE 2, (Three * 65536) + ((63 - One) * 256) + 38
RETURN


Messages In This Thread
Mystify - Screen Saver Similar to Windows 98 Mystify from the 1990's. - by Pete - 04-26-2022, 02:15 AM



Users browsing this thread: 1 Guest(s)