It keeps showing the black color.
Following is my demo code:
- (void)touchBegan:(UITouch *)touch withEvent:(UIEvent *)event
{
[self beginMotionStreak];
}
- (void)touchMoved:(UITouch *)touch withEvent:(UIEvent *)event
{
[self addMotionStreak:[touch locationInWorld]];
}
- (void)touchEnded:(UITouch *)touch withEvent:(UIEvent *)event
{
[self endMotionStreak];
}
- (void)beginMotionStreak
{
CCMotionStreak *streak = [CCMotionStreak streakWithFade:10 minSeg:1.0 width:5.0 color:[CCColor greenColor] texture:nil];
[self addChild:streak z:1 name:@"streak"];
}
- (void)addMotionStreak:(CGPoint)touchLoc
{
CCMotionStreak *streak = (CCMotionStreak *)[self getChildByName:@"streak" recursively:YES];
[streak setColor:[CCColor redColor]];
[streak setPosition:touchLoc];
}
- (void)endMotionStreak
{
[self removeChildByName:@"streak" cleanup:YES];
}
Any advice? Thanks