pero este control, es capaz de enviar algo a un cliente?, y que otro cliente tambien lo vea?, y viceversa, si un cliente envía algo al servidor, que los demás clientes también lo vean.
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes Menú
Modificado: He solucionado, era un error mio, xDDDDD
Ahora me salta error en tiempo de ejecución:
"el subindice está fuera del intervalo"
Eso me salta, al comprobar que esta colisionando... :S
Código completo:
Código:
Public m_System As New dx_System_Class
Dim Bloque(1 To 10) As GFX_Rect
Dim c As GFX_Rect
Dim i As Integer
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyLeft
Char.Left = Char.Left - 160
c.X = Char.Left
c.Y = Char.Top
c.Width = Char.Width
c.Height = Char.Height
'!!!!!!!!!!!!!!!AQUI TENIA QUE PONER EL RANGO DE NUMEROS
LabelColision.Caption = m_System.MATH_IntersectRect(Bloque(i), c)
'Si hay colision, el char "no se mueve"
If LabelColision.Caption = "Verdadero" Then
Char.Left = Char.Left + 160
Label1.Caption = "Colision"
End If
'!!!!!!!!!!!!!!!!!AQUI EL FINAL (Next i)
Case vbKeyRight
Char.Left = Char.Left + 160
c.X = Char.Left
c.Y = Char.Top
c.Width = Char.Width
c.Height = Char.Height
LabelColision.Caption = m_System.MATH_IntersectRect(Bloque(i), c)
If LabelColision.Caption = "Verdadero" Then
Char.Left = Char.Left - 160
Label1.Caption = "Colision"
End If
Case vbKeyDown
Char.Top = Char.Top + 160
c.X = Char.Left
c.Y = Char.Top
c.Width = Char.Width
c.Height = Char.Height
LabelColision.Caption = m_System.MATH_IntersectRect(Bloque(i), c)
If LabelColision.Caption = "Verdadero" Then
Char.Top = Char.Top - 160
Label1.Caption = "Colision"
End If
Case vbKeyUp
Char.Top = Char.Top - 160
c.X = Char.Left
c.Y = Char.Top
c.Width = Char.Width
c.Height = Char.Height
LabelColision.Caption = m_System.MATH_IntersectRect(Bloque(i), c)
If LabelColision.Caption = "Verdadero" Then
Char.Top = Char.Top - 160
Label1.Caption = "Colision"
End If
Public m_System As New dx_System_Class
Dim Bloque(1 To 10) As GFX_Rect
Dim c As GFX_Rect
Dim i As Integer
Private Sub Form_Load()
For i = 1 To 10
Bloque(i).X = Shape(i).Left
Bloque(i).Y = Shape(i).Top
Bloque(i).Height = Shape(i).Height
Bloque(i).Width = Shape(i).Width
Next i
c.X = Char.Left
c.Y = Char.Top
c.Width = Char.Width
c.Height = Char.Height
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyLeft
Char.Left = Char.Left - 160
c.X = Char.Left
c.Y = Char.Top
c.Width = Char.Width
c.Height = Char.Height
LabelColision.Caption = m_System.MATH_IntersectRect(Bloque(i), c)
'Si hay colision, el char "no se mueve"
If LabelColision.Caption = "Verdadero" Then
Char.Left = Char.Left + 160
Label1.Caption = "Colision"
End If
Case vbKeyRight
Char.Left = Char.Left + 160
c.X = Char.Left
c.Y = Char.Top
c.Width = Char.Width
c.Height = Char.Height
LabelColision.Caption = m_System.MATH_IntersectRect(Bloque(i), c)
If LabelColision.Caption = "Verdadero" Then
Char.Left = Char.Left - 160
Label1.Caption = "Colision"
End If
Case vbKeyDown
Char.Top = Char.Top + 160
c.X = Char.Left
c.Y = Char.Top
c.Width = Char.Width
c.Height = Char.Height
LabelColision.Caption = m_System.MATH_IntersectRect(Bloque(i), c)
If LabelColision.Caption = "Verdadero" Then
Char.Top = Char.Top - 160
Label1.Caption = "Colision"
End If
Case vbKeyUp
Char.Top = Char.Top - 160
c.X = Char.Left
c.Y = Char.Top
c.Width = Char.Width
c.Height = Char.Height
LabelColision.Caption = m_System.MATH_IntersectRect(Bloque(i), c)
If LabelColision.Caption = "Verdadero" Then
Char.Top = Char.Top - 160
Label1.Caption = "Colision"
End If
Case Else
Exit Sub
End Select
End Sub
Option Explicit
Public m_System As New dx_System_Class
Dim Bloque1 As GFX_Rect
Dim Bloque2 As GFX_Rect
Dim Bloque3 As GFX_Rect
Dim Char As GFX_Rect
Private Sub Form_Load()
Bloque1.X = Shape1.Left
Bloque1.Y = Shape1.Top
Bloque1.Height = Shape1.Height
Bloque1.Width = Shape1.Width
Bloque2.X = Shape2.Left
Bloque2.Y = Shape2.Top
Bloque2.Height = Shape2.Height
Bloque2.Width = Shape2.Width
Bloque3.X = Shape3.Left
Bloque3.Y = Shape3.Top
Bloque3.Height = Shape3.Height
Bloque3.Width = Shape3.Width
End Sub
'...
Option Explicit
Public m_System As New dx_System_Class
'Variable para Arrays
Public i As Integer
Public n As Integer
'Variables para el juego
'Muros
Dim M(0 To 8) As GFX_Rect
Dim Wall(0 To 8) As Shape
'Char
Dim c As GFX_Rect
'Dimensiones de los muros y del char
Const MuroWidth = 255
Const MuroHeight = 255
Const CharWidth = 255
Const CharHeight = 255
'Movimiento de Char
Const MovChar = 240
Private Sub CargarNivel()
For i = 0 To 8
Set Wall(i) = Muro(i)
Next i
For i = 0 To 8
M(i).X = Muro(i).Left
M(i).Y = Muro(i).Top
M(i).Width = Muro(i).Width
M(i).Height = Muro(i).Height
Next i
c.X = Char.Left
c.Y = Char.Top
c.Width = Char.Width
c.Height = Char.Height
End Sub
Private Sub Form_Load()
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyLeft
Char.Left = Char.Left - MovChar
c.X = Char.Left
c.Y = Char.Top
c.Width = Char.Width
c.Height = Char.Height
For i = 0 To 8
'Esto comprueba si hay colision
LabelColision.Caption = m_System.MATH_IntersectRect(M(i), c)
Next i
'Si hay colision, el char "no se mueve"
If LabelColision.Caption = "Verdadero" Then
Char.Left = Char.Left + MovChar
Label1.Caption = "Sorry, not possible."
End If
Case vbKeyRight
Char.Left = Char.Left + MovChar
c.X = Char.Left
c.Y = Char.Top
c.Width = Char.Width
c.Height = Char.Height
For i = 0 To 8
LabelColision.Caption = m_System.MATH_IntersectRect(M(i), c)
Next i
If LabelColision.Caption = "Verdadero" Then
Char.Left = Char.Left - MovChar
Label1.Caption = "Sorry, not possible."
End If
Case vbKeyDown
Char.Top = Char.Top + MovChar
c.X = Char.Left
c.Y = Char.Top
c.Width = Char.Width
c.Height = Char.Height
For i = 0 To 8
LabelColision.Caption = m_System.MATH_IntersectRect(M(i), c)
Next i
If LabelColision.Caption = "Verdadero" Then
Char.Top = Char.Top - MovChar
Label1.Caption = "Sorry, not possible."
End If
Case vbKeyUp
Char.Top = Char.Top - MovChar
c.X = Char.Left
c.Y = Char.Top
c.Width = Char.Width
c.Height = Char.Height
For i = 0 To 8
LabelColision.Caption = m_System.MATH_IntersectRect(M(i), c)
Next i
If LabelColision.Caption = "Verdadero" Then
Char.Top = Char.Top + MovChar
Label1.Caption = "Sorry, not possible."
End If
Case Else
Exit Sub
End Select
End Sub