0
在我的游戏中,我有一堆鱼在一个批处理节点中渲染。在运行时,当鱼得到命中时,我想将显示帧更改为受伤的鱼图像。cocos2d游戏setDisplayFrame在运行时
但是,改变时,游戏突然变慢。任何想法为什么?
-(void) gotHit
{
hitPoint--;
if (hitPoints > 0) {
NSString* hpname = [NSString stringWithFormat:@"fish%ihp%i.png", type, hitPoints];
CCSpriteFrame* hpframe = [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:hpname];
[self setDisplayFrame:hpframe];
}
if (hitPoints <= 0) {
[self die];
}
}