Cocos2D iPhone 重复按钮
使用Cocos2D,是否可以创建一个在触摸时不断触发的按钮,而不是只触发一次?
我很高兴有一个可以重复触发的计时器,所以我想另一个问题是我可以使用 Cocos2D 菜单按钮删除触摸吗?
干杯。 :-)
Using Cocos2D, is it possible to create a button which constantly triggers when being touched, instead of triggering just once?
I'm happy to have a timer which does the repeat trigger, so I guess another question is can I use a touch removed with a Cocos2D menu button?
Cheers. :-)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您实际上并不需要不断触发按钮。如果您想使用按一次按钮来增加音量或移动某些东西;您可以设置一个标志(例如:bool var = true),就像触发按钮按下事件时一样,继续执行所需的操作,直到触发按钮按下事件,您可以将标志设置为其他状态(例如 bool var = false)。
比使用计时器触发事件简单得多。
引人深思
http://en.wikipedia.org/wiki/Functional_fixedness
You don't really need to have a button triggered constantly. If you want to use a button pressed once, to increase the volume or to move something; you can just set a flag (eg: a bool var = true) as when a button-down event is triggered, keep performing your required action, till a button-up event is triggered where you would set your flag to some other state (eg a bool var = false).
Much simpler than using a timer to trigger events.
Food for thought
http://en.wikipedia.org/wiki/Functional_fixedness