Voici un code de collision que j'ai fais.
Je voudrais savoir si le clignottement de l'image vien de mon code ou de ma carte graphique.
Si quelqu'un peut le sais, merci de répondre.
Source / Exemple :
Private Function Random(ByVal lmax As Long) As Long
Random = CLng(lmax * Rnd)
End Function
Private Sub Timer1_Timer()
Static lmoveX As Long
Static lmoveY As Long
If lmoveX = 0 Then lmoveX = 1000
If lmoveY = 0 Then lmoveY = 1000
Shape1.Left = Shape1.Left + lmoveX
If Shape1.Left < 1 Then
Shape1.Left = 1
lmoveX = Random(1000) + 1
ElseIf Shape1.Left + Shape1.Width > Form1.ScaleWidth Then
Shape1.Left = Form1.ScaleWidth - Shape1.Width - 1
lmoveX = Random(1000) - 1000
End If
Shape1.Top = Shape1.Top + lmoveY
If Shape1.Top < 1 Then
Shape1.Top = 1
lmoveY = Random(1000) + 1
ElseIf Shape1.Top + Shape1.Height > Form1.ScaleHeight Then
Shape1.Top = Form1.ScaleHeight - Shape1.Height - 1
lmoveY = Random(1000) - 1000
End If
End Sub
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.