iPhone SDK:移动和旋转触摸
我有一张鱼的图像 - 如果用户触摸屏幕,我希望鱼“看”触摸点并移动到那里。如果触摸已移动,我希望鱼不断跟随触摸。
我怎样才能做到这一点?
I have an image of a fish - If the user touches the screen I want the fish to "look" at the touched point and move there. If the touch has been moved i want the fish constantly following the touch.
How can I do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
会是这样的:
您可能也想实现这些:
编辑:更新了代码,现在旋转是在单独的动画中完成的,因此鱼旋转的速度比游动的速度快。
would be something like this:
and you probably want to implement these too:
EDIT: updated code, now the rotation is done in a separate animation, so that the fish rotates faster than he swims.