Vous êtes sur la page 1sur 17

AHORCADO

Option Explicit Private a As Integer Private b As Integer Private c As Integer Private d As Integer Private e As Integer

Private Sub pausa() Dim comenzar Dim controlar comenzar = Timer Do Until controlar >= comenzar + 1.5

controlar = Timer DoEvents Loop End Sub Private Sub Command1_Click() End End Sub

Private Sub Form_Load()

End Sub

Private Sub Text1_Change(Index As Integer) If Text1(0) <> "c" And Text1(0) <> "" Then a = a + 1 Call horca 'Call ganar If Text1(1) <> "a" And Text1(1) <> "" Then a = a + 1 Call horca 'Call ganar If Text1(2) <> "s" And Text1(2) <> "" Then a = a + 1 Call horca 'Call ganar If Text1(3) <> "a" And Text1(3) <> "" Then a = a + 1

Call ganar

Call horca End Sub Private Sub ganar() Dim m As Integer

If Text1(0) = "c" And Text1(1) = "a" And Text1(2) = "s" And Text1(3) = "a" Then Label1.Caption = "Bien" Call pausa Text2(0).SetFocus For m = 0 To 3 Text1(m).Enabled = False Next m Shape1.Visible = False Shape2.Visible = False Shape4.Visible = False Shape5.Visible = False Line4.Visible = False Line5.Visible = False Line6.Visible = False Line7.Visible = False Label1.Caption = "" a=0 b=0 c=0 d=0

e=0 End If End Sub

Private Sub horca()

If a = 1 Then Shape1.Visible = True ElseIf a = 2 Then Shape2.Visible = True Shape4.Visible = True ElseIf a = 3 Then

Shape5.Visible = True Line4.Visible = True Line5.Visible = True ElseIf a = 4 Then

Line6.Visible = True Line7.Visible = True Label1.Caption = "Ahorcado" Call pausa For a = 0 To 3 Text1(a).Enabled = False Next a

Shape1.Visible = False Shape2.Visible = False Shape4.Visible = False Shape5.Visible = False Line4.Visible = False Line5.Visible = False Line6.Visible = False Line7.Visible = False Label1 = "" Text2(0).SetFocus End If End Sub Private Sub ganar1() Dim m As Integer

If Text4(0) = "a" And Text4(1) = "u" And Text4(2) = "t" And Text4(3) = "o" Then Label1.Caption = "Bien" Call pausa Text5(0).SetFocus For m = 0 To 3 Text4(m).Enabled = False Next m Shape1.Visible = False Shape2.Visible = False Shape4.Visible = False

Shape5.Visible = False Line4.Visible = False Line5.Visible = False Line6.Visible = False Line7.Visible = False Label1.Caption = "" a=0 b=0 c=0 d=0 e=0 End If End Sub Private Sub ganar2() Dim m As Integer

If Text2(0) = "p" And Text2(1) = "e" And Text2(2) = "z" Then Label1.Caption = "Bien" Call pausa Text3(0).SetFocus For m = 0 To 2 Text2(m).Enabled = False Next m Shape1.Visible = False Shape2.Visible = False

Shape4.Visible = False Shape5.Visible = False Line4.Visible = False Line5.Visible = False Line6.Visible = False Line7.Visible = False Label1.Caption = "" a=0 b=0 c=0 d=0 e=0 End If End Sub Private Sub ganar3() Dim m As Integer If Text3(0) = "p" And Text3(1) = "a" And Text3(2) = "p" And Text3(3) = "a" And Text3(4) = "s" Then Label1.Caption = "Bien" Call pausa Text4(0).SetFocus For m = 0 To 4 Text3(m).Enabled = False Next m Shape1.Visible = False

Shape2.Visible = False Shape4.Visible = False Shape5.Visible = False Line4.Visible = False Line5.Visible = False Line6.Visible = False Line7.Visible = False Label1.Caption = "" a=0 b=0 c=0 d=0 e=0 End If End Sub Private Sub ganar5() Dim m As Integer

If Text5(0) = "s" And Text5(1) = "o" And Text5(2) = "l" Then Label1.Caption = "Bien" Call pausa For m = 0 To 2 Text5(m).Enabled = False Next m Shape1.Visible = False

Shape2.Visible = False Shape4.Visible = False Shape5.Visible = False Line4.Visible = False Line5.Visible = False Line6.Visible = False Line7.Visible = False Label1.Caption = "" a=0 b=0 c=0 d=0 e=0 End If End Sub Private Sub Text2_Change(Index As Integer) If Text2(0) <> "p" And Text2(0) <> "" Then b = b + 1 Call horca1 'Call ganar2 If Text2(1) <> "e" And Text2(1) <> "" Then b = b + 1 Call horca1 'Call ganar2 If Text2(2) <> "z" And Text2(2) <> "" Then b = b + 1

Call ganar2

Call horca1 End Sub

Private Sub Text3_Change(Index As Integer) If Text3(0) <> "p" And Text3(0) <> "" Then c = c + 1 Call horca3 'Call ganar3 If Text3(1) <> "a" And Text3(1) <> "" Then c = c + 1 Call horca3 'Call ganar3 If Text3(2) <> "p" And Text3(2) <> "" Then c = c + 1 Call horca3 'Call ganar3 If Text3(3) <> "a" And Text3(3) <> "" Then c = c + 1 Call horca3 'Call ganar3 If Text3(4) <> "s" And Text3(4) <> "" Then c = c + 1 Call ganar3 Call horca3

End Sub

Private Sub Text4_Change(Index As Integer) If Text4(0) <> "a" And Text4(0) <> "" Then d = d + 1

Call horca2 'Call ganar1 If Text4(1) <> "u" And Text4(1) <> "" Then d = d + 1 Call horca2 'Call ganar1 If Text4(2) <> "t" And Text4(2) <> "" Then d = d + 1 Call horca2 'Call ganar1 If Text4(3) <> "o" And Text4(3) <> "" Then d = d + 1

Call ganar1 Call horca2 End Sub

Private Sub Text5_Change(Index As Integer) If Text5(0) <> "s" And Text5(0) <> "" Then e = e + 1 Call horca4 'Call ganar5 If Text5(1) <> "o" And Text5(1) <> "" Then e = e + 1 Call horca4 'Call ganar5 If Text5(2) <> "l" And Text5(2) <> "" Then e = e + 1

Call ganar5 Call horca4

End Sub

Private Sub horca1() Dim s As Integer If b = 1 Then Shape2.Visible = True Shape1.Visible = True ElseIf b = 2 Then

Shape4.Visible = True Shape5.Visible = True Line4.Visible = True ElseIf b = 3 Then

Line5.Visible = True Line6.Visible = True Line7.Visible = True Label1.Caption = "Ahorcado" Call pausa For s = 0 To 2 Text2(s).Enabled = False Next s Shape1.Visible = False

Shape2.Visible = False Shape4.Visible = False Shape5.Visible = False Line4.Visible = False Line5.Visible = False Line6.Visible = False Line7.Visible = False Label1 = "" Text3(0).SetFocus End If End Sub

Private Sub horca2() Dim s As Integer

If d = 1 Then Shape1.Visible = True ElseIf d = 2 Then Shape2.Visible = True ElseIf d = 3 Then Shape4.Visible = True Shape5.Visible = True ElseIf d = 4 Then Line4.Visible = True Line5.Visible = True

Line6.Visible = True Line7.Visible = True Label1.Caption = "Ahorcado" Call pausa For s = 0 To 3 Text4(s).Enabled = False Next s Shape1.Visible = False Shape2.Visible = False Shape4.Visible = False Shape5.Visible = False Line4.Visible = False Line5.Visible = False Line6.Visible = False Line7.Visible = False Label1 = "" Text5(0).SetFocus End If End Sub

Private Sub horca4() Dim s As Integer

If e = 1 Then

Shape1.Visible = True

Shape2.Visible = True ElseIf e = 2 Then Shape4.Visible = True Shape5.Visible = True ElseIf e = 3 Then Line4.Visible = True Line5.Visible = True

Line6.Visible = True Line7.Visible = True Label1.Caption = "Ahorcado" Call pausa For s = 0 To 2 Text5(s).Enabled = False Next s Shape1.Visible = False Shape2.Visible = False Shape4.Visible = False Shape5.Visible = False Line4.Visible = False Line5.Visible = False Line6.Visible = False Line7.Visible = False

Label1 = "" End If End Sub

Private Sub horca3() Dim s As Integer

If c = 1 Then Shape1.Visible = True ElseIf c = 2 Then Shape2.Visible = True ElseIf c = 3 Then Shape4.Visible = True Shape5.Visible = True ElseIf c = 4 Then Line4.Visible = True Line5.Visible = True ElseIf c = 5 Then Line6.Visible = True Line7.Visible = True Label1.Caption = "Ahorcado" Call pausa For s = 0 To 4 Text3(s).Enabled = False Next s

Shape1.Visible = False Shape2.Visible = False Shape4.Visible = False Shape5.Visible = False Line4.Visible = False Line5.Visible = False Line6.Visible = False Line7.Visible = False Label1 = "" Text4(0).SetFocus End If End Sub

Vous aimerez peut-être aussi