Dim mancha As Integer Dim paso As Integer Dim queda As Integer Dim queda1 As Integer Dim paso1 As Integer Dim queda2 As Integer Dim queda3 As Integer Dim maximolabels As Integer Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer) Select Case KeyCode Case vbKeyDown Shape5.Top = Shape5.Top + 100 Case vbKeyUp Shape5.Top = Shape5.Top - 100 Case vbKeyLeft Shape5.Left = Shape5.Left - 100 Case vbKeyRight Shape5.Left = Shape5.Left + 100 End Select Select Case KeyCode Case vbKeyS Shape6.Top = Shape6.Top + 100 Case vbKeyW Shape6.Top = Shape6.Top - 100 Case vbKeyA Shape6.Left = Shape6.Left - 100 Case vbKeyD Shape6.Left = Shape6.Left + 100 End Select End Sub Public Function negativo(numero As Integer) If (numero <= 0) Then numero = -numero End If End Function Private Sub Form_Load() maximolabels = 69 Label3.Caption = "Player 1" mancha = 0 paso = 0 End Sub Private Sub Label11_Click() Form5.Show End Sub Private Sub Timer1_Timer() If Shape5.Left < 0 Or Shape6.Left < 0 Then If (Shape5.Left < 0) Then Shape5.Left = Shape5.Left + 80 Else Shape6.Left = Shape6.Left + 80 End If End If If Shape5.Top < 0 Or Shape6.Top < 0 Then If (Shape5.Top < 0) Then Shape5.Top = Shape5.Top + 80 Else Shape6.Top = Shape6.Top + 80 End If End If If Shape5.Left > 7800 Or Shape6.Left > 7800 Then If (Shape5.Left > 7800) Then Shape5.Left = Shape5.Left - 120 Else Shape6.Left = Shape6.Left - 120 End If End If If Shape5.Top > 3300 Or Shape6.Top > 3300 Then If (Shape5.Top > 3300) Then Shape5.Top = Shape5.Top - 120 Else Shape6.Top = Shape6.Top - 120 End If End If End Sub Private Sub Timer2_Timer() Dim distancia As Integer Dim distancia2 As Integer Dim i As Integer For i = 0 To maximolabels distancia = Shape6.Left - Shape7(i).Left distancia2 = Shape6.Top - Shape7(i).Top Call negativo(distancia) Call negativo(distancia2) If (distancia < 200 And distancia2 < 200) Then If (paso1 = 0) Then paso1 = 1 queda = Shape6.Left queda1 = Shape6.Top End If Shape6.Left = queda + 20 Shape6.Top = queda1 + 20 Exit Sub End If Next i paso1 = 0 End Sub Public Sub perdistes() MsgBox ("perdistes") Timer1.Enabled = False Timer2.Enabled = False Timer3.Enabled = False End Sub Private Sub Timer3_Timer() Dim distancia As Integer Dim distancia2 As Integer Dim i As Integer For i = 0 To maximolabels distancia = Shape5.Left - Shape7(i).Left distancia2 = Shape5.Top - Shape7(i).Top Call negativo(distancia) Call negativo(distancia2) If (distancia < 200 And distancia2 < 200) Then If (paso = 0) Then paso = 1 queda = Shape5.Left queda1 = Shape5.Top End If Shape5.Left = queda + 20 Shape5.Top = queda1 + 20 Exit Sub End If Next i paso = 0 End Sub Private Sub Timer4_Timer() Dim toco As Integer Dim toco2 As Integer toco = Shape5.Left - Shape6.Left toco2 = Shape5.Top - Shape6.Top Call negativo(toco) Call negativo(toco2) If (toco < 200 And toco2 < 200) Then Call manchado End If End Sub Public Sub manchado() If (mancha = 0) Then Shape5.Top = Shape5.Top + 400 Shape5.Left = Shape5.Left + 400 Label3.Caption = "player 2" Shape6.BackColor = vbRed Shape5.BackColor = vbBlue mancha = 1 Else Shape6.Top = Shape6.Top + 400 Shape6.Left = Shape6.Left + 400 Label3.Caption = "player 2" mancha = 0 Shape6.BackColor = vbBlue Shape5.BackColor = vbRed End If End Sub Private Sub Timer5_Timer() Label1.Caption = Label1.Caption - 1 If Label1.Caption = 0 Then If (mancha = 1) Then Form2.Label2.Caption = Label8.Caption Else Form2.Label2.Caption = Label7.Caption End If Unload Me Form2.Show End If End Sub Private Sub Timer6_Timer() Label9.Caption = Label8.Caption Label9.Top = Shape6.Top Label9.Left = Shape6.Left Label10.Caption = Label7.Caption Label10.Top = Shape5.Top Label10.Left = Shape5.Left End Sub