elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: (TUTORIAL) Aprende a emular Sentinel Dongle By Yapis


  Mostrar Mensajes
Páginas: 1 2 3 4 [5] 6
41  Programación / Programación Visual Basic / Re: Como hacer un chat con multiconexion en: 17 Octubre 2007, 09:29 am
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.
42  Programación / Programación Visual Basic / Problema conexión Winsock en: 15 Octubre 2007, 23:52 pm
¿Qué significa "Se ha forzado el rechazo de la conexión"?  :huh: :huh: :huh: :huh:
43  Programación / Programación Visual Basic / Re: Cambiar objeto a variable en: 14 Octubre 2007, 04:37 am
Solucionado... XDDDD el error era mas tonto de lo que creía...

Código:
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



PD: He dejado el codigo anterior, por si sirve de algo, para que se entienda todo.
Muxisisimas gracias a todos, aunque en especial a ranslsad, que a sido el que me ha hecho dar vueltas a la cabeza.. xDDD Gracias :p

Tema zanjado.
44  Programación / Programación Visual Basic / Re: Cambiar objeto a variable en: 14 Octubre 2007, 03:51 am
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_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


45  Programación / Programación Visual Basic / Re: Cambiar objeto a variable en: 14 Octubre 2007, 03:44 am
Eso es exactamente lo que quería pero he probado de mil maneras y no lo he conseguido, voy a probar haber, como tu has dicho...

Te aviso.
46  Programación / Programación Visual Basic / Re: Cambiar objeto a variable en: 13 Octubre 2007, 22:37 pm
Mmmm... Lo expongo de otra manera.

Estoy usando una librería llamada dx_lib32.dll (diseñada para videojuegos). Para definir las colisiones, es necesario colocar un objeto en el form(diseño) y una variable en el código, indicando en la variable el tamaño y posición de su objeto. Pongo el code para que sea mas fácil de entender.

Código:
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

'...

Este código sólo detecta 3 bloques que impiden el paso, ahora imaginaros que quereis 100 bloques. Escribir eso sería un castigo.

Pues preguntaba que si habria alguna manera de ahorrar código.

Gracias.

PD: Si no está claro, decidlo.
47  Programación / Programación Visual Basic / Re: Cambiar objeto a variable en: 13 Octubre 2007, 13:27 pm
Código:
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


Pero no va. Si hay por ejemplo 50 muros, el código sería enorme, por eso hago Muro(i). Se puede hacer de alguna manera?
48  Programación / Programación Visual Basic / Cambiar objeto a variable en: 13 Octubre 2007, 04:52 am
Se puede convertir un objeto a una variable?, es decir:

Yo tengo Shape1 y la quiero convertir a shape (siendo "shape" el nombre de la variable). ¿Se podría?
49  Programación / Programación Visual Basic / Re: Separar cadenas de un TextBox en: 11 Octubre 2007, 23:53 pm
un msgBox muestra 01 y el otro Hola mundo, los separa "-" no? :p
50  Programación / Programación Visual Basic / Separar cadenas de un TextBox en: 11 Octubre 2007, 22:30 pm
Me preguntaba que si se podria separar una cadena en dos en un textbox. Por ejemplo:

En un textBox tengo: "Hola, HJZR4"
¿Podría separar "Hola de "HJZR4", y guardarlas cada una en una variable...

Gracias.
Páginas: 1 2 3 4 [5] 6
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines