Random Pouring Water
#1
I was playing with water again today and came across this, so I thought I would put it here. It shows random streams of water pouring down. I first had PSET but changed to filled-in CIRCLE with an oblong shape for each drop. One important thing I finally learned is how to make a random number between a certain negative number and a positive number, just make both a positive and a negative and add them together. Took me long enough. LOL

Code: (Select All)
'Pouring Water by SierraKen - Aug. 27, 2022
Screen _NewImage(800, 600, 32)
Dim x(20000), y(20000), xx(20000)
For t = 1 To 20000
    x(t) = (Rnd * 100) + 350
    y(t) = (Rnd * 600)
Next t
Do
    _Limit 25
    a$ = InKey$
    If a$ = Chr$(27) Then End
    For t = 1 To 20000
        tt = tt + 1
        If tt > 100 And tt < 200 Then
            tt = 0
            ttt = ttt + 1
            If ttt > 20 Then ttt = 0
            xx(ttt) = xx(ttt) + (Rnd * 10) + (Rnd * -10)
        End If
        'Feel free to swap the PSET line and the circle loop, without the loop.
        'PSet (x(t) + xx(ttt), y(t)), _RGB32(127, 255, 255)
        For sz = .25 To Rnd * 4 Step .25
            Circle (x(t) + xx(ttt), y(t)), sz, _RGB32(127, 255, 255), , , 2.75
        Next sz
        y(t) = y(t) + .25
        If y(t) > 600 Then
            y(t) = 0
            x(t) = (Rnd * 100) + 350
            tt = 0
            ttt = 0
        End If
    Next t
    _Delay .01
    _Display
    Cls
Loop
Reply
#2
Cool... Reminds me of our roof gutters during a heavy rain...
May your journey be free of incident. Live long and prosper.
Reply
#3
LOL Thanks Johnno Smile.
Reply




Users browsing this thread: 3 Guest(s)