本文介绍了在键盘上实现输入键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 在学习C ++之后,我是C#的初学者.我想将XNA 4.0与C#一起使用来创建2D \ 3D游戏.有一些区别,但与C ++相当.我正在使用XNA创建Pong克隆游戏,并且已经为桨创建了基本的AI. 现在我需要能够使用向上和向下键来上下移动桨叶.I'm a beginner in C# after learning C++. I wanted to use XNA 4.0 with C# to create 2D\3D games. There are some differences, but quite a bit is the same as C++. I'm working on creating a Pong clone game with XNA and I've created the basic AI for a paddle and now I need to be able to use the Up and Down keys to move your paddle up and down.我想要这样的东西:如果(Keys.Up)if (Keys.Up) p1_y-; 显然我不能这样做,因为它不能将其转换为布尔值.我需要做什么?我正在运行Visual Studio2010.在此先感谢您的帮助.Apparently I can't do that as it says it can't convert it into a boolean. What do I have to do? I'm running Visual Studio 2010. Any help is appreciated, thanks in advance.推荐答案if(e.KeyCode == Keys.Up) 这篇关于在键盘上实现输入键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!