强大的老乒乓球(译文)
By robot-v1.0
本文链接 https://www.kyfws.com/games/the-old-mighty-pong-zh/
版权声明 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
- 2 分钟阅读 - 952 个词 阅读量 0强大的老乒乓球(译文)
原文地址:https://www.codeproject.com/Articles/20111/The-Old-Mighty-Pong
原文作者:Buffalloy
译文由本站 robot-v1.0 翻译
前言
A classic in game history.
游戏史上的经典之作.
介绍(Introduction)
我对某些有关如何制作Pong的VB6教程感到震惊.那里显示了一些可怕的功能,库和我无法理解的东西.因此,我认为我可以将代码简化到具有我的经验的程序员可以理解的水平.我从头开始编写代码,几天后,我设法完成了任务…(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…)
背景(Background)
好吧,我想你们中很多人都打过Pong …这只是经典.但是在我的解决方案中,有一些棘手的部分,例如控件-它们是按钮,其标题前面带有"&“标题.并且在设置控件部分时,您可能会注意到,如果在实际控件之前删除字符”&",将无法正常工作…(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 “) Top
“.(”.)
这是一段代码:(Here is a piece of the code:)
'timer sub
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)
当我这样做时,我感到非常兴奋,因为我知道了一种使物体移动的新方法.最后,我制作了一个应用程序,从中获得了:D(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)
历史(History)
我会随时关注您的改进要求.如果您想与我联系-我的电子邮件是(I will keep an eye on your requests for improvement. If you’d like to contact me - my e-mail is)buffalo@abv.bg(buffallo@abv.bg).(.)
许可
本文以及所有相关的源代码和文件均已获得The Code Project Open License (CPOL)的许可。
VB VB8.0 Windows .NET .NET2.0 Visual-Studio VS2005 Dev 新闻 翻译