I'm making a simple game. I want simultaneously go up and left.
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
' If e.KeyCode = Keys.Z Or e.KeyCode = Keys.Up Then
' Me.PictureBox1.Location = New Point(PictureBox1.Location.X, PictureBox1.Location.Y - 5)
' End If
' If e.KeyCode = Keys.S Or e.KeyCode = Keys.Down Then
'Me.PictureBox1.Location = New Point(PictureBox1.Location.X, PictureBox1.Location.Y + 5)
' End If
'If e.KeyCode = Keys.Q Or e.KeyCode = Keys.Left Then
'Me.PictureBox1.Location = New Point(PictureBox1.Location.X - 5, PictureBox1.Location.Y)
' End If
If e.KeyCode = Keys.Right And e.KeyCode = Keys.Up Then
Me.PictureBox1.Location = New Point(PictureBox1.Location.X + 5, PictureBox1.Location.Y)
End If
End Sub
left, right, down and up work. now diagonal.
thanks in advance.