Ir ao conteúdo
  • Cadastre-se

Ruan developer

Membro Júnior
  • Posts

    1
  • Cadastrado em

  • Última visita

Reputação

0
  1. Galera estou enfrentando problemas com o código abaixo, tudo foi retirado da apostila da prepara, foi feito no vb6: obs: os principais problemas é no GLOBAL CONST e no GLOBAL CONST e o resto aparece a mensagem que não pode fazer comentário antes no end blá, blá, blá, MAS NÃO TEM COMENTARIO NO CODIGO. Option Explicit Declare Function sndPlaySound Lib "MMSystem" Alias "sndplaysound" (ByVal Ipsound As String, ByVal flag As Integer) As Integer Global Const Snd_ASYNC = &H1 Private Sub Form_Load() Dim Lugar As Boolean Dim Posicao As Integer Dim Matou As Byte Dim I As Integer Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal IpszSoundName As String, ByVal UFlags As Long) As Long Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal IpstrCommand As String, ByVal IpstrretunString, ByVal ureturnLength As Long, ByVal hwndCallback As LogEventTypeConstants) As Long Private Sub Form_Keydown(Keycode As Integer, shift As Integer) Dim rc As Intger If Keycode = vbkey12 Then Time1.Enabled = False Time1.Enabled = False MsgBox "Pausa", vbExclamtion, "jogo" Time1.Enabled = True Time1.Enabled = True ElseIf Keycode = Vbkeysapace And Line2.Visible = False Then rc = sndPlaySound(App.patch & "\Tiro.WAV", Snd_ASYNC) Line2.Visible = True Line2.X1 = Image1.Left + 230 Line2.X2 = Image1.Left + 230 Line2.Y1 = Image1.Top - 360 Line2.Y2 = Image1.Top Timer2.Enabled = True ElseIf Keycode = vbKeyRight Then If Image1.Left > 0 Then Image1.Left = Image1.Left - 200 End If End If End Sub Private Sub Form_Load() IniciaJogo End Sub Private Sub Timer1_Timer() For I = 0 To 5 Posicao = Int(Rnd * 100) If Alien(I).Top < 6360 Then Alien(I).Top = Alieen(I).Top + 100 If Lugar = False Then If Alien(I).Left < 4200 Then Alien(I).Left = Alien(I).Left + Posicao Lugar = True Else Alien(I).Left = Alien(I).Left - 2000 Lugar = True End If Else If Alien(I).Left > 120 Then Alien(I).Left -Posicao Lugar = False Else Alien(I).Left = Alien(I).Left + 2000 Lugar = False End If End If Else Alien(I).Top = -30 End If If Alien(I).Left >= Image1.Left And Alien(I).Left <= Image1.Left + 480 Then If Alien(I).Top + 480 >= 5280 And Alien(I).Top + 480 <= 5760 Then rc = sndPlaySound(App.patch & "\Perdeu.Wav", SndASYNC) Imagem1.Picture = Image2.Picture Timer1.Enabled = False Timer2.Enabled = False If MsgBox("Você perdeu", vbYesNo, "jogo") = vbYes Then IniciaJogo Else Exit Sub End If End If End If Next I End Sub Private Sub timer2_Timer() Line2.Y1 = Line2.Y1 - 250 Line2.Y2 = Line2.Y2 - 250 Conta = Conta + 1 If Line2.Y1 < 0 Then Line2.Visible = False Timer2.Enabled = False End If For x = 0 To 5 pega = Alien9x0.Left If Line2.X1 >= Alien(x).Left And Line2.X2 <= Alien(x).Left + 480 Then If Line2.Y1 >= Alien(x).Top And Line2.Y2 < Alien(x).Top + 680 Then If Alien(x).Visible = True Then Line2.Visibel = False Matou = Matou + 1 End If Alien(x).Visible = False End If End If Next x If Matou = 6 Then If MsgBox("Você venceu", vbYesNo, "jogo") = vbYes Then Timer1.Enabled = False Timer2.Enabled = False IniciaJogo Else Timer1.Enabled = False Timer2.Enabled = False End If End If End Sub Private

Sobre o Clube do Hardware

No ar desde 1996, o Clube do Hardware é uma das maiores, mais antigas e mais respeitadas comunidades sobre tecnologia do Brasil. Leia mais

Direitos autorais

Não permitimos a cópia ou reprodução do conteúdo do nosso site, fórum, newsletters e redes sociais, mesmo citando-se a fonte. Leia mais

×
×
  • Criar novo...