作为 cocos2d 的新手,我在这一点上被粉刷过
elfSheet = [CCSpriteBatchNode batchNodeWithFile:@"BowSpritesheet.png" capacity:12];
[self addChild:elfSheet];
elfFrame1 = [CCSpriteFrame frameWithTexture:elfSheet.texture rect:
CGRectMake(0, 0, 128, 140)]; //elf run00001.png
elfFrame2 = [CCSpriteFrame frameWithTexture:elfSheet.texture rect:
CGRectMake(128, 0, 110, 140)]; //elf run00002.png
Bow = [CCSprite spriteWithTexture:elfFrame1.texture rect:elfFrame1.rect];
Bow.position=ccp(size.width/8, size.height/5);
[elfSheet addChild:Bow z:0];
现在elfSheet
在CCSpriteBatchNode
cctouches 开始我需要将精灵帧更改为elfFrame2
当我尝试设置显示帧时它会导致崩溃
-(void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
[Bow setDisplayFrame:elfFrame2];//Creates a crash
}
请在这个问题上帮助我
提前谢谢