• 0
Sign in to follow this  
FehH

Jogo da Forca

Question

Olá amigos,

Estou um jogo da forca no curso e quando escolho uma letra já aparece a mensagem dizendo que ganhou o jogo.

Vo postar a função do botão da letra.

Private Sub cmd_letra_Click(Index As Integer)
    Dim letr As String
    Dim palavra As String
    Dim i As Byte
    Dim acerto As Boolean
    Dim final As Boolean
    
    letr = cmd_letra(Index).Caption
    palavra = UCase(txt_pala.Text)
    
        For i = 1 To Len(palavra)
            If Mid(palavra, i, 1) = letr Then
                acerto = True
            End If
        Next
            
        cmd_letra(Index).Enabled = False
        If (Not acerto) Then
            Image1(erros).Visible = True
                erros = erros + 1
        End If
        
        final = True
            For i = 0 To Len(palavra) - 1
                If (lbl_resp(i).Caption = "") Then
                    final = False
                End If
                If (erros = 6) Then
                    finaliza ("Perdeu Preiboi")
                End If
                
            Next
                finaliza ("Parabéns você Ganhouuuuuuuuuuuu!!!")
End Sub

Parace que ele pula tudo isso e vai direto para mensagem.

Se estiver algo errado me digam.

Obrigado.

Abra´z

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this