使用 CCTouchDispatcher Cocos2d 2.0 Beta-2 ARC

2024-04-22

我正在使用 cocos2d 2.0 BETA 2.0 [最新的] 创建一个游戏。我需要在其他班级添加一个操纵杆。所以我在第二堂课上称之为“CCTouchDispatcher”。但我不能这样调用:

[[CCTouchDispatcher sharedDispatcher] addTargetedDelegate:self priority:0 swallowsTouches:YES];

所以我做了这个:

_tocuhDispatcher = [[CCTouchDispatcher alloc] init];
[_tocuhDispatcher addTargetedDelegate:self priority:0 swallowsTouches:YES];

但仍然无法检测到触摸。如果我在 HelloWorldLayer 中启用触摸,我可以通过触摸移动我的对象,但操纵杆不起作用

我能做什么?


CCDirector *director = [CCDirector sharedDirector];
[[director touchDispatcher] addTargetedDelegate:self priority:0 swallowsTouches:YES]; 
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用 CCTouchDispatcher Cocos2d 2.0 Beta-2 ARC 的相关文章

随机推荐