Objet bondissant !!!

Description

VOICI UN OBJET QUI VA REBONDIRE SUR VOTRE ÉCRAN !!
Quand j'ai vu qu'il y avait un gars qui avait mis un post qui ne marchait même pas ben aujourd'hui j'ai décidé d'en faire un en 10 minutes même pas... Voilà... Lui il marche !!!

Source / Exemple :


'PAR ATH|500|
'DANS LA FORM1
Dim droit As Integer
Dim gauche As Integer
Dim haut As Integer
Dim bas As Integer
Dim direction As Integer
Dim direction2 As Integer
Private Sub Command1_Click()
Command1.Visible = False
Do
DoEvents
Randomize
direction = Int(Rnd * 2) + 1
If Image1.Left > Form1.Width Then
Do
DoEvents
If direction = 1 _
Then direction2 = -10
If direction = 2 _
Then direction2 = 10
Image1.Left = Image1.Left - 10
Image1.Top = Image1.Top + direction2
Loop Until Image1.Left < 10 Or Image1.Top > Form1.Height Or Image1.Top < 10
son = sndPlaySound(App.Path + "\cli3.wav", &H1)
End If
Randomize
direction = Int(Rnd * 2) + 1
If Image1.Top > Form1.Height Then
Do
DoEvents
If direction = 1 _
Then direction2 = -10
If direction = 2 _
Then direction2 = 10
Image1.Left = Image1.Left + direction2
Image1.Top = Image1.Top - 10
Loop Until Image1.Left < 10 Or Image1.Top < 10 Or Image1.Left > Form1.Width
son = sndPlaySound(App.Path + "\cli3.wav", &H1)
End If
direction = Int(Rnd * 2) + 1
If Image1.Left < 15 Then
Do
DoEvents
If direction = 1 _
Then direction2 = -10
If direction = 2 _
Then direction2 = 10
Image1.Left = Image1.Left + 10
Image1.Top = Image1.Top + direction2
Loop Until Image1.Top < 10 Or Image1.Left > Form1.Width Or Image1.Top > Form1.Height
son = sndPlaySound(App.Path + "\cli3.wav", &H1)
End If
direction = Int(Rnd * 2) + 1
If Image1.Top < 15 Then
Do
DoEvents
If direction = 1 _
Then direction2 = -10
If direction = 2 _
Then direction2 = 10
Image1.Top = Image1.Top + 10
Image1.Left = Image1.Left + direction2
Loop Until Image1.Left > Form1.Width Or Image1.Top > Form1.Height Or Image1.Left < 10
son = sndPlaySound(App.Path + "\cli3.wav", &H1)
End If
Loop
End Sub

'DANS UN MODULE
Declare Function sndPlaySound Lib "WINMM.DLL" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long

Conclusion :


BONNE PROG ! AMusé vous bien !!!

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.