Cocos2d Anchor points

Posted on

in

,

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[clear]

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.

Leave a Reply

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

About me

Mark Wong is a front end developer with 10+ years experience. Most of his knowledge of HTML5, CSS and Js is self taught.

Calendar

January 2025
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031