2 개의 CCLayers가 서로 쌓여 있습니다. 둘 다 터치가 가능합니다. 나는 최고의 CCLayer가 터치에 반응하고 소비하고, 맨 아래 레이어가 맨 위 레이어가 소비하는 터치에 반응하지 않기를 바란다.다중 터치 지원 CCLayer, 상단 레이어가 터치를 소모하지 않음
상부층이 닮은 CCTouchBegan 방법이있다 :
- (BOOL) ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event
{
NSLog(@"touched!");
CGPoint location = [touch locationInView:[touch view]];
location = [[CCDirector sharedDirector] convertToGL:location];
//DO STUFF WITH TOUCH
return YES;
}
바닥층이 닮은 CCTouchesEnded 방법 가지고
상단 층은하지- (void) ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
//choose one of the touches to work with
UITouch *touch = [touches anyObject];
CGPoint location = [touch locationInView:[touch view]];
location = [[CCDirector sharedDirector] convertToGL:location];
//DO STUFF WITH THE TOUCH
}
결과가 있음을 감동을 소비하지 않거나 전혀 반응하지 않습니다. 맨 아래 계층 만이 터치에 응답합니다.
질문에 대한 답변을 얻으려면 이보다 더 많은 정보가 필요합니다. 이 레이어에는 무엇이 포함되어 있습니까? 어떻게 지내고 있습니까? 화면에 어디에 추가됩니까? –
@DustinRowland 완료. – TheDanman
@ TheDanman은 터치를 '소비하는'레이어가 중요합니까? –