|
Create Hang Man Game in Visual Basic 6 |
|
|
|
សរសេរដោយ Setha IECH
|
|
ពុធ, 05 ឧសភា 2010 13:44 |
|
----------------------------------------------- Dim i As Integer: i = 1 Dim isCorrectWord As Boolean: isCorrectWord = False Dim MyWord As String While Mid(MyStr, i, 1) & "" <> "" If Mid(MyStr, i, 1) = Right(txtLetter.Text, 1) Then MyWord = MyWord & Right(txtLetter.Text, 1) If Mid(lblWordGuess.Caption, i, 1) <> _ Right(txtLetter.Text, 1) Then _ isCorrectWord = True Else MyWord = MyWord & Mid(lblWordGuess.Caption, i, 1) End If i = i + 1 Wend txtTotalGuess = txtTotalGuess + 1 If Not isCorrectWord Then txtWrongGuess = txtWrongGuess + 1 If txtWrongGuess = 1 Then shapeHead.Visible = True If txtWrongGuess = 2 Then lineEye1.Visible = True: lineEye2.Visible = True lineEye3.Visible = True: lineEye4.Visible = True lineNose.Visible = True: lineMouth.Visible = True End If If txtWrongGuess = 3 Then lineNeck.Visible = True If txtWrongGuess = 4 Then lineHandL.Visible = True If txtWrongGuess = 5 Then lineHandR.Visible = True If txtWrongGuess = 6 Then lineBody.Visible = True If txtWrongGuess = 7 Then lineLegL.Visible = True If txtWrongGuess = 8 Then lineLegR.Visible = True End If --------------------------------------------------- Download Source Code Here
|