< Back to Demonfall, Game Dev

Cocos2d Anchor points

I wrote this post because while working on Eternal Pain I kept forgetting how anchor points worked, being used to Flash and it’s wysiwyg interface.

Cocos2d’s anchor point defaults in the middle of the object. The image below illustrates this.

ccos2d anchor points

So, if you’re trying to make a hit area, you either make the anchor point (0,1) or start at the default anchor point and then move to (0,1) by going left and up by half the image’s width/height.

The image above also illustrators the anchor point for the stage. Putting an image in position (0,0) put it in the bottom left corner on the screen.

Be Sociable, Share!

Leave a Reply

Your email address will not be published. Required fields are marked *