I was staring in shock at some VB6 tutorials on how to make Pong. There were shown some awful functions, libraries, and things I couldn't understand. So I thought I could simplify the code to a level which a programmer with my experience would understand. I began to code from scratch, and in a few days, I managed to accomplish the task...
Well, I suppose that many of you have played Pong... it's just a classic. But in my solution, there are some tricky parts, like the controls - they are buttons which have captions with "&" in front. And when set the controls section, you will probably notice that if you delete the char "&" before the actual control, it wouldn't work...
Using the Code
The code is nothing serious as I mentioned earlier. I have replaced the
currenX position with the "
Left" property and
currentY with "
Here is a piece of the code:
If Ball.Top = 0 Then optDown.Checked = True
If Ball.Top = 264 Then optUp.Checked = True
If optUp.Checked = True Then Ball.Top = Ball.Top - 1
If optDown.Checked = True Then Ball.Top = Ball.Top + 1
If optLeft.Checked = True Then Ball.Left = Ball.Left - 1
If optRight.Checked = True Then Ball.Left = Ball.Left + 1
If Ball.Left < -20 Then lblP2Score.Text = lblP2Score.Text + 1
If Ball.Left > 408 Then lblP1Score.Text = lblP1Score.Text + 1
Points of Interest
I was very exited when I did it, because I got to know a new way of making objects move. And I finally made an app from which I earned :D
I will keep an eye on your requests for improvement. If you'd like to contact me - my e-mail is email@example.com.
I was born in Plovdiv, Bulgaria in1991.
I began programming two years ago, and the firs language I encountered was Pascal. I got to know it very well, but five or six months ago I took up Visual Basic. I still study it, and as far as I can see I have a lot to do, befor I can develop serious apps and games.It's hard to study programming when you are in highschool... Pitty...
Dimitar Todorov, BG.