1
votes

I have some problem with Anchor point..

i have a sprite and i need to calculate the anchor point for this sprite around the screen center.

How can i calculate the anchor point?

1

1 Answers

1
votes

You can access the anchor point values using:

mySprite.anchorPoint.x 

and

mySprite.anchorPoint.y

These are both floating point values so be aware of that.

EDIT

To set them you just do:

mySprite.anchorPoint = ccp(1.0f, 1.0f);

An anchor point of (1.0, 1.0) would be the upper right corner of your image, whereas the original anchor point is in the middle and therefore, (0.5, 0.5). To try and solidify the anchor point for the bottom left would be (0.0, 0.0). You can get any other anchor point within the image by understanding these.