CCMotionStrike在设备上不起作用,但在模拟器中起作用

时间:2011-06-15 13:08:41

标签: iphone objective-c xcode cocos2d-iphone

所以我有最新的CCMotionStrike(使用ccVertexesLineToPolygon)。它在模拟器中按预期工作,但在设备上它一次只绘制一个段(我必须释放触摸并重绘,然后它将再次只绘制一个段)

//init method:
self.isTouchEnabled = YES;
CGSize s = [[CCDirector sharedDirector] winSize];
// create the streak object and add it to the scene
streak = [CCMotionStreak streakWithFade:2 minSeg:5 width:5 color:ccc3(255, 0, 0) image:@"streak.png"];
[self addChild:streak];
streak.position = ccp(s.width/2, s.height/2);

-(void)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
    UITouch *touch = [touches anyObject];
    CGPoint touchLocation = [touch locationInView: [touch view]];   
    touchLocation = [[CCDirector sharedDirector] convertToGL: touchLocation];
    [streak setPosition:touchLocation];
    isDrawing = true;
}

1 个答案:

答案 0 :(得分:0)

CCMotionStreak仅适用于一个连胜...

编辑:

isDrawing = true;放入ccTouchesBeganccTouchesEndedisDrawing = false;

然后,将其从ccTouchesMoved

中删除

我怀疑这与它有什么关系,但我总是把streak.position = ccp(s.width/2, s.height/2);放在[self addChild:streak];之前

相关问题