我有从下到上产卵的精灵。它们随机出现,我没有使用spritesheet。问题是它们在从下到上移动时会闪烁。我怎样才能克服这个问题?我正在使用cocos2d 1.0.1。谢谢你的帮助。
//确定沿X轴生成目标的位置
CGSize winSize = [[CCDirector sharedDirector] winSize];
int minX = target.contentSize.width/2;
// int maxX = winSize.width - target.contentSize.width/2;
// int rangeX = maxX - minX;
int actualX = (arc4random() % 230) + minX;
// Create the target slightly off-screen along the right edge,
// and along a random position along the Y axis as calculated above
target.position = ccp(actualX,-100);
[self addChild:target];
// Determine speed of the target
float minDuration = 4.0;
float maxDuration = 12.0;
float rangeDuration = maxDuration - minDuration;
//int actualDuration = (arc4random() % rangeDuration) + minDuration;
// Create the actions
id actionMove = [CCMoveTo actionWithDuration:rangeDuration position:ccp(actualX,winSize.height+target.contentSize.height)];
[target runAction:[CCSequence actions:actionMove, nil]];
答案 0 :(得分:1)
在appdelegate中我增加了FPS并且精灵运动很顺利。我换了
[[CCDirector sharedDirector] setAnimationInterval:1.0 / 60];与
[[CCDirector sharedDirector] setAnimationInterval:0.5 / 60];