Qui veut gagner des millions beta 1

Description

Voici le code sur lequel j ai travailler pendant quelques temps, j'ai pas tout a fait fini....Il me manque l'enregistrement des scores battus, et les jokers.
Pour ce qui est du fonctionnement du projet, vous devez:
-indiquer les chemins des fichiers genedeb (le generique de presentation du jeu)
- " " " " " derniermot (le sons qui vous demande si c votre dernier mot)
-remettre le bon chemin de la base de donnee ds le control adodc1 et ds la sous categorie connection string (il vous suffit alors d'aller chercher la base a l endroit ou vous avez dezipe)

voila j espere que ce petit projet vous permettra de passer un bon petit moment et d'apprendre un ou deux trucs.

ps: petit probleme mineurs :
- ya pas beaucoup de questions vous pouvez en rajouter ds la base.
a+ tcho

"La geurre est une xtention de la politique par d'autres moyens" van clos vitch

Source / Exemple :


--------------------------------------------------------------------------------------------
                                   FORM1
--------------------------------------------------------------------------------------------
Private Sub Command1_Click()

Unload Me
Form2.Show

End Sub
Private Sub Command2_Click()

Unload Me
Scores.Show
Scores.Timer1.Enabled = True
Scores.Timer2.Enabled = True
Scores.Timer3.Enabled = True

End Sub
Private Sub Command3_Click()

If MsgBox("Voulez-vous vraiment sortir ?", vbOKCancel) = vbOK Then

  End
  
Else

  MsgBox "On va pas s'arrêter maintenant...", vbOKOnly
  
  
End If

End Sub
Private Sub Command4_Click()

Form1.Hide
frmAbout.Show

End Sub
Private Sub Timer1_Timer()

   AffichHeure.Caption = Time   ' Met à jour l'affichage de l'heure.
   
End Sub
--------------------------------------------------------------------------------------------
                                 FORM2
--------------------------------------------------------------------------------------------
Dim CurDay, CurMon, CurYea As Variant
Dim IntSom As Double
Dim IntRes, cnt, i As Integer
Dim CurTim As Variant
Dim conv, DecHeu, DecMin, DecSec   As String
Private Sub Command1_Click()

Unload Me
Heure.Enabled = False
Form1.Show

End Sub
Private Sub Form_Load()

Dim CurDay As Variant
Dim CurMon As Variant
Dim CurYea As Variant
Dim IntSom As Double
Dim IntRes As Integer
Dim CurTim As Variant
Dim conv   As String
Dim DecHeu As String
Dim DecMin, DecSec As String
Dim cnt As Integer
Dim i As Integer

i = 1
IntituleQuest = "Question " & i

CurDay = Day(Now)
CurMon = Month(Now)
CurYea = Year(Now) - 2000
CurTim = Time
conv = CStr(CurTim)
DecHeu = Val(Left(conv, 2))
DecMin = Val(Mid(conv, 4, 2))
DecSec = Val(Right(conv, 2))
IntSom = CurDay + CurMon + CurYea + DecHeu + DecMin + DecSec

Adodc1.Recordset.MoveLast
cnt = NumQuest.Caption

IntSom = IntSom Mod cnt

If IntSom = 0 Then

    IntSom = 1

End If

Adodc1.Recordset.MoveFirst

For i = 1 To IntSom

     Adodc1.Recordset.MoveNext

Next

End Sub
Private Sub Check_Click(Index As Integer)

Dim intReponse As String

If jesuisenphased_init Then Exit Sub

Playwav ("") 'Chemin du wav derniermot
intReponse = MsgBox("C'est votre dernier mot?", 1, "Jean-Pierre")

  If (intReponse = 1) Then
  
     If BonneRep.Caption = proposition(Index).Caption Then
        rep.Caption = "GAGNE"
        rep.BackColor = vbBlue
        MsgBox "Question Suivante", vbOKOnly + vbExclamation
        rep.BackColor = noir
        rep.Caption = ""
        
        Reload.Réinitial
     
     Else
     
        rep.Caption = "PERDU"
        rep.BackColor = vbRed
     
     End If
     
  End If

End Sub
Private Sub Heure_Timer()

AffichHeure.Caption = Time

End Sub
--------------------------------------------------------------------------------------------
                                      PRESENTATION
--------------------------------------------------------------------------------------------
Public Sub Timer1_Timer()

Playwav ("") 'chemin du son wav du demarrage de l'apli
Presentation.Hide
Form1.Show
Timer1.Enabled = False

End Sub
--------------------------------------------------------------------------------------------
                                      SCORE
--------------------------------------------------------------------------------------------
Private Sub Command1_Click()

Unload Me
Timer1.Enabled = False
Timer2.Enabled = False
Timer3.Enabled = False
Form1.Show

End Sub
Private Sub Form_Load()

Dim i As Integer
Dim unScore As Enreg
'Ouverture du fichier score
Open "C:\WINNT\Profiles\tesseiva\Bureau\Programmation\Sources VB\Qui_veut_gagner\scores.qgm" For Random As #2
i = 1
'Boucle de parcours séquentiel des enregistrements du fichier
Do While Not EOF(2)
          Get #2, i, unScore
          NomJoueur1(i - 1).Caption = " " & unScore.prenom
          ScoreJ1(i - 1).Text = unScore.sommegagnée
          i = i + 1
Loop
'Fermeture
Close #2

End Sub
Private Sub Timer1_Timer()

Label1.ForeColor = vbRed
Label3.ForeColor = vbBlue
Label4.ForeColor = vbGreen

End Sub
Private Sub Timer2_Timer()

Label1.ForeColor = vbGreen
Label3.ForeColor = vbRed
Label4.ForeColor = vbBlue

End Sub
Private Sub Timer3_Timer()

Label1.ForeColor = vbBlue
Label3.ForeColor = vbGreen
Label4.ForeColor = vbRed

End Sub
--------------------------------------------------------------------------------------------
                                     MODSCORES
--------------------------------------------------------------------------------------------
'variables pour écrire dans fichier score.sco

Public Type Enreg

  prenom As String * 20
  sommegagnée As String * 10
  
End Type
--------------------------------------------------------------------------------------------
                                    RELOAD
--------------------------------------------------------------------------------------------
Option Explicit
Public jesuisenphased_init As Boolean
Public compteurquestion  As Integer
Public Const noir = &H808000
Public Sub Réinitial()

Dim cnt As Integer
 
compteurquestion = compteurquestion + 2
Form2.IntituleQuest.Caption = "Question " & compteurquestion

If compteurquestion = 15 Then

MsgBox "jeu terminé", vbOKOnly, vbExclamation
Unload Form2
Form1.Show

Else

jesuisenphased_init = True

Form2.Check(0).Value = False
Form2.Check(1).Value = False
Form2.Check(2).Value = False
Form2.Check(3).Value = False

jesuisenphased_init = False

Form2.ProgressBar1.Value = compteurquestion
If Form2.Adodc1.Recordset.EOF = False Then
   Form2.Adodc1.Recordset.MoveNext
Else
   Form2.Adodc1.Recordset.MoveFirst
End If

End If

End Sub
--------------------------------------------------------------------------------------------
                               MODULE1(son)
--------------------------------------------------------------------------------------------
Public Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Public Sub Playwav(WavFile As String)

    Dim SafeFile As String
    
    SafeFile$ = Dir(WavFile$)
    If SafeFile$ <> "" Then
        Call sndPlaySound(WavFile$, SND_FLAG)
    End If
    
End Sub

Conclusion :


rien d autre a dire

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.