Ver Mensaje Individual
  #7 (permalink)  
Antiguo 25/03/2008, 17:38
Avatar de seba123neo
seba123neo
 
Fecha de Ingreso: febrero-2007
Ubicación: Esperanza, Santa Fe
Mensajes: 1.046
Antigüedad: 18 años, 2 meses
Puntos: 19
Re: Necesito ayuda con vb 6.0

estaba ocupado no pude responder,pero seria algo asi ,y sin apis:

Código:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Dim pic1Left As Integer, pic1Top As Integer, pic1Right As Integer, pic1Bottom As Integer, pic2Left As Integer, pic2Top As Integer, pic2Right As Integer, pic2Bottom As Integer
Dim topBetween As Boolean, bottomBetween As Boolean, leftBetween As Boolean, rightBetween As Boolean
Select Case KeyCode
Case vbKeyUp
Call Arriba
Case vbKeyDown
Call abajo
Case vbKeyRight
Call derecha
Case vbKeyLeft
Call izquierda
End Select
pic1Left = p.Left
pic1Right = p.Left + p.Width
pic1Top = p.Top
pic1Bottom = p.Top + p.Height
pic2Left = Shape2.Left
pic2Right = Shape2.Left + Shape2.Width
pic2Top = Shape2.Top
pic2Bottom = Shape2.Top + Shape2.Height
If pic1Left >= pic2Left And pic1Left <= pic2Right Then
leftBetween = True
End If
If pic1Right >= pic2Left And pic1Right <= pic2Right Then
rightBetween = True
End If
If pic1Top >= pic2Top And pic1Top <= pic2Bottom Then
topBetween = True
End If
If pic1Bottom >= pic2Top And pic1Bottom <= pic2Bottom Then
bottomBetween = True
End If
If leftBetween = True Or rightBetween = True Then
If topBetween = True Or bottomBetween = True Then
MsgBox "colision"
Unload Me
End If
End If
End Sub

Sub Arriba()
p.Top = p.Top - 0.5
End Sub

Sub abajo()
p.Top = p.Top + 0.5
End Sub

Sub derecha()
p.Left = p.Left + 0.5
End Sub

Sub izquierda()
p.Left = p.Left - 0.5
End Sub
suponiendo que tenes un shape llamado "p" y el otro llamado "Shape2"..

saludos.
__________________
" Todos Somos Ignorantes; lo que pasa es que no todos ignoramos las mismas cosas " - Albert Einstein