游戏中启用多点触控吗?
我正在 Xcode 中创建一个简单的乒乓球游戏。我有一个 2 人版本,两个桨都可以移动并且功能完美。游戏完美无缺,只是你不能同时移动两个桨,导致 2 人模式毫无用处。
如何使两个桨同时移动? 我已经尝试在 Interface Builder 中选择“多点触摸”按钮,但它什么也没做,而且我不太确定它是否是我想要的启用多点触摸的正确途径。
另外,如果这很重要的话,我的游戏是基于视图的应用程序。
谢谢!
I am creating a simple pong game in Xcode. I have a 2 player version and both paddles can be moved and function perfectly. The game is flawless except for the fact that you cannot move both paddles at the same time, rendering the 2 player mode useless.
How can I enable both paddles to be moved at the same time?
I've already tried selecting the "Multiple Touch" button in Interface Builder but it does nothing and im not quite sure it is even the correct route into enabling multi touch as I want it.
Also, my game is a View-Based Application if that matters.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
编辑:我读错了问题。添加了代码片段。
这是当我收到touchesBegan事件时用来提取所有触摸的代码:
对于touchesEnded和touchesMoved也类似
EDIT: I mis-read the question. Added code snippet.
Here's the code I use to extract all touches when I get a touchesBegan event:
and similarly for touchesEnded and touchesMoved
根据我的经验(不是那么多)。您可以为 2 个桨创建 2 个 UIView,触摸一个视图将移动一个桨,而触摸另一个视图将移动另一个桨。我希望这有帮助。
如果您不知道如何拆分视图,您可以简单地让它识别 2 个触摸,
您可以使用这个,它可能不是最有效的,但如果您不知道如何拆分触摸,它确实有效。
From my experience (which isn't that much). You can create 2 UIViews for the 2 paddles, touching in one view will move one paddle, while touching in the other will move the other paddle. I hope this helps.
If you don't know how to split the views, you can simply make it identify 2 touches
This you can use, it probably isn't the most productive, but it does work if you can't figure out how to split the touches.
默认为否
by default it is No