[bb] Different Matrix 'Rain' by boomboom [ 1+ years ago ]

Started by BlitzBot, June 29, 2017, 00:28:43

Previous topic - Next topic

BlitzBot

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) Select
Graphics 480,600,0,2 ;Sets Graphics Mode

For i = 0 To GraphicsWidth() Step 15
cMatrixRain(1,i,Rnd#(1,12)) ;Create MatrixRain
Next

;MAIN LOOP
Repeat
uMatrixRain() ;Update MatrixRain
VWait ;Basic frame limiting
Until KeyHit(1)

; Matrix Rain Functions ----------------------------------
Type MatrixRain
Field Pointer%
Field PosX#
Field PosY#
Field Speed#
Field DelayCounter%
End Type
Function cMatrixRain(Pointer%, PosX#, Speed#)
TMatrixRain.MatrixRain = New MatrixRain
TMatrixRainPosX# = PosX#
TMatrixRainSpeed = Speed
TMatrixRainDelayCounter% = TMatrixRainSpeed
End Function
Function uMatrixRain()
For TMatrixRain.MatrixRain = Each MatrixRain
If TMatrixRainDelayCounter% = 0 Then
Color 0,Rnd(50,255),0
Text TMatrixRainPosX#,TMatrixRainPosY#,Chr$(Rnd(33,126))
TMatrixRainPosY# = TMatrixRainPosY# + 10
TMatrixRainDelayCounter% = TMatrixRainSpeed
Else
TMatrixRainDelayCounter% = TMatrixRainDelayCounter% - 1
End If

If TMatrixRainPosY# > GraphicsHeight() Then
Color 0,0,0
Rect TMatrixRainPosX#,0,10,GraphicsHeight()
TMatrixRainPosY# = 0
End If
Next
End Function
;=========================================================


Comments :


Ben(t)(Posted 1+ years ago)

 kewl