I have these three images that I have drawn to my form.
GraphicsBuffer.DrawImage(ButtonEasy, New Rectangle(25, 330, 100, 50), 0, 0, 100, 50, GraphicsUnit.Pixel, ImageAttributes)
GraphicsBuffer.DrawImage(ButtonMedium, New Rectangle(150, 330, 100, 50), 0, 0, 100, 50, GraphicsUnit.Pixel, ImageAttributes)
GraphicsBuffer.DrawImage(ButtonHard, New Rectangle(275, 330, 100, 50), 0, 0, 100, 50, GraphicsUnit.Pixel, ImageAttributes)
But I want to make a Boolean expression for when they are clicked so I can trigger the events to load the game mode selected.
Do I do this through resource code or is there a simply way to do this. My idea seems like it would be bad and not syntaxically correct.
Edit: I've gotten to this:
Private Sub ButtonEasy_MouseClick(ByVal sender As Object, ByVal e As MouseEventArgs) _
Handles ButtonEasy.MouseClick
Dim buttonEasyRect = New Rectangle(25, 330, 100, 50)
If buttonEasyRect.Contains(e.Location) Then
End If
End Sub
But not really sure where to go from this. Apparently "ButtonEasy.Mouseclick" Handles throws an error "WithEvents variable undefined". Not sure where to go from here.
Thanks in advance!
Edit2: After help from LarsTech I've gotten an Enum in and this:
Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs) Handles Me.MouseDown
Dim level As Difficulty = Difficulty.None
If e.Button = MouseButtons.Left Then
End If
If New Rectangle(25, 330, 100, 50).Contains(e.Location) Then
level = Difficulty.Easy
ElseIf New Rectangle(150, 330, 100, 50).Contains(e.Location) Then
level = Difficulty.Medium
ElseIf New Rectangle(275, 330, 100, 50).Contains(e.Location) Then
level = Difficulty.Hard
End If
If level = Difficulty.Easy Then
GameMode = 1
ElseIf level = Difficulty.Medium Then
GameMode = 2
ElseIf level = Difficulty.Hard Then
GameMode = 3
End If
End Sub
How do I call this in my loop? Currently I have the loop wait for Asynchkeypress to set timescale to 300 which starts the game.