Petite matrix simple et efficace

Description

Salut, j'ai fait un petit matrix.
C'est mon premier programme qui simule matrix.
Pouvez vous me dire ce que vous en pensez?
Merci.

Source / Exemple :


Dim Char As String

Private Type Matrix
X As Long
Y As Long
Car As String
Fin As Boolean
Color As Long
End Type

Dim Matrox(1 To 210) As Matrix

Private Sub Form_Load()

Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim l As Integer
Dim m As Integer
Dim n As Integer
Dim o As Integer

j = 0
i = 0
k = 0
l = 0
m = 0
n = 0
o = 0

Char = "01234.?!§ù%µ?°56789*$£€&~#"
'Char = "0123456789"

Me.BackColor = &H0&
'Me.Font.Size = 12

For i = 1 To 30
Randomize
    Matrox(i).Car = Mid(Char, Int(Rnd * Len(Char)) + 1, 1)
    Matrox(i).X = Int(Rnd * Me.Width)
    Matrox(i).Y = Int(Rnd * Me.Height)
    Matrox(i).Color = RGB(0, 255, 0)

Next i

For j = 31 To 60
Randomize
    Matrox(j).Car = Mid(Char, Int(Rnd * Len(Char)) + 1, 1)
    Matrox(j).X = Matrox(j - 15).X 'Int(Rnd * Me.Width)
    Matrox(j).Color = RGB(0, 220, 0)

Next j

For k = 61 To 90
Randomize
    Matrox(k).Car = Mid(Char, Int(Rnd * Len(Char)) + 1, 1)
    Matrox(k).X = Matrox(k - 15).X 'Int(Rnd * Me.Width)
    Matrox(k).Color = RGB(0, 190, 0)

Next k

For l = 91 To 120
Randomize
    Matrox(l).Car = Mid(Char, Int(Rnd * Len(Char)) + 1, 1)
    Matrox(l).X = Matrox(l - 15).X 'Int(Rnd * Me.Width)
    Matrox(l).Color = RGB(0, 175, 0)

Next l

For m = 121 To 150
Randomize
    Matrox(m).Car = Mid(Char, Int(Rnd * Len(Char)) + 1, 1)
    Matrox(m).X = Matrox(k - 15).X 'Int(Rnd * Me.Width)
    Matrox(m).Color = RGB(0, 150, 0)

Next m

For n = 151 To 180
Randomize
    Matrox(n).Car = Mid(Char, Int(Rnd * Len(Char)) + 1, 1)
    Matrox(n).X = Matrox(k - 15).X 'Int(Rnd * Me.Width)
    Matrox(n).Color = RGB(0, 120, 0)

Next n

For o = 181 To 210
Randomize
    Matrox(o).Car = Mid(Char, Int(Rnd * Len(Char)) + 1, 1)
    Matrox(o).X = Matrox(k - 15).X 'Int(Rnd * Me.Width)
    Matrox(o).Color = RGB(0, 100, 0)

Next o

End Sub

Private Sub Timer1_Timer()

Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim l As Integer
Dim m As Integer
Dim n As Integer
Dim o As Integer

j = 0
i = 0
k = 0
l = 0
m = 0
n = 0
o = 0

Me.Cls

For i = 1 To 30
Randomize
    If Matrox(i).Y >= Me.ScaleHeight + 600 Then Matrox(i).X = Int(Rnd * Me.Width): Matrox(i).Y = Int(Rnd * Me.Height): Matrox(i).Car = Mid(Char, Int(Rnd * Len(Char)) + 1, 1)
    
    Matrox(i).Y = Matrox(i).Y + 120
    Me.CurrentX = Matrox(i).X
    Me.CurrentY = Matrox(i).Y
    Me.ForeColor = Matrox(i).Color
    'Matrox(i).Car = Mid(Char, Int(Rnd * Len(Char)) + 1, 1)
    Me.Font.Bold = True
    Me.Print Matrox(i).Car
    
Next i

For j = 31 To 60

Randomize
    
    Matrox(j).Y = Matrox(j - 30).Y - 200
    Me.CurrentX = Matrox(j - 30).X
    Me.CurrentY = Matrox(j).Y
    Me.ForeColor = Matrox(j).Color
    Me.Font.Bold = True
    Me.Print Matrox(j).Car

Next j

For k = 61 To 90

Randomize
    
    Matrox(k).Y = Matrox(k - 60).Y - 400
    Me.CurrentX = Matrox(k - 60).X
    Me.CurrentY = Matrox(k).Y
    Me.ForeColor = Matrox(k).Color
    Me.Font.Bold = True
    Me.Print Matrox(k).Car

Next k

For l = 91 To 120

Randomize
    
    Matrox(l).Y = Matrox(l - 90).Y - 600
    Me.CurrentX = Matrox(l - 90).X
    Me.CurrentY = Matrox(l).Y
    Me.ForeColor = Matrox(l).Color
    Me.Font.Bold = True
    Me.Print Matrox(l).Car

Next l

For m = 121 To 150

Randomize
    
    Matrox(m).Y = Matrox(m - 120).Y - 800
    Me.CurrentX = Matrox(m - 120).X
    Me.CurrentY = Matrox(m).Y
    Me.ForeColor = Matrox(m).Color
    Me.Font.Bold = True
    Me.Print Matrox(m).Car

Next m

For n = 151 To 180

Randomize
    
    Matrox(n).Y = Matrox(n - 150).Y - 1000
    Me.CurrentX = Matrox(n - 150).X
    Me.CurrentY = Matrox(n).Y
    Me.ForeColor = Matrox(n).Color
    Me.Font.Bold = True
    Me.Print Matrox(n).Car

Next n

For o = 181 To 210

Randomize
    
    Matrox(o).Y = Matrox(o - 180).Y - 1200
    Me.CurrentX = Matrox(o - 180).X
    Me.CurrentY = Matrox(o).Y
    Me.ForeColor = Matrox(o).Color
    Me.Font.Bold = True
    Me.Print Matrox(o).Car

Next o

End Sub

Conclusion :


Mettez vos commentaires please.
@++

Codes Sources

A voir également

Vous n'êtes pas encore membre ?

inscrivez-vous, c'est gratuit et ça prend moins d'une minute !

Les membres obtiennent plus de réponses que les utilisateurs anonymes.

Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.

Le fait d'être membre vous permet d'avoir des options supplémentaires.