I have done one of the tutorials on this site http://www.dreaminco...wtopic39686.htm creating a fully functional Ping-Pong program. Please be aware I am extremely new to any programming language and to VB.net itself.
After I completed the tutorial I went ahead to practice messing with things to help me learn and develop my own standards. I created things like two computers fighting each other.
I went ahead to attempt to create a Ping-Pong game that was for two players, clearly this was needed to be done on the keyboard, one on mouse and one on keyboard could give one a advantage so I decided that player one is "W = up" and "S = Down" player 2 is the arrows up and down.
The tutorial gave what seemed like a door to practice and fiddle with to try and attempt to complete this.
#Region "End Game on Escape Press" ' Escape the game when escape has been pressed. Private Sub pongMain_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown If e.KeyValue = Keys.Escape Then Me.Close() End If End Sub #End Region
So I messed around and finally came up with something like this
Private Sub frmPong_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown If e.KeyValue = Keys.W Then picPlayer1.Location = New Point(picPlayer1.Location.X + 5) End If End Sub
Of course I messed around a lot with this, I have been doing this type of thing all day since I woke up, nothing much else to do today, after much head banging I finally realised I will not crack it without assistants. This little bit of code shows you what I have tried to do.
All things I tried gave the same result, once I pressed the key the paddle went to the top of the page and to the left, I realised after testing if I removed +5 it just moved to the top of the page I can not figure out how to work it so the paddles move up and down.
Please Help, Thanks.
Is this post to long?