0
votes

I have a Bow and a hand attached in one CCSprite facing towards right. The anchor point is set at the shoulder, that is (0,0.5).

           I
   (o)-----I
           I

Here suppose (o) is the anchor point,and now the whole structure is rotated to 90 degrees and -90 degrees. Now we know the angle to which we have rotated and the CGPoint of (o) , I need to find the coordinates of the upper and lower end of the structure.

So that when I have those points, I will draw a line from the center to both the points (to be seeming like Bow string).

1
add a CCDrawNode to the CCSprite with two line segments, then just rotate the sprite. This assumes you are using 3.x, and the strings are always visible.YvesLeBorg

1 Answers

1
votes

You can do it by hand but it's not a simple way.
There are some methods to convert points coordinate from one Node to another in the cocos2d.
Convert nodes coordinate to worlds space, and then send convertToNodeSpace to your node where you trying to get the coordinates.
convertToNodeSpace
convertToWorldSpace
(Point coordinates in its own node space are relative and always stays the same regardless of its rotation.)