Cocos2D iPhone 重复按钮

发布于 2024-09-08 03:54:16 字数 123 浏览 0 评论 0原文

使用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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

只涨不跌 2024-09-15 03:54:16

您实际上并不需要不断触发按钮。如果您想使用按一次按钮来增加音量或移动某些东西;您可以设置一个标志(例如: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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文