2012-01-09 2 views
0

맨 아래에서 맨 위로 스폰하는 스프라이트가 있습니다. 그들은 무작위로오고 있으며 나는 이것을 위해 스프라이트 시트를 사용하지 않았다. 문제는 아래에서 위로 이동하는 동안 깜박입니다. 어떻게이 문제를 극복 할 수 있습니까? 나는 cocos2d 1.0.1을 사용하고있다. 어떤 도움을 주셔서 감사합니다. AppDelegate에에서 X 축cocos2d에서 스프라이트의 깜박임 (진동) 문제가 발생했습니다.

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

스프라이트 이동을위한 코드를 표시해야합니다. – samfisher

+0

일부 코드를 추가했습니다. –

+0

코드가 실행되는 FPS는 무엇입니까? –

답변

1

함께 목표를 생성 할 위치를

// 결정 나는 FPS를 증가 스프라이트의 움직임이 원활했다. 나는 바꿨다.

[[CCDirector sharedDirector] setAnimationInterval : 1.0/60];

[[CCDirector sharedDirector] setAnimationInterval : 0.5/60];

관련 문제