tirage aléatoire simulant le jet de six baguettes gravée de symbole
gestion d'entré de nouveau joueur en cours de partie
pour ce qui est de l'image de fond pour les objet image
il vous suffit de trouver une belle texture de bois (remplacez form1.frx par toto.jpg)
Source / Exemple :
VERSION 5.00
Begin VB.Form Form1
BackColor = &H0000FF00&
Caption = "Form1"
ClientHeight = 6945
ClientLeft = 660
ClientTop = 1230
ClientWidth = 12345
LinkTopic = "Form1"
ScaleHeight = 6945
ScaleWidth = 12345
Begin VB.Frame Frame1
Height = 825
Index = 6
Left = 7020
TabIndex = 34
ToolTipText = "DoubleClick : créer le joueur | click droit : effacer | (IMPORTANT: inscription à la suite)"
Top = 5175
Width = 5280
Begin VB.CheckBox Check1
Height = 285
Index = 6
Left = 225
TabIndex = 38
Top = 315
Width = 240
End
Begin VB.TextBox calcul
BeginProperty Font
Name = "Papyrus"
Size = 14.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 420
Index = 6
Left = 855
Locked = -1 'True
TabIndex = 37
Text = "calcul"
ToolTipText = "Produit X Somme"
Top = 270
Width = 2220
End
Begin VB.TextBox score
BeginProperty Font
Name = "Optimum"
Size = 14.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 420
Index = 6
Left = 3150
Locked = -1 'True
TabIndex = 36
Text = "score"
Top = 270
Width = 1995
End
Begin VB.CheckBox Check2
Height = 285
Index = 6
Left = 495
TabIndex = 35
ToolTipText = "utiliser la sixième baguette"
Top = 315
Width = 240
End
End
Begin VB.Frame Frame1
Height = 825
Index = 5
Left = 7020
TabIndex = 29
ToolTipText = "DoubleClick : créer le joueur | click droit : effacer | (IMPORTANT: inscription à la suite)"
Top = 4320
Width = 5280
Begin VB.CheckBox Check1
Height = 285
Index = 5
Left = 225
TabIndex = 33
Top = 315
Width = 240
End
Begin VB.TextBox calcul
BeginProperty Font
Name = "Papyrus"
Size = 14.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 420
Index = 5
Left = 855
Locked = -1 'True
TabIndex = 32
Text = "calcul"
ToolTipText = "Produit X Somme"
Top = 270
Width = 2220
End
Begin VB.TextBox score
BeginProperty Font
Name = "Optimum"
Size = 14.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 420
Index = 5
Left = 3150
Locked = -1 'True
TabIndex = 31
Text = "score"
Top = 270
Width = 1995
End
Begin VB.CheckBox Check2
Height = 285
Index = 5
Left = 495
TabIndex = 30
ToolTipText = "utiliser la sixième baguette"
Top = 315
Width = 240
End
End
Begin VB.Frame Frame1
Height = 825
Index = 4
Left = 7020
TabIndex = 24
ToolTipText = "DoubleClick : créer le joueur | click droit : effacer | (IMPORTANT: inscription à la suite)"
Top = 3465
Width = 5280
Begin VB.CheckBox Check1
Height = 285
Index = 4
Left = 225
TabIndex = 28
Top = 315
Width = 240
End
Begin VB.TextBox calcul
BeginProperty Font
Name = "Papyrus"
Size = 14.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 420
Index = 4
Left = 855
Locked = -1 'True
TabIndex = 27
Text = "calcul"
ToolTipText = "Produit X Somme"
Top = 270
Width = 2220
End
Begin VB.TextBox score
BeginProperty Font
Name = "Optimum"
Size = 14.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 420
Index = 4
Left = 3150
Locked = -1 'True
TabIndex = 26
Text = "score"
Top = 270
Width = 1995
End
Begin VB.CheckBox Check2
Height = 285
Index = 4
Left = 495
TabIndex = 25
ToolTipText = "utiliser la sixième baguette"
Top = 315
Width = 240
End
End
Begin VB.Frame Frame1
Height = 825
Index = 3
Left = 7020
TabIndex = 19
ToolTipText = "DoubleClick : créer le joueur | click droit : effacer | (IMPORTANT: inscription à la suite)"
Top = 2610
Width = 5280
Begin VB.CheckBox Check1
Height = 285
Index = 3
Left = 225
TabIndex = 23
Top = 315
Width = 240
End
Begin VB.TextBox calcul
BeginProperty Font
Name = "Papyrus"
Size = 14.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 420
Index = 3
Left = 855
Locked = -1 'True
TabIndex = 22
Text = "calcul"
ToolTipText = "Produit X Somme"
Top = 270
Width = 2220
End
Begin VB.TextBox score
BeginProperty Font
Name = "Optimum"
Size = 14.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 420
Index = 3
Left = 3150
Locked = -1 'True
TabIndex = 21
Text = "score"
Top = 270
Width = 1995
End
Begin VB.CheckBox Check2
Height = 285
Index = 3
Left = 495
TabIndex = 20
ToolTipText = "utiliser la sixième baguette"
Top = 315
Width = 240
End
End
Begin VB.Frame Frame1
Height = 825
Index = 2
Left = 7020
TabIndex = 14
ToolTipText = "DoubleClick : créer le joueur | click droit : effacer | (IMPORTANT: inscription à la suite)"
Top = 1755
Width = 5280
Begin VB.CheckBox Check1
Height = 285
Index = 2
Left = 225
TabIndex = 18
Top = 315
Width = 240
End
Begin VB.TextBox calcul
BeginProperty Font
Name = "Papyrus"
Size = 14.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 420
Index = 2
Left = 855
Locked = -1 'True
TabIndex = 17
Text = "calcul"
ToolTipText = "Produit X Somme"
Top = 270
Width = 2220
End
Begin VB.TextBox score
BeginProperty Font
Name = "Optimum"
Size = 14.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 420
Index = 2
Left = 3150
Locked = -1 'True
TabIndex = 16
Text = "score"
Top = 270
Width = 1995
End
Begin VB.CheckBox Check2
Height = 285
Index = 2
Left = 495
TabIndex = 15
ToolTipText = "utiliser la sixième baguette"
Top = 315
Width = 240
End
End
Begin VB.Frame Frame1
Height = 825
Index = 1
Left = 7020
TabIndex = 9
ToolTipText = "DoubleClick : créer le joueur | click droit : effacer | (IMPORTANT: inscription à la suite)"
Top = 900
Width = 5280
Begin VB.CheckBox Check1
Height = 285
Index = 1
Left = 225
TabIndex = 13
Top = 315
Width = 240
End
Begin VB.TextBox calcul
BeginProperty Font
Name = "Papyrus"
Size = 14.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 420
Index = 1
Left = 855
Locked = -1 'True
TabIndex = 12
Text = "calcul"
ToolTipText = "Produit X Somme"
Top = 270
Width = 2220
End
Begin VB.TextBox score
BeginProperty Font
Name = "Optimum"
Size = 14.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 420
Index = 1
Left = 3150
Locked = -1 'True
TabIndex = 11
Text = "score"
Top = 270
Width = 1995
End
Begin VB.CheckBox Check2
Height = 285
Index = 1
Left = 495
TabIndex = 10
ToolTipText = "utiliser la sixième baguette"
Top = 315
Width = 240
End
End
Begin VB.CommandButton bouton2
Caption = "nouvelle partie"
Height = 825
Left = 7020
TabIndex = 5
Top = 6075
Width = 2580
End
Begin VB.CommandButton bouton
Caption = "jeter"
Height = 825
Left = 9720
TabIndex = 4
Top = 6075
Width = 2580
End
Begin VB.Frame Frame1
Height = 825
Index = 0
Left = 7020
TabIndex = 0
ToolTipText = "DoubleClick : créer le joueur | click droit : effacer | (IMPORTANT: inscription à la suite)"
Top = 45
Width = 5280
Begin VB.CheckBox Check2
Height = 285
Index = 0
Left = 495
TabIndex = 8
ToolTipText = "utiliser la sixième baguette"
Top = 315
Width = 240
End
Begin VB.TextBox score
BeginProperty Font
Name = "Optimum"
Size = 14.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 420
Index = 0
Left = 3150
Locked = -1 'True
TabIndex = 7
Text = "score"
Top = 270
Width = 1995
End
Begin VB.TextBox calcul
BeginProperty Font
Name = "Papyrus"
Size = 14.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 420
Index = 0
Left = 855
Locked = -1 'True
TabIndex = 6
Text = "calcul"
ToolTipText = "Produit X Somme"
Top = 270
Width = 2220
End
Begin VB.CheckBox Check1
Height = 285
Index = 0
Left = 225
TabIndex = 3
Top = 315
Width = 240
End
End
Begin VB.Line Line6
BorderColor = &H000000FF&
BorderWidth = 10
X1 = 6840
X2 = 4635
Y1 = 3465
Y2 = 6885
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "<<"
BeginProperty Font
Name = "OCR A Extended"
Size = 72
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00004080&
Height = 1590
Index = 1
Left = 4950
TabIndex = 2
ToolTipText = "Click gauche : active ou désactive baguette de gain"
Top = 5175
Visible = 0 'False
Width = 1680
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = ">>"
BeginProperty Font
Name = "OCR A Extended"
Size = 72
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00004080&
Height = 1590
Index = 0
Left = 4950
TabIndex = 1
Top = 5175
Visible = 0 'False
Width = 1680
End
Begin VB.Line Line5
BorderColor = &H00004080&
BorderWidth = 5
Index = 4
Visible = 0 'False
X1 = 2655
X2 = 4185
Y1 = 5715
Y2 = 5175
End
Begin VB.Line Line5
BorderColor = &H00004080&
BorderWidth = 5
Index = 3
Visible = 0 'False
X1 = 2655
X2 = 4230
Y1 = 5940
Y2 = 5940
End
Begin VB.Line Line5
BorderColor = &H00004080&
BorderWidth = 5
Index = 2
Visible = 0 'False
X1 = 2655
X2 = 4230
Y1 = 6165
Y2 = 6165
End
Begin VB.Line Line5
BorderColor = &H00004080&
BorderWidth = 5
Index = 1
Visible = 0 'False
X1 = 2655
X2 = 4230
Y1 = 6390
Y2 = 6390
End
Begin VB.Line Line5
BorderColor = &H00004080&
BorderWidth = 5
Index = 0
Visible = 0 'False
X1 = 2655
X2 = 4230
Y1 = 6615
Y2 = 6615
End
Begin VB.Line Line4
BorderColor = &H00004080&
BorderWidth = 5
Index = 3
Visible = 0 'False
X1 = 360
X2 = 1980
Y1 = 5940
Y2 = 5175
End
Begin VB.Line Line4
BorderColor = &H00004080&
BorderWidth = 5
Index = 2
Visible = 0 'False
X1 = 360
X2 = 1935
Y1 = 6165
Y2 = 6165
End
Begin VB.Line Line4
BorderColor = &H00004080&
BorderWidth = 5
Index = 1
Visible = 0 'False
X1 = 360
X2 = 1935
Y1 = 6390
Y2 = 6390
End
Begin VB.Line Line4
BorderColor = &H00004080&
BorderWidth = 5
Index = 0
Visible = 0 'False
X1 = 360
X2 = 1935
Y1 = 6615
Y2 = 6615
End
Begin VB.Line Line3
BorderColor = &H00004080&
BorderWidth = 5
Index = 2
Visible = 0 'False
X1 = 4995
X2 = 6570
Y1 = 2655
Y2 = 1665
End
Begin VB.Line Line3
BorderColor = &H00004080&
BorderWidth = 5
Index = 1
Visible = 0 'False
X1 = 4995
X2 = 6570
Y1 = 2880
Y2 = 2880
End
Begin VB.Line Line3
BorderColor = &H00004080&
BorderWidth = 5
Index = 0
Visible = 0 'False
X1 = 4995
X2 = 6570
Y1 = 3105
Y2 = 3105
End
Begin VB.Line Line2
BorderColor = &H00004080&
BorderWidth = 5
Index = 1
Visible = 0 'False
X1 = 2655
X2 = 4275
Y1 = 2925
Y2 = 1710
End
Begin VB.Line Line2
BorderColor = &H00004080&
BorderWidth = 5
Index = 0
Visible = 0 'False
X1 = 2655
X2 = 4230
Y1 = 3105
Y2 = 3105
End
Begin VB.Line Line1
BorderColor = &H00004080&
BorderWidth = 5
Index = 4
Visible = 0 'False
X1 = 360
X2 = 1935
Y1 = 2025
Y2 = 2520
End
Begin VB.Line Line1
BorderColor = &H00004080&
BorderWidth = 5
Index = 3
Visible = 0 'False
X1 = 405
X2 = 1980
Y1 = 2610
Y2 = 3105
End
Begin VB.Line Line1
BorderColor = &H00004080&
BorderWidth = 5
Index = 2
Visible = 0 'False
X1 = 1170
X2 = 1170
Y1 = 3285
Y2 = 1800
End
Begin VB.Line Line1
BorderColor = &H00004080&
BorderWidth = 5
Index = 1
Visible = 0 'False
X1 = 405
X2 = 1935
Y1 = 2610
Y2 = 2025
End
Begin VB.Line Line1
BorderColor = &H00004080&
BorderWidth = 5
Index = 0
Visible = 0 'False
X1 = 405
X2 = 1935
Y1 = 3105
Y2 = 2520
End
Begin VB.Image Image6
Height = 3345
Left = 4680
Picture = "FORM1.frx":0000
Stretch = -1 'True
ToolTipText = "Click gauche : active ou désactive baguette de gain"
Top = 3510
Width = 2175
End
Begin VB.Image Image5
Height = 3345
Left = 2385
Picture = "FORM1.frx":C2CA
Stretch = -1 'True
Top = 3510
Width = 2175
End
Begin VB.Image Image4
Height = 3345
Left = 90
Picture = "FORM1.frx":18594
Stretch = -1 'True
Top = 3510
Width = 2175
End
Begin VB.Image Image2
Height = 3345
Left = 2385
Picture = "FORM1.frx":2485E
Stretch = -1 'True
Top = 45
Width = 2175
End
Begin VB.Image Image1
Height = 3345
Left = 90
Picture = "FORM1.frx":30B28
Stretch = -1 'True
Top = 45
Width = 2175
End
Begin VB.Image Image3
Height = 3345
Index = 0
Left = 4680
Picture = "FORM1.frx":3CDF2
Stretch = -1 'True
Top = 45
Width = 2175
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim tableau(5) As String
Dim recap(6) As Integer
Dim nbr, joueur As Integer
Dim somme, produit As Integer
Dim borne As Integer
Dim sec(1) As Integer
Sub jeter(fois As Integer)
Dim i, j As Integer
Call razbag
Frame1(joueur).BackColor = vbBlue
somme = 0
produit = 0
Line6.Visible = (Check2(joueur) = 0)
Randomize
For j = 0 To fois
i = Int(4 * Rnd) + 1
Next
If i = 3 Then
Line1(0).Visible = True
Line1(1).Visible = True
Line1(3).Visible = True
Line1(4).Visible = True
tableau(0) = "X"
produit = 1
Else
Line1(0).Visible = True
Line1(1).Visible = True
Line1(2).Visible = True
tableau(0) = "+"
End If
For j = 0 To fois
i = Int(4 * Rnd) + 1
Next
Select Case i
Case 1
Line2(0).Visible = True
tableau(1) = "+"
somme = somme + 1
Case 3
Line2(0).Visible = True
Line2(1).Visible = True
tableau(1) = "X"
If tableau(0) = "X" Then produit = produit * 1 Else produit = produit + 1
Case 2 Or 4
tableau(1) = "nd"
End Select
For j = 0 To fois
i = Int(4 * Rnd) + 1
Next
Select Case i
Case 1
Line3(0).Visible = True
Line3(1).Visible = True
tableau(2) = "+"
somme = somme + 2
Case 3
Line3(0).Visible = True
Line3(1).Visible = True
Line3(2).Visible = True
tableau(2) = "X"
If tableau(0) = "X" Then produit = produit * 2 Else produit = produit + 2
Case 2 Or 4
tableau(2) = "nd"
End Select
For j = 0 To fois
i = Int(4 * Rnd) + 1
Next
Select Case i
Case 1
Line4(0).Visible = True
Line4(1).Visible = True
Line4(2).Visible = True
tableau(3) = "+"
somme = somme + 3
Case 3
Line4(0).Visible = True
Line4(1).Visible = True
Line4(2).Visible = True
Line4(3).Visible = True
tableau(3) = "X"
If tableau(0) = "X" Then produit = produit * 3 Else produit = produit + 3
Case 2 Or 4
tableau(3) = "nd"
End Select
For j = 0 To fois
i = Int(4 * Rnd) + 1
Next
Select Case i
Case 1
Line5(0).Visible = True
Line5(1).Visible = True
Line5(2).Visible = True
Line5(3).Visible = True
tableau(4) = "+"
somme = somme + 4
Case 3
Line5(0).Visible = True
Line5(1).Visible = True
Line5(2).Visible = True
Line5(3).Visible = True
Line5(4).Visible = True
tableau(4) = "X"
If tableau(0) = "X" Then produit = produit * 4 Else produit = produit + 4
Case 2 Or 4
tableau(4) = "nd"
End Select
For j = 0 To fois
i = Int(4 * Rnd) + 1
Next
Select Case i
Case 1
Label1(0).Visible = True
tableau(5) = "j"
Case 3
Label1(1).Visible = True
tableau(5) = "a"
Case 2 Or 4
tableau(5) = "nd"
End Select
Call calculer
End Sub
Sub calculer()
Dim j As Integer
Dim tx As Integer
tx = 100
calcul(joueur).Text = ""
If produit = 0 Then produit = 1
calcul(joueur).Text = CStr(produit) & " X " & CStr(somme)
recap(joueur) = recap(joueur) + (produit * somme)
If Line6.Visible = False Then
Select Case tableau(5)
Case "a"
calcul(joueur).Text = calcul(joueur).Text & " - " & (1.5 * (produit * somme))
recap(joueur) = recap(joueur) - (1.5 * (produit * somme))
Case "j"
calcul(joueur).Text = calcul(joueur).Text & " + " & (2.5 * (produit * somme))
recap(joueur) = recap(joueur) + (2.5 * (produit * somme))
End Select
End If
For j = 0 To 5
tableau(j) = ""
Next
score(joueur).Text = recap(joueur)
End Sub
Private Sub bouton_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
sec(0) = Second(Now)
End Sub
Private Sub bouton_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim i As Integer
sec(1) = Second(Now)
For i = 0 To 6
Frame1(i).BackColor = vbGreen
Frame1(i).Visible = False
If Check1(i) = 1 Then
nbr = i
End If
Next
For i = 0 To nbr + 1
Frame1(i).Visible = True
Next
If Check1(0) = 1 Then Call jeter(Abs(sec(0) - sec(1)))
If recap(joueur) >= borne Then
If MsgBox(Frame1(joueur).Caption & " vainqueur : " & recap(joueur) & " / " & borne, vbOKOnly) = vbOK Then
Call Form_Load
End If
End If
If Check1(joueur + 1) = False Then joueur = 0 Else joueur = joueur + 1
End Sub
Private Sub bouton2_Click()
borne = InputBox("partie en X points")
Call Form_Load
End Sub
Private Sub Check1_Click(Index As Integer)
Dim i As Integer
For i = 0 To 6
Frame1(i).BackColor = vbGreen
Frame1(i).Visible = False
If Check1(i) = 1 Then
nbr = i
End If
Next
For i = 0 To nbr + 1
Frame1(i).Visible = True
Next
If Check1(Index) = 1 Then
calcul(Index).Text = ""
score(Index).Text = ""
Frame1(Index).Caption = ""
Frame1(Index).BackColor = vbGreen
Frame1(Index).Caption = InputBox("nom du joueur")
End If
End Sub
Private Sub Form_Load()
Call razall
End Sub
Private Sub Frame1_DblClick(Index As Integer)
Frame1(Index).Caption = InputBox("nom du joueur")
Check1(Index) = 1
End Sub
Sub razbag()
Line1(0).Visible = False
Line1(1).Visible = False
Line1(2).Visible = False
Line1(3).Visible = False
Line1(4).Visible = False
Line2(0).Visible = False
Line2(1).Visible = False
Line3(0).Visible = False
Line3(1).Visible = False
Line3(2).Visible = False
Line4(0).Visible = False
Line4(1).Visible = False
Line4(2).Visible = False
Line4(3).Visible = False
Line5(0).Visible = False
Line5(1).Visible = False
Line5(2).Visible = False
Line5(3).Visible = False
Line5(4).Visible = False
Label1(0).Visible = False
Label1(1).Visible = False
End Sub
Sub razall()
Dim i As Integer
Call razbag
For i = 0 To 6
Check1(i) = 0
Check2(i) = 0
calcul(i).Text = ""
score(i).Text = ""
Frame1(i).Caption = ""
Frame1(i).BackColor = vbGreen
Frame1(i).Visible = False
If Check1(i) = 1 Then
nbr = i
End If
Next
For i = 0 To nbr + 1
Frame1(i).Visible = True
Next
For i = 0 To 6
recap(i) = 0
Next
joueur = 0
'Call bouton_MouseUp
End Sub
Private Sub Frame1_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then
Check1(Index) = False
Check2(Index) = False
calcul(Index).Text = ""
score(Index).Text = ""
Frame1(Index).Caption = ""
Frame1(Index).BackColor = vbGreen
End If
End Sub
Private Sub Image6_Click()
If Line6.Visible = True Then
Line6.Visible = False
Else
Line6.Visible = True
End If
End Sub
Private Sub Label1_Click(Index As Integer)
Call Image6_Click
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.