Tambien si alguien supiera que a un determinado numero de que la serpiente haya comido te mande a otro form, por ejemplo que lleve 20 comidas y ya hay te mande a otro form.
El codigo que tengo es el siguiente:
Código:
Espero me pueden ayudar Public a As Boolean
Public b As Boolean
Public c As Boolean
Public d As Boolean
Public q As Integer
Public z As Integer
Public Y As Integer
Public X As Integer
Public t As Integer
Public Val As Boolean
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyLeft
If b = True Then
Exit Sub
End If
a = True
b = False
c = False
d = False
Case vbKeyRight
If a = True Then
Exit Sub
End If
b = True
a = False
c = False
d = False
Case vbKeyDown
If d = True Then
Exit Sub
End If
c = True
b = False
a = False
d = False
Case vbKeyUp
If c = True Then
Exit Sub
End If
d = True
b = False
c = False
a = False
Case Else
Exit Sub
End Select
End Sub
Private Sub cargar()
Randomize
Y = 1
X = 1
Do Until (Y Mod 240) = 0 And Y > 0 And Y < (Me.ScaleHeight - 255) And (X Mod 240) = 0 And X > 0 And X < (Me.ScaleWidth - 255)
Y = Int(Rnd() * (Me.ScaleHeight - 1) + 1)
X = Int(Rnd() * (Me.ScaleWidth - 1) + 1)
Loop
Load Shape1(t)
Shape1(t).Top = Y
Shape1(t).Left = X
Shape1(t).Visible = True
Me.Refresh
End Sub
Private Sub Form_Load()
t = 1
Call cargar
End Sub
Private Sub Timer1_Timer()
If Val = True Then
z = q
Do Until q = 0
Shape1(q).Top = Shape1(q - 1).Top
Shape1(q).Left = Shape1(q - 1).Left
q = q - 1
Loop
q = z
End If
If a = True Then
Shape1(0).Left = Shape1(0).Left - 240
End If
If b = True Then
Shape1(0).Left = Shape1(0).Left + 240
End If
If c = True Then
Shape1(0).Top = Shape1(0).Top + 240
End If
If d = True Then
Shape1(0).Top = Shape1(0).Top - 240
End If
If Val = True Then
For k = 1 To q
If Shape1(0).Top = Shape1(k).Top And Shape1(0).Left = Shape1(k).Left Then
End
End If
Next
End If
If Shape1(0).Left = Shape1(t).Left And Shape1(0).Top = Shape1(t).Top Then
Val = True
t = t + 1
q = t
q = q - 1
Call cargar
End If
If Shape1(0).Top > (Me.ScaleHeight - 255) Or Shape1(0).Top < 0 Or Shape1(0).Left > (Me.ScaleWidth - 255) Or Shape1(0).Left < 0 Then
End
End If
End Sub


