objective c - Drawing a line that follows two independent objects -
I am trying to draw a line on the screen after two moving objects, which means that one end of each of the objects , Even if the objects move forward independently from each other. Here's my code to draw my line:
CCDRN node * Draw = [[Ccdira Nod Eloc] IIT]; CCColor * color = [[CCColor alloc] initWithCcColor3b: ccc3 (140, 100, 10)]; CGPoint worldCoordCart = [_cart ConvertWallSpace: _cart.position]; CGPoint worldCoordClaw = [_claw Convert ToWorldSpace: _claw.position]; [DrawSegment Draw: WorldCardCart: WorldCardCloud Radius: 5Color: Color]; [Self Combined: Draw]; How do I try to update the Draw method in a sense so that the line is always attached to both objects? And my line segment is not in the middle of my objects, though I think their position should be the same? I think that when it comes to the understanding of this world space situation I am missing some basic.
_cart.position its position is in parent, not in _cart. Try CGPEINT WORK CARDCART = [_cart.parentConvertWallSpace: _cart.position]; Also for _claw.
In addition, I do not think the embedded diagram can be updated in a CCDrawNode. I think you have to sub-class CCDRnode and provide yourself with ways to update start and end locations. Whenever it is updated, you start using the clear method, and then add a new line segment with the updated coordinates.
Comments
Post a Comment