11-01-2025, 08:35 AM
Thanks. Appreciate it.
Here is the multi-pipe one, fixed a bug too
Here is the multi-pipe one, fixed a bug too

Code: (Select All)
Screen _NewImage(_DesktopWidth, _DesktopHeight, 32)
_MouseHide
Randomize Timer
_FullScreen _SquarePixels
_Font 8
DefLng A-Z
TW = _Width / _FontWidth
TH = _Height / _FontHeight
Type PipeHead
As _Unsigned _Byte R, G, B
As Integer X, Y
As _Unsigned _Byte D, nD, oD
End Type
Dim As PipeHead Pipes(1 To 16)
For I = 1 To UBound(Pipes)
Pipes(I).X = Rnd * TW
Pipes(I).Y = Rnd * TH
Pipes(I).D = Int(Rnd * 4)
Pipes(I).nD = 0
Pipes(I).oD = Pipes(I).D
Pipes(I).R = 128 + Rnd * 127
Pipes(I).G = 128 + Rnd * 127
Pipes(I).B = 128 + Rnd * 127
Next I
Do
T~%% = (T~%% + 1) Mod 60
If T~%% = 0 Then Line (0, 0)-(_Width - 1, _Height - 1), &H0F000000, BF
_Limit 60
For I = 1 To UBound(Pipes)
If Rnd < 0.1 And Rnd < 0.5 Then Pipes(I).nD = Int(Rnd * 3) + 1 Else Pipes(I).nD = 2
Pipes(I).nD = ClampCycle(0, Pipes(I).D - Pipes(I).nD + 2, 3)
Select Case Pipes(I).D
Case 0: Pipes(I).X = Pipes(I).X + 1
Case 1: Pipes(I).Y = Pipes(I).Y + 1
Case 2: Pipes(I).X = Pipes(I).X - 1
Case 3: Pipes(I).Y = Pipes(I).Y - 1
End Select
If Pipes(I).X < 0 Or Pipes(I).X >= TW Or Pipes(I).Y < 0 Or Pipes(I).Y >= TH Then
Pipes(I).R = 128 + Rnd * 127
Pipes(I).G = 128 + Rnd * 127
Pipes(I).B = 128 + Rnd * 127
End If
Color _RGB32(Pipes(I).R, Pipes(I).G, Pipes(I).B), &HFF000000
Pipes(I).X = ClampCycle(0, Pipes(I).X, TW - 1)
Pipes(I).Y = ClampCycle(0, Pipes(I).Y, TH - 1)
Select Case _SHL(Pipes(I).nD, 2) Or Pipes(I).oD
Case 0, 10: C = 196
Case 5, 15: C = 179
Case 1, 14: C = 192
Case 4, 11: C = 191
Case 3, 6: C = 218
Case 9, 12: C = 217
End Select
_PrintString (Pipes(I).X * _FontWidth, Pipes(I).Y * _FontHeight), Chr$(C)
Pipes(I).D = Pipes(I).nD
Pipes(I).oD = Pipes(I).D
Next I
_Display
Loop Until (_MouseInput And (_MouseButton(1) Or _MouseButton(2) Or _MouseButton(3))) Or InKey$ <> ""
System
Function Clamp (A, B, C)
Clamp = B - (A - B) * (B < A) - (C - B) * (C < B)
End Function
Function ClampCycle (A, B, C)
ClampCycle = B - (C - B) * (B < A) - (A - B) * (C < B)
End Function]

