Мой код имеет два класса, связанных с маркерами.Bullet и BulletCache.BulletCache создает определенное число
. Я перешел к созданию нового метода создания пули, предназначенного для стрельбы из пуль.Я использовал метод CCFuncN, но в настоящее время игра выдает ошибки NSException:
CCAction* action = [CCSequence actions:
[CCAnimate actionWithAnimation:[profile getAnimation:@"attack" index:currentDir]],
[CCCallFuncN actionWithTarget:self selector:@selector(shootBulletFrom:)],
nil];
NSInvalidArgumentException', reason: '-[Player shootBulletFrom:]: unrecognized selector sent to instance 0x703ec70'
edit:
Для получения дополнительной помощи и совета здесь используется метод shootBulletFrom в BulletCache.* Этот метод находится в BulletCache
-(void) shootBulletFrom:(CGPoint)startPosition velocity:(CGPoint)velocity frameName:(NSString*)frameName
isPlayerBullet:(bool)isPlayerBullet
{
CCArray* bullets = [batch children];
CCNode* node = [bullets objectAtIndex:nextInactiveBullet];
NSAssert([node isKindOfClass:[Bullet class]], @"not a Bullet!");
Bullet* bullet = (Bullet*)node;
[bullet shootBulletAt:startPosition velocity:velocity frameName:frameName
isPlayerBullet:isPlayerBullet];
nextInactiveBullet++;
if (nextInactiveBullet >= [bullets count])
{
nextInactiveBullet = 0;
}
}
Мне также рекомендовали изменить вызов [CCCallFuncN] внизу на:
[CCCallFuncN actionWithTarget:self selector:@selector(shootBulletFrom:shotPos velocity:velocity frameName:@"bullet1big.png" isPlayerBullet: YES)],
Но затем я получил ошибку компиляции: Ожидается':' до Скорости