A description of my game:
When you start the game, you have a few seconds to memorize the arrangement of the grids. By the arrangement, I mean each grid is one of two colors. After the time is up, all the grids are set to the 'off' color. The player must click on the grids to toggle them and put them in their correct color assignments as they were seen before.
Okay so this is part of a game I am developing.Instead of using solid colors, I want use background images but I don't know how to edit the code to do so. Any help would be welcome.
Dim GridOn As Color = Color.LightBlue
Dim GridOff As Color = Color.DarkBlue
Dim MaxTime As Integer = 40
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
For Each pic As Control In Me.Controls 'For every picture in form1's controls...
If TypeOf pic Is PictureBox Then 'Then, only picks the pictureboxes, not the buttons, labels, etc.
AddHandler pic.Click, AddressOf PictureBoxClick 'For each picturebox (grid), add an event handler (PictureBoxClick) to avoid
End If 'typing 16 of them ourselves
Next
End Sub
Private Sub PictureBoxClick(ByVal sender As System.Object, ByVal e As System.EventArgs)
If AllowEdit = True Then
Dim ctrl As PictureBox = DirectCast(sender, Control)
If ctrl.BackColor = GridOn Then
ctrl.BackColor = GridOff 'Set the backcolor to either GridOn or GridOff
Else : ctrl.BackColor = GridOn
End If
Else
'Do not allow the user to change the colors
End If
End Sub