Hi,
In my game of Battleships, I am trying right now to randomly generate ship placement for the computer.
I have made the program generate one particular spot in the grid using code like this:
While CPlacementX > 5
GenerateCoords()
End While
For Each label In Me.Controls
If label.Tag = "C" & "x" & CPlacementX & "y" & CPlacementY Then
For j = 0 To 4
ComputerGrid(CPlacementX + j, CPlacementY) = "AC"
label.Text = "AC"
Next j
End If
Next
This works fine to generate it in one spot, but I have multiple square ships like this code is for an Aircraft Carrier, so, my question is: How do I modify this code so it 'steps off' another 4 squares to the right of the original one and make all the labels text "AC" Also, how I would I later make this code show a picturebox instead of a label?
Help would be much appreciated :)