0/5 (10 avis)
Vue 5 327 fois - Téléchargée 254 fois
Dim XYTab(1 To 60, 1) As Integer, CTab(1 To 420) As String * 1 Private Sub Form_Click() 'on clique pour quitter End End Sub Private Sub Timer1_Timer() Dim i As Integer For i = 1 To 60 If XYTab(i, 1) > Height Or XYTab(i, 1) = 0 Then 'initialisation ou bordure XYTab(i, 0) = Int(Rnd * Width) XYTab(i, 1) = Int(Rnd * Height) End If Next i Cls For i = 1 To 420 If Rnd > 0.8 Then CTab(i) = Chr(Rnd * 255) CurrentX = XYTab(i - 60 * Int(i / 60) + 1, 0) CurrentY = XYTab(i - 60 * Int(i / 60) + 1, 1) - i * 3 XYTab(i - 60 * Int(i / 60) + 1, 1) = XYTab(i - 60 * Int(i / 60) + 1, 1) + 10 ForeColor = RGB(0, 255 - 10 * (Int(i / 30)), 0) Print CTab(i) 'on affiche Next i End Sub
22 mai 2003 à 18:30
Pour WhiteDwarf : tu as raison : il n'y en a aucun. En fait si : il y en a un, je pense que tu n'as pas regardé le code de kilomaster ! Mon code donne le même effet (certes avec quelques fonctionnalités de moins) mais en 5 fois moins de lignes de code... l'obtimisation est à mes yeux un 'interret' comme tu dis...
21 mai 2003 à 20:42
21 mai 2003 à 18:11
Dim XTab(1 To 60) As Integer,YTab(1 To 60) As Integer , CTab(1 To 420) As String * 1
Private Sub Form_Load()
For i = 1 To 60
If YTab(i) > Height Or YTab(i) = 0 Then 'initialisation ou bordure
XTab(i) = Int(Rnd * Width)
YTab(i) = Int(Rnd * Height)
End If
Next i
End Sub
Private Sub Timer1_Timer()
Dim i As Integer
Cls
For i = 1 To 420
if i<60 then
If YTab(i) > Height Or YTab(i) = 0 Then
XTab(i) = Int(Rnd * Width)
YTab(i) = Int(Rnd * Height)
End If
End if
If Rnd > 0.8 Then CTab(i) = Chr(Rnd * 255)
CurrentX = XTab(i - 60 * Int(i / 60) + 1)
CurrentY = YTab(i - 60 * Int(i / 60) + 1) - i * 3
YTab(i - 60 * Int(i / 60) + 1) = YTab(i - 60 * Int(i / 60) + 1) + 10
ForeColor = RGB(0, 255 - 10 * (Int(i / 30)), 0)
Print CTab(i) 'on affiche
Next i
End Sub
Je dit sa dememe mais de cet maniere on execute seulement un for dans le timer ce qui fait que l'execution est plus rapide
dans le timer et sa ne fait pas laguer le reste du prog...
@++
21 mai 2003 à 12:11
21 mai 2003 à 03:56
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.