CcTouchesBegan not shoot cocos2D?

Hello, I created a layer for a demo game application using cocos2D Framework. I am integrating cocos2d with an existing application. I need to define Touch Events for this. But I can’t detect it. I used ccTouchesBegan.

- (BOOL)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    [self ccTouchesEnded:touches withEvent:event];
}

Even a simple touchBegan event also fails.

Do I need to add something like a delegate or protocol? I am new to iphone development and also learning cocos2d games development software. please, help.

+3
source share
1 answer

In the method initfor the layer, you need to tell him to respond to touches by setting self.isTouchEnabled = YES;.

+9
source

Source: https://habr.com/ru/post/1748819/


All Articles