如何开发“旋转瓶子”应用 [英] How to develop a "spin the bottle" application
问题描述
我正在开瓶游戏。我无法弄清楚如何通过滑动手指的速度来控制瓶子的旋转速度。我希望它像命运之轮一样工作,你刷的速度越快就越快。
I am making a spin the bottle game. I can't figure out how to make the bottle's spin speed controlled by how fast you swipe your finger. I want it to work like the wheel of fortune, the faster you swipe the faster it spins.
我开始用 UIRotationGestureRecognizer进行开发
,但我真的不认为这是最好的方法。
I started to develop with the UIRotationGestureRecognizer
, but I really don't think it is the best way to do that.
推荐答案
嘿检查< a href =http://www.walnutlabs.com/blog/?p=9 =nofollow noreferrer>此演示。
你必须计算 velocity
。这取决于 touchesMoved:withEvent:
和 touchesEnded:withEvent:
。
You have to calculate velocity
. Which depends on touchesMoved:withEvent:
and touchesEnded:withEvent:
.
这也是有用的链接: iphone开发 - UIRotationGestureRecognizer(顺时针和逆时针检测)?
这篇关于如何开发“旋转瓶子”应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!