문제

Hello I am making a side scrolling cocos2d game. I have one class subclassed from CCLayer and other classes subclassed from CCSprite and CCNode. Can I use the ccTouch methods in the classes subclassed from CCSprite and CCNode, or can they only be in the class subclassed from CCLayer?

도움이 되었습니까?

해결책

Try this

[[[CCDirector sharedDirector] touchDispatcher] addTargetedDelegate:self priority:0 swallowsTouches:YES];

and call

- (BOOL)ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event {
    return YES;
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top