Cadrick Loh
Cadrick Loh

Reputation: 721

Converting child to screen space in cocos2d

currently I have 2 images, ImageA and ImageB. ImageB is a child of ImageA

Assuming ImageA position is in (100, 100); then ImageB local position is (10, 0);

So what I'm trying to do is how can I retrieve the screen position of ImageB whereby it will return me (110, 100) instead of (10, 0)?

Upvotes: 0

Views: 451

Answers (1)

Guru
Guru

Reputation: 22042

You can use this API to get world position of sprite.

    CGPoint loc =[self convertToWorldSpace:sprite.position];

Upvotes: 1

Related Questions