c'est amelioration du jeux celebre de microsoft DEMINEUR ,j'ais essyer d'ajouter des sons des accessoire amusant est surtout 4 niveau de dificultés
Source / Exemple :
Public init As Boolean
Dim tabl2() As Integer
Public nbmin As Integer
Public cmp As Integer
Public m As Integer
Public a As Integer
Public pos As Integer
Public vict As Integer
Private Sub Form_Load()
' reglage effet sonore
MMControl1.Notify = False
MMControl1.Wait = False
MMControl1.Shareable = False
MMControl1.DeviceType = "WaveAudio"
expert.Checked = False
normale.Checked = False
nbmin = 100
Timer1.Interval = 1
Text1.Text = "Bien venu sur la terre 'MODITE'!!"
Timer2.Interval = 1
Timer3.Enabled = False
MMControl1.FileName = App.Path & "\accessoires\sound\UTOPIA.wav"
son
End Sub
Private Sub Command1_Click(Index As Integer)
Text1.Text = "C pas mal continue!!"
Command1(Index).Visible = False
b = Command2(Index).Caption
If b = "Q" Then
Text1.Text = "Vous êtes mort mon pote!!"
MMControl1.FileName = App.Path & "\accessoires\sound\EXPLODE.wav"
son
Timer3.Enabled = True
For i = 0 To 399
If Command2(i).Caption = "Q" Then
Command2(i).BackColor = QBColor(12)
Command1(i).Visible = False
End If
Next
For i = 0 To 399
Command1(i).Enabled = False
Next
End If
If b = " " Then
Text1.Text = "Quelle chance!!"
MMControl1.FileName = App.Path & "\accessoires\sound\CHIMES.wav"
son
'faclité du jeux
For i = Index To Index + 200 Step 20
For j = 1 To 14
Select Case j
Case 1
p = i + 1
Case 2
p = i - 1
Case 3
p = i - 21
Case 4
p = i - 20
Case 5
p = i - 19
Case 6
p = i + 19
Case 7
p = i + 20
Case 8
p = i + 21
Case 9
p = i + 2
Case 10
p = i - 2
Case 11
p = i - 22
Case 12
p = i - 18
Case 13
p = i + 22
Case 14
p = i + 18
End Select
If i <= 399 Then
d = Command2(i).Caption
End If
If p <= 399 And p >= 0 Then
f = Command2(p).Caption
End If
If p <= 399 And p >= 0 And d = " " And f <> "Q" Then
Command1(p).Visible = False
End If
Next
Next
End If
If b <> "Q" Then
vict = 0
For i = 0 To 399
If Command1(i).Visible = True Then
vict = vict + 1
End If
Next
If vict = nbmin Then
Text1.Text = "Fellicitation!!"
MMControl1.FileName = App.Path & "\accessoires\sound\APPLAUSE.wav"
son
For j = 0 To 399
Command1(j).Enabled = False
Next
End If
End If
End Sub
Private Sub Command1_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
Static i As Integer
Static reg As Integer
If Button = 2 Then
Text1.Text = Str(Index)
If reg <> Index Then
i = 0
End If
If i = 0 Then
Command1(Index).Caption = "$"
reg = Index
i = i + 1
GoTo suite:
End If
If i = 1 Then
Command1(Index).Caption = " "
i = 0
End If
suite:
End If
End Sub
Private Sub Deminer_Click()
Static j As Integer
Static l As Integer
Static c As Integer
Static g As Integer
Dim tabl1(0 To 400) As Integer
MMControl1.FileName = App.Path & "\accessoires\sound\UTOPIA.wav"
son
If m = 1 Then
j = 0
l = 0
c = 0
n = 0
g = 0
i = 0
For t = 1 To 399
Unload Command1(t)
Unload Command2(t)
Next
m = 1
End If
For t = 1 To 399
Load Command1(t)
Load Command2(t)
Next
For t = 0 To 399
Command1(t).Visible = False
Command1(t).Enabled = False
Command1(t).Caption = " "
Command2(t).Caption = " "
Command2(t).ForeColor = QBColor(0)
Command2(t).BackColor = QBColor(7)
Next
'remplissage d'un tableau contenant les nombre aleatoires de 0 a 399
For i = 1 To 200
Timer1_Timer
Timer1.Enabled = False
tabl1(i) = a
For k = 1 To 200
If tabl1(i) = tabl1(k) And i <> k Then
i = i - 1
End If
Next
Next
' creation du champ de mines
For t = 0 To 399
Command1(t).Enabled = True
Next
m = 1
' distribution aleatoire des mines
l = 0
For i = 0 To 399
Command1(i).Top = 2200 + 250 * l
Command1(i).Visible = True
Command1(i).Left = 650 + 80 * c
Command2(i).Top = 2200 + 250 * l
Command2(i).Visible = True
Command2(i).Left = 650 + 80 * c
If i <= nbmin - 1 Then
Command2(tabl1(i + 1)).Caption = "Q"
End If
j = j + 1
l = l + 1
If j = 20 Then
j = 0
l = 0
c = c + 3
End If
Next
'calcule du nombre de bombe entourant chaque carré vide
For i = 1 To 398
b = Command2(i).Caption
' Elimination des valeur de periode i+20 et i+19
per = True
For r = 19 To 399 Step 20
If i = r Then
per = False
End If
Next
For r = 0 To 380 Step 20
If i = r Then
per = False
End If
Next
If b = " " And per Then
cmp = i
pos = 1
comptage
End If
per = True
Next
' calcule de nombre de bombes dans les bord du champs de mines
For i = 39 To 379 Step 20
b = Command2(i).Caption
If b = " " Then
cmp = i
pos = 2
comptage
End If
Next
For i = 20 To 360 Step 20
b = Command2(i).Caption
If b = " " Then
cmp = i
pos = 3
comptage
End If
Next
' calcule de nombre de bombes dans les coins du champs de mines
For i = 0 To 399
pos = 0
b = Command2(i).Caption
If i = 0 Then
pos = 4
End If
If i = 19 Then
pos = 5
End If
If i = 380 Then
pos = 6
End If
If i = 399 Then
pos = 7
End If
If b = " " Then
cmp = i
comptage
End If
Next
End Sub
Private Sub expert_Click()
expert.Checked = True
normale.Checked = False
debut.Checked = False
nbmin = 150
End Sub
Private Sub debut_Click()
debut.Checked = True
expert.Checked = False
normale.Checked = False
nbmin = 50
End Sub
Private Sub normale_Click()
normale.Checked = True
expert.Checked = False
debut.Checked = False
nbmin = 100
End Sub
Private Sub NOUVJ_Click()
Deminer_Click
End Sub
Private Sub quiter_Click()
End
End Sub
Public Sub son()
MMControl1.Command = "close"
MMControl1.Command = "open"
MMControl1.DeviceType = "WaveAudio"
MMControl1.Notify = False
MMControl1.Wait = False
MMControl1.Command = "play"
End Sub
Private Sub Timer1_Timer()
a = Int(399 * Rnd + 1)
End Sub
Private Sub Timer2_Timer()
Text1.Text = "Clicker sur DEMINER Pour Commencer.."
Timer2.Enabled = False
End Sub
Private Sub Timer3_Timer()
Text1.Text = "Clicker sur DEMINER Pour Recommencer.."
Timer3.Enabled = False
End Sub
Private Sub Command1_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
Deminer.SetFocus
End Sub
Private Sub comptage()
Static n As Integer
For j = 1 To 8
bande = False
Select Case j
Case 1
p = cmp + 19
Case 2
p = cmp - 1
Case 3
p = cmp - 21
Case 4
p = cmp - 20
Case 5
p = cmp + 20
Case 6
p = cmp + 1
Case 7
p = cmp + 21
Case 8
p = cmp - 19
End Select
Select Case pos
Case 1
bande = True
Case 2
If j <= 5 Then
bande = True
End If
Case 3
If j >= 4 Then
bande = True
End If
Case 4
If j >= 5 And j <= 7 Then
bande = True
End If
Case 5
If j <= 5 And j <> 3 And j <> 4 Then
bande = True
End If
Case 6
If j >= 4 And j <> 7 And j <> 5 Then
bande = True
End If
Case 7
If j >= 2 And j <= 4 Then
bande = True
End If
End Select
If bande = True And p <= 399 And p >= 0 Then
d = Command2(p).Caption
If d = "Q" Then
n = n + 1
End If
End If
Next
If n <> 0 Then
Select Case n
Case 2
Command2(cmp).ForeColor = QBColor(2)
Case 3
Command2(cmp).ForeColor = QBColor(9)
Case 4
Command2(cmp).ForeColor = QBColor(5)
Case 5
Command2(cmp).ForeColor = QBColor(12)
Case 6
Command2(cmp).ForeColor = QBColor(5)
Case 7
Command2(cmp).ForeColor = QBColor(4)
End Select
Command2(cmp).Caption = Str(n)
n = 0
End If
End Sub
Conclusion :
je m'excuse la dernier source n'etait pas assez claire et ne contient pas de zip , et je remercier aussi tous ceux qui mon ecrit et donner leur avis sur ma source
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.