I am trying to use CCMotionStreak to draw a path using CCSprite.
Init:
CCMotionStreak* streak; streak = [CCMotionStreak streakWithFade:100 minSeg:1 image:@"streak.png" width:5 length:3 color:ccc4(0, 255, 255, 255)];streak.position = self.theHero.heroSprite.position;
When the contact ends:
-(void) ccTouchEnded:(UITouch*)touch withEvent:(UIEvent *)event { [self unschedule:@selector(doStep:)]; CGPoint touchLocation = [touch locationInView: [touch view]]; CGPoint curPosition = [[CCDirector sharedDirector] convertToGL:touchLocation]; [self.theHero.heroSprite stopAllActions];
When I start the demo, CCMotionStreak draws a line beautifully for the first time. I touched the screen, and then, when the sprite stopped, I tried to touch another place on the screen, and CCMotionStreak successfully executed the second line, but I noticed that the CCMotionStreak lines are โa little shakenโ ( slightly shifted) while moving the sprite, and then โshake to normalโ when the sprite stops moving.
I hope someone can give me a hint, thanks :)
source share