1
votes

I added 10 sprites on screen all with zValue = 0.

Now under ccTouchesMoved method, I store all touch points and then draw them under -(void)draw method.

My problem is the no matter even if zValue of sprite is 0, if I draw a line with my touches over any sprite it is actually drawn under the sprite (NOT OVER IT).

I tried changing the start and end points to nodeSpace but didn't help.

        start = CGPointFromString([touchPoints objectAtIndex:i]);
    end = CGPointFromString([touchPoints objectAtIndex:i+1]);
    start = [self convertToNodeSpace:start];
    end = [self convertToNodeSpace:end];
    ccDrawLine(start, end);

Any suggestions?

1

1 Answers

1
votes

You are drawing at z-index 0. If you set the zIndex of your sprites to a negative value they will be drawn behind the line.