如何检测数组
好的,有没有一种有效的方法可以使用 KeyListener 检测您当前所在的数组?
我的代码: http://www.javadan.pastebin.com/X68VyuGL
我正在尝试这里要做的是查看我所在的当前图块是否被阻止。
谢谢。
OK so, is there an efficient way to detect on what array you're currently on by using the KeyListener?
My code: http://www.javadan.pastebin.com/X68VyuGL
What I am trying to do here is see if the current tile I am on is BLOCKED.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我猜您不想每次都遍历整个矩阵来找出关键事件后用户使用的图块。为什么不保留棋盘上玩家最后位置的状态,并在更新发生的每个关键事件时使用它?
好吧,您想要更多有关如何执行此操作的信息,我将为您提供答案,您可以完成它:
I'm guessing you don't want to have to traverse the entire matrix every time to find out what tile the users on after a key event. Why not keep the state of the last position of the player on the board and use it when you're updating for each key event that occurs?
Alright, you wanted some more information on how to do this, I'll seed the answer for you and you can finish it :