Detectar si se tocó un sprite específico en Cocos2d-iphone

Estaba siguiendo el tutorial de Ray para hacer un juego simple de iPhone (aquí:http://goo.gl/fwPi), y decidí que quería que los enemigos fueran eliminados cuando los tocaran.

Mi enfoque inicial fue generar un pequeño sprite CCSprite en la ubicación táctil, luego usar CGRectMake para crear un cuadro delimitador de dicho sprite para detectar si el sprite enemigo fue tocado. Al igual que Ray hace con el proyectil / enemigo. Pero, por supuesto, mi forma de hacerlo no funciona y no puedo sacarme de este agujero.

Aquí está el fragmento de código relevante. Cualquier ayuda es apreciada:

- (void)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {

    // Choose one of the touches to work with
    UITouch *touch = [touches anyObject];
    CGPoint location = [self convertTouchToNodeSpace: touch];
    location = [[CCDirector sharedDirector] convertToGL:location];
    CCSprite *touchedarea = [CCSprite spriteWithFile:@"Icon-72.png" rect:CGRectMake(location.x, location.y, 2, 2)];
    touchedarea.tag = 2;
    [self addChild:touchedarea];
    [_touchedareas addObject:touchedarea];

}



- (void)update:(ccTime)dt {

    NSMutableArray *touchedareasToDelete = [[NSMutableArray alloc] init];
    for (CCSprite *touchedarea in _touchedareas) {
        CGRect touchedareaRect = CGRectMake(
                                           touchedarea.position.x, 
                                           touchedarea.position.y, 
                                           touchedarea.contentSize.width, 
                                           touchedarea.contentSize.height);

        NSMutableArray *targetsToDelete = [[NSMutableArray alloc] init];
        for (CCSprite *target in _targets) {
            CGRect targetRect = CGRectMake(
                                           target.position.x - (target.contentSize.width/2), 
                                           target.position.y - (target.contentSize.height/2), 
                                           target.contentSize.width, 
                                           target.contentSize.height);

            if (CGRectIntersectsRect(touchedareaRect, targetRect)) {
                [targetsToDelete addObject:target];             
            }                       
        }

        for (CCSprite *target in targetsToDelete) {
            [_targets removeObject:target];
            [self removeChild:target cleanup:YES];                                  
        }

        if (targetsToDelete.count > 0) {
            [touchedareasToDelete addObject:touchedarea];
        }
        [targetsToDelete release];
    }

    for (CCSprite *touchedarea in touchedareasToDelete) {
        [_touchedareas removeObject:touchedarea];
        [self removeChild:touchedarea cleanup:YES];
    }
    [touchedareasToDelete release];
}

Respuestas a la pregunta(2)

Su respuesta a la pregunta