ok im making a small game in vb for a prject for school. i have it so i press "a" to move left, "d" to move right, and "w" to jump. but so far i have no idea how to make my picbox move up and down. i can get it to go straight up and then back down but i want to be able to move either left or right while in the air. heres my code so far if it helps.
CODE
Private Sub txtMove_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtMove.TextChanged
If txtMove.Text = "d" Or txtMove.Text = "a" Or txtMove.Text = "w" Then 'Checks if a movement button is pressed
If txtMove.Text = "d" Then 'if the letter "d" is pressed it will cause the player to move right
CharRight = True 'Shows the Right char pic
If CharRight Then 'Checks if charright is true
picChar.Image = picCharRight.Image 'changes images
CharRight = Not CharRight 'switchs charright off
End If
picChar.Left = picChar.Left + 10
txtMove.Text = ""
ElseIf txtMove.Text = "a" Then
CharLeft = True
If CharLeft Then
picChar.Image = picCharLeft.Image
CharLeft = Not CharLeft
End If
picChar.Left = picChar.Left - 10
txtMove.Text = ""
ElseIf txtMove.Text = "w" Then
tmrJump.Enabled = Not (tmrJump.Enabled)
txtMove.Text = ""
End If
Else
txtMove.Text = ""
End If
End Sub
Private Sub tmrJump_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrJump.Tick
Do Until picChar.Location.Y = 170
picChar.Top = picChar.Location.Y - 1
Loop
Do Until picChar.Location.Y = gravity
picChar.Top = picChar.Location.Y + 1
Loop
tmrJump.Enabled = Not (tmrJump.Enabled)
End Sub