我通过足球的约10个不同的图像,以使它看起来就像是旋转运行,但我是一个CCAnimation像这样做(cocos2d的):CCAnimation
// load the football's animation frames as textures and create a sprite frame
frames = [[NSMutableArray alloc]initWithCapacity:3];
for (int i = 0; i < 10; i++)
{
NSString* file = [NSString stringWithFormat:@"Football%i.png", i];
CCTexture2D* texture = [[CCTextureCache sharedTextureCache] addImage:file];
CGSize texSize = texture.contentSize;
CGRect texRect = CGRectMake(0, 0, texSize.width, texSize.height);
CCSpriteFrame* frame = [CCSpriteFrame frameWithTexture:texture rect:texRect];
[frames addObject:frame];
}
CCAnimation* anim = [CCAnimation animationWithFrames:frames delay:0.03f];
// run the animation by using the CCAnimate action
CCAnimate* animate = [CCAnimate actionWithAnimation:anim];
CCRepeatForever* repeat = [CCRepeatForever actionWithAction:animate];
[self runAction:repeat];
所以我的问题当我与另一个物体相撞时,是否有办法让足球停止旋转?
我确实使用了CCSpriteFrameCache:NSString * bulletFrame = [NSString stringWithFormat:@“Football-%i.png”,i]; CCSpriteFrame * frame = [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:bulletFrame]; [frames addObject:frame]; – mm24 2012-05-17 17:10:13