在 Cocos2d for iPhone 中随时获取当前触摸位置
本文介绍了在 Cocos2d for iPhone 中随时获取当前触摸位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直在使用以下方法来检测触摸何时开始以及位置是什么:
I have been using the following method to detect when a touch began and what the location is:
但如果我的手指仍在屏幕上,我也想知道如何随时获取当前位置.有谁知道怎么做?谢谢.
But I would also like to know how to get the current location anytime of my touch if my finger is still on the screen. Anyone know how? Thanks.
编辑
我想我会尽快将其发布为答案,但这就是我所做的:
I'll post this as an answer in a bit I think, but this is what I did:
我只是在我所有方法之外定义的 ccTime 方法中不断转换变量:
I just kept converting a variable in a ccTime method defined outside of all my methods:
推荐答案
试试这样...
这篇关于在 Cocos2d for iPhone 中随时获取当前触摸位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!