지연 시간과 대상을 제거하기 위해, 코드는 target.tag = 1, 나는 그것의 이미지를 보여 0.5을 지연 할 경우이어떻게 지연 시간과 대상을 삭제하려고
-(void)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [touches anyObject];
CGPoint location = [self convertTouchToNodeSpace: touch];
targetsToRemove = [[NSMutableArray array] init];
for (CCSprite *target in _targets) {// here _targets is NSMutableArray
if (CGRectContainsPoint(target.boundingBox, location)) {
[targetsToRemove addObject:target];
}
}
for (CCSprite *target in targetsToRemove) {
if (target.tag == 1) {
[target setTexture:[[CCTextureCache sharedTextureCache] addImage:@"1.png"]];
[_targets removeObject:target];
[self removeChild:target cleanup:YES];
}
else {
CCLOG(@"remove target immediately");
}
}
}
을 좋아하고, 그것을 제거하고 scheduleOnce를 사용하려고 시도하지만 충돌이 발생합니다. 어떻게해야합니까? 이 작동하는 경우