Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
Impiccato - frmImpiccato.frm

frmImpiccato.frm

Caricato da: Antometal
Scarica il programma completo

  1. Option Explicit
  2.  
  3. Public Parola As String
  4. Public Nuova As Boolean
  5.  
  6. Private Sub Ricomincia()
  7. Nuova = True
  8. Unload Me
  9. frmMain.Show
  10. End Sub
  11.  
  12. Private Sub GameOver()
  13.     If MsgBox("HAI PERSO" & vbCrLf & "La parola da scoprire era: " & Parola & vbCrLf & "Vuoi Iniziare una nuova partita?", vbYesNo + vbQuestion) = vbNo Then
  14.         End
  15.     Else
  16.         Ricomincia
  17.     End If
  18. End Sub
  19.  
  20. Private Sub Sostituisci(Lettera As String)
  21. Dim I As Integer
  22. Dim Word As String
  23. Dim BoolTent As Boolean
  24.     For I = 1 To Len(Parola)
  25.             If Mid(Parola, I, 1) = Lettera Then
  26.                 lblLettera(I - 1).Caption = Lettera
  27.                 BoolTent = True
  28.             End If
  29.         Word = Word & lblLettera(I - 1).Caption
  30.             If Word = Parola Then
  31.                 If MsgBox("HAI VINTO" & vbCrLf & "Vuoi Iniziare una nuova partita?", vbQuestion + vbYesNo) = vbYes Then
  32.                     Ricomincia
  33.                 Else
  34.                     End
  35.                 End If
  36.             End If
  37.     Next I
  38.     If BoolTent = False Then
  39.             If lblTentativi.Caption = 7 Then
  40.                 shpTesta.Visible = True
  41.             Else
  42.                 lnCorpo(6 - lblTentativi.Caption).Visible = True
  43.             End If
  44.         lblTentativi.Caption = lblTentativi.Caption - 1
  45.     End If
  46.     If lblTentativi.Caption = "0" Then GameOver
  47. End Sub
  48.  
  49. Private Sub cmdLettera_Click(Index As Integer)
  50. cmdLettera(Index).Enabled = False
  51. Sostituisci (Replace(cmdLettera(Index).Caption, "&", ""))
  52. End Sub
  53.  
  54. Private Sub cmdRese_Click()
  55.     If MsgBox("Sicuro di volerti arrendere?", vbQuestion + vbYesNo) = vbYes Then GameOver
  56. End Sub
  57.  
  58. Private Sub Form_Load()
  59. Dim I As Integer
  60. Parola = frmMain.Parola
  61. Me.Width = 7545
  62. lblLunghezza.Caption = Len(Parola)
  63. shpTesta.Visible = False
  64.     For I = 0 To 25
  65.         cmdLettera(I).Caption = "&" & Chr(Asc("A") + I)
  66.             If I < 6 Then lnCorpo(I).Visible = False
  67.     Next I
  68.     For I = 1 To Len(Parola) - 1
  69.         Load lblLettera(I)
  70.         lblLettera(I).Left = lblLettera(I - 1).Left + lblLettera(I).Width + 120
  71.         lblLettera(I).Visible = True
  72.     Next I
  73.     If Me.Width < lblLettera(I - 1).Left + 120 * 3 + lblLettera(I - 1).Width Then Me.Width = lblLettera(I - 1).Left + 120 * 3 + lblLettera(I - 1).Width
  74. Nuova = False
  75. End Sub
  76.  
  77. Private Sub Form_Unload(Cancel As Integer)
  78.     If Nuova = False Then If MsgBox("Sicuro di voler uscire?", vbQuestion + vbYesNo) = vbNo Then Cancel = 1
  79. End Sub