pong,i just need to know how to make the controls...i've got the pictures and everything...I also need to know how to make the AI...please help...
Visual Basic Express Edition
pong,i just need to know how to make the controls...i've got the pictures and everything...I also need to know how to make the AI...please help...
Private Sub Form1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
If e.KeyCode = Keys.Down Then
PictureBox.Top = PictureBox.Top + 5
ElseIf e.KeyCode = Keys.Up Then
PictureBox.Top = PictureBox.Top - 5
End If
End Sub
I couldn't get the code to work in the form event (not sure why exactly)
however i did get it to work by putting a richtextbox on the form and used the following code
set both it's height and width to 0
sloppy but it works
Private Sub RichTextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles RichTextBox1.KeyDown
If e.KeyCode = Keys.Down Then Me.Button1.Top = Me.Button1.Top + 5 ElseIf e.KeyCode = Keys.Up Then Me.Button1.Top = Me.Button1.Top - 5 End Ife.Handled =
True End Sub
the other thing
you might be able to make the movement smoother and faster by using a timer to handle the movement
just a thought