In Cocos2d, with buttons on multiple layers, how can I control which button to react to user's touch?

妖精的绣舞 提交于 2019-12-24 10:04:27

问题


Now I have a CCLayer of gameplay, where there are a few buttons. And I want to pop up a dialog layer, where there are also a few buttons. How can I deactivate the background buttons and only make the foreground buttons activated?


回答1:


Use CCMenuItem setIsEnabled method to disable button.




回答2:


What about a lot of buttons on gameplay? Disable every button looks like not the best solution... Is it possible to disactivate all buttons in one fell swoop as topic starter requested?



来源:https://stackoverflow.com/questions/6641031/in-cocos2d-with-buttons-on-multiple-layers-how-can-i-control-which-button-to-r

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!