I looked around for a while, and for some reason I could not find the answer. It seems simple enough, but maybe I just can't find the function I need in the library.
I have a scene with a layer that contains a bunch of CCNodes with each of them CCSprite.
During the application, I navigate the main layer to βpanβ around the camera in some way. (i.e. translate the entire layer so that the viewport changes).
Now I want to determine the absolute position of the CCNode in the screen coordinates. The position property returns the position relative to the parent node, but I really would like this to transform its actual position on the screen.
In addition, as an added bonus, it would be great if I could express this position as a coordinate system, where 0,0 displays in the upper left corner of the screen, and 1,1 in the lower right corner of the screen. (Thus, I remain compatible with all devices)
Edit: Note that the solution should work for any CCNodes hierarchy.
Tovi7 source share