cambalinho 125 Practically a Posting Shark

these is the VB6 function for RayCasting:

Private Sub DrawRays()

        Dim StepX As Double
        Dim StepY As Double
        Dim VertX As Double
        Dim VertY As Double
        Dim HorizX As Double
        Dim HorizY As Double
        Dim MapX As Long
        Dim MapY As Long
        Dim HorizDist As Double
        Dim VertDist As Double
        Dim WallDistance As Double
        Dim RayHeight As Double
        Dim RayRadians As Double
        Dim RadiansSteps As Double
        Dim RayCount As Long
        Dim RayCounts As Long
        Dim OffSetGrid As Long


        RayCount = imgverticalline.Width

        MapX = Player.MapX
        MapY = Player.MapY
        RadiansSteps = Radian60 / RayCount

        RayRadians = (Player.Radians - Radian30)
        RayCounts = 0
        Do While RayCounts < RayCount
            If (RayRadians > Radian360) Then RayRadians = 0.001
            'Check for horizontal intersections:

            If RayRadians >= 0 And RayRadians <= Math.PI Then 'Facing down
                HorizY = (Fix(player.PosY / ObjectSize) * ObjectSize) + ObjectSize ' Calculate grid position
                HorizX = player.PosX + (HorizY - player.PosY) / Math.Tan(RayRadians)
                StepY = ObjectSize
            ElseIf RayRadians = 0 Or RayRadians = Math.PI Then
                HorizY = player.PosY
                HorizX = player.PosX
            Else 'Facing Up
                HorizY = (Fix(player.PosY / ObjectSize) * ObjectSize) - 1
                HorizX = player.PosX + (HorizY - player.PosY) / Math.Tan(RayRadians)
                StepY = -ObjectSize
            End If

            StepX = StepY / Math.Tan(RayRadians)
            MapX = GetPositionMap(HorizX)
            MapY = GetPositionMap(HorizY)



            Do
                If MapX < 0 Or MapX > 9 Or MapY < 0 Or MapY > 9 Then Exit Do
                If levelmap0(MapY, MapX) = Color.Black Then Exit Do
                HorizX = HorizX + StepX
                HorizY = HorizY + StepY

                MapX = GetPositionMap(HorizX)
                MapY = GetPositionMap(HorizY)

            Loop


            HorizDist = Math.Abs((player.PosX - HorizX) / Math.Cos(RayRadians))

            'Check for vertical intersections:
            If RayRadians < Radian90 Or RayRadians > Radian270 Then 'Facing right
                VertX = (Fix(Player.PosX / ObjectSize) * ObjectSize) + ObjectSize ' Calculate grid position
                VertY = player.PosY + (player.PosX - VertX) * -Math.Tan(RayRadians)
                StepX = ObjectSize
            ElseIf RayRadians = Radian90 Or RayRadians = Radian270 Then
                VertY = Player.PosY
                VertX = Player.PosX
            Else 'Facing left
                VertX = (Fix(Player.PosX / ObjectSize) * ObjectSize) - 1
                VertY = player.PosY + (player.PosX - VertX) * -Math.Tan(RayRadians)
                StepX = -ObjectSize
            End If

            StepY = StepX * Math.Tan(RayRadians)
            MapX = GetPositionMap(VertX)
            MapY = GetPositionMap(VertY)

            Do
                If MapX < 0 Or MapX > 9 Or MapY < 0 Or MapY > 9 Then Exit Do
                If levelmap0(MapY, MapX) = Color.Black Then Exit Do
                VertX = VertX + StepX
                VertY = VertY + StepY

                MapX = GetPositionMap(VertX)
                MapY = GetPositionMap(VertY)
            Loop

            VertDist = Math.Abs((player.PosX - VertX) / Math.Cos(RayRadians))
            Dim VertColor As Color

            If VertDist <= HorizDist Then
                WallDistance = VertDist
                OffSetGrid = VertY Mod ObjectSize
                VertColor = Color.Aqua
            Else
                OffSetGrid = HorizX Mod ObjectSize
                WallDistance = HorizDist
                VertColor = Color.Blue
            End If

            WallDistance = WallDistance * Math.Cos(RayRadians - player.Radians) 'avoiding the Fish Effect
            RayHeight = (ObjectSize / WallDistance) * 200 ' is the height screen\
            If (OffSetGrid = ObjectSize) Then RayHeight -= 1
            'picWall1.DrawTextureVerticalLine(A.MemoryHDC, OffSetGrid, Fix(RayHeight * 4), RayCounts, 5)
            imgverticalline.ForeColor(RGB(VertColor.R, VertColor.G, VertColor.B))
            imgverticalline.DrawLine(RayCounts, imgverticalline.Height / 2 - RayHeight \ 2, RayCounts, imgverticalline.Height / 2 + RayHeight \ 2)
            RayRadians = RayRadians + RadiansSteps
            RayCounts = RayCounts + 1
        Loop

    End Sub

result:
https://imgur.com/gllD3qg
when the 'OffSetGrid' is zero or ObjectSize, i get that different color bar... and i don't know why...
i tried severalthings without success... and yes i'm here too: https://www.vbforums.com/showthread.php?902527-VB6-raycasting-how-get-the-image-line
but without success :(