开发者

Cocos2D iPhone Repeating Buttons

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. :-)


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜