0

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.

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by debasisdas
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.