Option Explicit
'First Set
Dim helldivers(0 To 3, 0 To 3) As String
Dim xTop, xBottom, yTop, yBottom As Integer
'Counters
Dim x1, x2 As Integer
'Position Holders
Dim x1h, x2h As Integer
'Iteration
Dim iLoops As Integer
Private Sub Command1_Click()
Debug.Print "X Top: " & UBound(helldivers, 1)
Debug.Print "X Bottom: " & LBound(helldivers, 1)
xTop = UBound(helldivers, 1)
xBottom = LBound(helldivers, 1)
Debug.Print "Y Top: " & UBound(helldivers, 2)
Debug.Print "Y Bottom: " & LBound(helldivers, 2)
yTop = UBound(helldivers, 1)
yBottom = LBound(helldivers, 1)
'Number of iterations - From 0 to Array(Max)
iLoops = (UBound(helldivers, 1) * 2) - 1
'Start - First Item in the Array
x1 = xTop
x2 = xBottom
Debug.Print "START-----------------------------------"
Debug.Print helldivers(x1, x2)
Debug.Print "END-----------------------------------"
Dim i As Integer
Dim iStop As Integer
'Main Loop
For i = 0 To iLoops
Debug.Print "START-----------------------------------"
If x1 >= 1 Then
x1 = x1 - 1
Else
x2 = x2 + 1
End If
Debug.Print helldivers(x1, x2)
If i >= xTop Then
'Reverse - backwards
iStop = iStop - 1
Else
'Normal - forward
iStop = i + 1
End If
Dim h As Integer
For h = 1 To iStop
x1h = x1 + h
x2h = x2 + h
Debug.Print helldivers(x1h, x2h)
Next h
Debug.Print "END-----------------------------------"
Next i
End Sub
Private Sub Form_Load()
'First Set - Comment this out along with the Array definition at the top.
helldivers(0, 0) = "0,0"
helldivers(0, 1) = "1,0"
helldivers(0, 2) = "2,0"
helldivers(0, 3) = "3,0"
helldivers(1, 0) = "0,1"
helldivers(1, 1) = "1,1"
helldivers(1, 2) = "2,1"
helldivers(1, 3) = "3,1"
helldivers(2, 0) = "0,2"
helldivers(2, 1) = "1,2"
helldivers(2, 2) = "2,2"
helldivers(2, 3) = "3,2"
helldivers(3, 0) = "0,3"
helldivers(3, 1) = "1,3"
helldivers(3, 2) = "2,3"
helldivers(3, 3) = "3,3"
End Sub