-(void) ccTouchEnded:(UITouch *)touch withEvent:(UIEvent *)event
{
_nextProjectile = [[CCSprite spriteWithFile:@"arrow.png"]retain];
_nextProjectile.position = imgArrow.position;
[imgArrow runAction:[CCSequence actions:
[CCRotateTo actionWithDuration:rotateDuration angle:cocosAngle],
[CCCallFunc actionWithTarget:self selector:@selector(finishShoot)],
nil]];
//Some code
}
- (void)finishShoot {
// Ok to add now - we've finished rotation!
[self addChild:_nextProjectile];
[_projectiles addObject:_nextProjectile];
// Release
[_nextProjectile release];
_nextProjectile = nil;
}
当我点击两次弓时,我的箭头重叠在另一个上面。CCSprite重叠在另一个上
有帮助吗?
我读HTTP(如果有任何修正语法错误)://计算器.com/questions/6578/understanding-reference-counting-with-cocoa-and-objective-c as reference.still我无法解决我的问题。 – 2013-04-22 12:55:14
我的项目中只有一个名称为_nextProjectile的箭头。 和我使用runAction中的finishShoot方法释放它。 – 2013-04-22 13:06:19