开发者

Cocos2D iPhone Repeating Buttons

开发者 https://www.devze.com 2023-01-06 11:32 出处:网络
Using Cocos2D, is it possible to create a button which constantly triggers when being touched, instead of triggering just once?

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

精彩评论

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