October 28, 2020, 11:32:15 PM

### Author Topic: [bb] Different Matrix 'Rain' by boomboom [ 1+ years ago ]  (Read 1518 times)

#### BlitzBot

• Jr. Member
• Posts: 1
##### [bb] Different Matrix 'Rain' by boomboom [ 1+ years ago ]
« on: June 29, 2017, 12:28:43 AM »
Title : Different Matrix 'Rain'
Author : boomboom
Posted : 1+ years ago

Description : This is a different style of the Matrix 'Rain' code found in the Matrix Movies, and is similer to the 'Matrix Screen Locker' look

Code :
Code: BlitzBasic
1. Graphics 480,600,0,2 ;Sets Graphics Mode
2.
3. For i = 0 To GraphicsWidth() Step 15
4.         cMatrixRain(1,i,Rnd#(1,12)) ;Create MatrixRain
5. Next
6.
7. ;MAIN LOOP
8. Repeat
9.         uMatrixRain() ;Update MatrixRain
10.         VWait ;Basic frame limiting
11. Until KeyHit(1)
12.
13. ; Matrix Rain Functions ----------------------------------
14. Type MatrixRain
15.         Field Pointer%
16.         Field PosX#
17.         Field PosY#
18.         Field Speed#
19.         Field DelayCounter%
20. End Type
21. Function cMatrixRain(Pointer%, PosX#, Speed#)
22.         TMatrixRain.MatrixRain = New MatrixRain
23.         TMatrixRainPosX# = PosX#
24.         TMatrixRainSpeed = Speed
25.         TMatrixRainDelayCounter% = TMatrixRainSpeed
26. End Function
27. Function uMatrixRain()
28.         For TMatrixRain.MatrixRain = Each MatrixRain
29.                 If TMatrixRainDelayCounter% = 0 Then
30.                         Color 0,Rnd(50,255),0
31.                         Text TMatrixRainPosX#,TMatrixRainPosY#,Chr\$(Rnd(33,126))
32.                         TMatrixRainPosY# = TMatrixRainPosY# + 10
33.                         TMatrixRainDelayCounter% = TMatrixRainSpeed
34.                 Else
35.                         TMatrixRainDelayCounter% = TMatrixRainDelayCounter% - 1
36.                 End If
37.
38.                 If TMatrixRainPosY# > GraphicsHeight() Then
39.                         Color 0,0,0
40.                         Rect TMatrixRainPosX#,0,10,GraphicsHeight()
41.                         TMatrixRainPosY# = 0
42.                 End If
43.         Next
44. End Function
45. ;=========================================================